forked from sim1222-mirror/wrapper
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
f3b208fabb | |||
cbb7f3f62f | |||
662866981e |
10
wrapper.c
10
wrapper.c
@ -8,6 +8,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sched.h>
|
||||||
|
|
||||||
pid_t child_proc = -1;
|
pid_t child_proc = -1;
|
||||||
|
|
||||||
@ -34,7 +35,12 @@ int main(int argc, char *argv[], char *envp[]) {
|
|||||||
mknod("/dev/urandom", S_IFCHR | 0666, makedev(0x1, 0x9));
|
mknod("/dev/urandom", S_IFCHR | 0666, makedev(0x1, 0x9));
|
||||||
chmod("/system/bin/linker64", 0755);
|
chmod("/system/bin/linker64", 0755);
|
||||||
chmod("/system/bin/main", 0755);
|
chmod("/system/bin/main", 0755);
|
||||||
|
|
||||||
|
if (unshare(CLONE_NEWPID)) {
|
||||||
|
perror("unshare");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
child_proc = fork();
|
child_proc = fork();
|
||||||
if (child_proc == -1) {
|
if (child_proc == -1) {
|
||||||
perror("fork");
|
perror("fork");
|
||||||
@ -53,4 +59,4 @@ int main(int argc, char *argv[], char *envp[]) {
|
|||||||
execve("/system/bin/main", argv, envp);
|
execve("/system/bin/main", argv, envp);
|
||||||
perror("execve");
|
perror("execve");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user