static -pthread ./exploit.c -o ./exploit ./exploit.c: In function ‘spray_simple_xattr’: ./exploit.c:142:9: warning: implicit declaration of function ‘mkdir’ [-Wimplicit-function-declaration] 142 | if (mkdir("/tmp/tmpfs", S_IRWXU) == -1 && errno != EEXIST) | ^~~~~ ./exploit.c: In function ‘print_hex’: ./exploit.c:243:23: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=] 243 | printf(" %16llx",*(size_t * )(buf + i*8)); | ~~~~~^ ~~~~~~~~~~~~~~~~~~~~~~~ | | | | | size_t {aka long unsigned int} | long long unsigned int | %16lx ./exploit.c: In function ‘get_root_shell’: ./exploit.c:354:3: warning: null argument where non-null required (argument 2) [-Wnonnull] 354 | execve("/tmp/dummy", NULL, NULL); | ^~~~~~
时间: 2024-02-14 10:36:13 浏览: 47
根据您的问题描述,这似乎是一个编译警告信息,并不影响代码的运行。其中包括:
1. `implicit declaration of function ‘mkdir’` 表示您的代码中使用了mkdir函数,但是编译器没有找到该函数的声明,需要添加头文件`#include <sys/stat.h>`。
2. `format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘size_t’` 表示在打印输出时使用了错误的格式标识符。应该将`%llx`改为`%lx`。
3. `null argument where non-null required (argument 2)` 表示您在`execve()`函数中使用了NULL参数,但该参数不能为NULL。您需要将第二个和第三个参数设置为合适的值。
请您检查一下代码并进行相应的修改,以消除这些警告信息。
相关问题
gcc -o ffplay -I../libavformat -I../libavcodec -I../libavutil -I../libswresample -I../libswscale -I../libavfilter -L../libavcodec -L../libavformat -L../libavutil -L../libswresample -L../libswscale -L../libavfilter ffplay.c -lavformat -lavcodec -lswresample -lswscale -lavutil -lavfilter -lm -lz -pthread -lSDL2
这个命令是一个编译 `ffplay.c` 文件的命令,其中包含了 FFmpeg 库和 SDL 库的头文件路径和库文件路径。
具体来说,`-I` 选项用于指定头文件路径,`-L` 选项用于指定库文件路径,`-l` 选项用于指定需要链接的库文件名。下面是这个命令中的各个选项的含义:
- `-I../libavformat`: 指定了 FFmpeg 中 `libavformat` 库的头文件路径。
- `-I../libavcodec`: 指定了 FFmpeg 中 `libavcodec` 库的头文件路径。
- `-I../libavutil`: 指定了 FFmpeg 中 `libavutil` 库的头文件路径。
- `-I../libswresample`: 指定了 FFmpeg 中 `libswresample` 库的头文件路径。
- `-I../libswscale`: 指定了 FFmpeg 中 `libswscale` 库的头文件路径。
- `-I../libavfilter`: 指定了 FFmpeg 中 `libavfilter` 库的头文件路径。
- `-L../libavcodec`: 指定了 FFmpeg 中 `libavcodec` 库的库文件路径。
- `-L../libavformat`: 指定了 FFmpeg 中 `libavformat` 库的库文件路径。
- `-L../libavutil`: 指定了 FFmpeg 中 `libavutil` 库的库文件路径。
- `-L../libswresample`: 指定了 FFmpeg 中 `libswresample` 库的库文件路径。
- `-L../libswscale`: 指定了 FFmpeg 中 `libswscale` 库的库文件路径。
- `-L../libavfilter`: 指定了 FFmpeg 中 `libavfilter` 库的库文件路径。
- `-lavformat`: 指定了需要链接的 FFmpeg 中 `libavformat` 库的名称。
- `-lavcodec`: 指定了需要链接的 FFmpeg 中 `libavcodec` 库的名称。
- `-lswresample`: 指定了需要链接的 FFmpeg 中 `libswresample` 库的名称。
- `-lswscale`: 指定了需要链接的 FFmpeg 中 `libswscale` 库的名称。
- `-lavutil`: 指定了需要链接的 FFmpeg 中 `libavutil` 库的名称。
- `-lavfilter`: 指定了需要链接的 FFmpeg 中 `libavfilter` 库的名称。
- `-lm`: 指定需要链接的数学库。
- `-lz`: 指定需要链接的压缩库。
- `-pthread`: 指定需要链接的线程库。
- `-lSDL2`: 指定需要链接的 SDL2 库的名称。
这个命令的作用是将 `ffplay.c` 编译成可执行文件 `ffplay`,并链接上 FFmpeg 和 SDL 库。
./nptl/pthread_mutex_lock.c:81:_pthread_mutex_lock: Assertionmutex->__data.__owner == 0 failed
./nptl/pthread_mutex_lock.c:81:_pthread_mutex_lock: Assertion mutex->__data.__owner == 0 failed是一个断言错误。这个错误表示在调用pthread_mutex_lock函数时,mutex锁已经被其他线程拥有。根据引用中的描述,pthread_mutex_lock函数首先在用户态进行CAS操作判断是否可以获取锁,如果锁已经被其他线程获取,则会进行系统调用将当前线程挂起。在你的运行结果中,这个错误发生在p5线程调用pthread_mutex_lock函数时,p5线程尝试获取一个已经被其他线程拥有的mutex锁,导致断言失败。这个问题可以通过确保在调用pthread_mutex_lock函数之前,没有其他线程已经获取了该锁来解决。