我目前正在尝试包含cred.h头文件,因为我想重写uid,guid,...这些都在struct cred中。但是包含失败并显示错误消息"致命错误:linux / cred.h:没有这样的文件或目录"。我想这是因为我不能将内核头文件包含到用户空间程序中。有没有办法解决这个问题?
更新
啊我忘了提到我想用android ndk-build命令编译它,但有一个类似的选项 find命令给出了这个输出:
sudo find / -name cred.h
/tmp/mozilla_alex0/cred.h
/home/alex/Android/Sdk/goldfish/include/linux/cred.h
/usr/src/linux-headers-4.4.0-24/include/linux/cred.h
/usr/src/linux-headers-4.4.0-21/include/linux/cred.h
现在我尝试了以下内容:
$ ndk-build -I /usr/src/linux-headers-4.4.0-21/include/linux/
[armeabi] Compile thumb : futex_exploit <= exploit.c
/home/alex/Android/libfutex_exploit-master/libfutex_exploit-master/jni/exploit.c:34:18: fatal error: cred.h: No such file or directory
#include <cred.h>
^
compilation terminated.
当尝试用gcc编译文件时,我得到了同样的错误:
$ gcc -I/usr/src/linux-headers-4.4.0-21/include/linux/ exploit.c -o exploit
In file included from /usr/include/stdio.h:33:0,
from exploit.c:21:
/usr/src/linux-headers-4.4.0-21/include/linux/stddef.h:4:31: fatal error: uapi/linux/stddef.h: No such file or directory
compilation terminated.
答案 0 :(得分:2)
找到所需的文件cred.h并放入编译器将搜索的文件夹中。
gcc ..... -I<include folder> .....