用root执行的,企图跳出根文件系统,跳到initramfs里面去,但是失败了
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
int main(int argc, char **argv){
printf("EUID=%u \n", geteuid());
printf("chroot return %d \n", chroot(".java"));
printf("chdir return %d \n", chdir("../../../../../../../../../../.."));
execve("bin/sh", NULL, NULL);
printf("execve return %s\n", strerror(errno));
char path[200];
printf("PWD %s \n", getcwd(path,200));
}
root执行的,输出是
[xtricman@XTRICMAN-PC ~]$ su
密码:
[root@XTRICMAN-PC xtricman]# gcc t.c -o t
[root@XTRICMAN-PC xtricman]# ./t
EUID=0
chroot return 0
chdir return 0
execve return No such file or directory
PWD (unreachable)/
[root@XTRICMAN-PC xtricman]#
为啥没成功执行shell?这到底是跳到了initramfs还是没有啊?