vivier / qemu-m68k

Other
41 stars 7 forks source link

WRT: execve flag #11

Closed rdebath closed 5 years ago

rdebath commented 8 years ago

Commit 8952fce8 "linux-user: add option to intercept execve() syscalls" adds the ability to specify that only this copy of the QEMU executable will be used for execve.

It has some issues:

I'm using this patch to work around some of this buy simply putting the path to the exe in the variable, however, it's not complete as I have to turn it off for SUID executables.

There are several ways this could be worked (all the way up to fakeroot/fakechroot support) but as I have solved my immediate problem (Which was to prevent x86 static executables running) it seemed best to just report this.

diff --git a/linux-user/main.c b/linux-user/main.c
index 7c71b72..f7f6268 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4081,6 +4081,16 @@ static void handle_arg_execve(const char *arg)
     char *ret;
     int len;

+    if (arg && *arg)
+    {
+        ret = realpath(arg, buf);
+
+        if (ret != NULL) {
+            qemu_execve_path = strdup(buf);
+            return;
+        }
+    }
+
     /* try getauxval() */
     execfn = (const char *) getauxval(AT_EXECFN);
vivier commented 5 years ago

8952fce8 "linux-user: add option to intercept execve() syscalls" has never been merged