qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-discuss] golang on linux-user


From: Hunter Laux
Subject: [Qemu-discuss] golang on linux-user
Date: Tue, 1 Mar 2016 01:38:02 -0800

I was having trouble running golang on linux-user with an aarch64 target.

It turns out that snappy is written in Go. When I tried the xenial aarch64 preinstall image in qemu, Snappy was broken.

For some reason, it calls sigaction on all the signals.

I noticed do_sigaction in linux-user/signal.c calls the host sigaction. Unfortunately, glibc blocks signal 33 and for "SIGSETXID", which I guess is just a user signal that pthread names, but thats as far as I got into it.

See here:
https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/sigaction.c

Maybe there's some simple cleaner solutions, but here's what I did.

I made a quick fix by calling the __libc_sigaction instead of the __sigaction to bypass the check for SIGSETXID. It seems to work, but I'm not sure if that's safe. My "one liner" is definitely a hack.

After I did that, I kept getting an EXCP_YIELD. I'm not sure how to handle this, but ignoring it seems to work. Again, I'm not sure that's safe.

I can run snappy now, but if anyone has any comments on the patch below or better suggestions how to solve my problem let me know.

diff --git a/linux-user/main.c b/linux-user/main.c
index 700724e..c6fda61 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -1013,6 +1013,8 @@ void cpu_loop(CPUARMState *env)
         cpu_exec_end(cs);
 
         switch (trapnr) {
+        case EXCP_YIELD:
+            break;
         case EXCP_SWI:
             env->xregs[0] = do_syscall(env,
                                        env->xregs[8],
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 962111c..08ca294 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -16,6 +16,8 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
+
+#define sigaction __libc_sigaction
 #include "qemu/osdep.h"
 #include <sys/ucontext.h>
 #include <sys/resource.h>

Thanks,
Hunter Laux

reply via email to

[Prev in Thread] Current Thread [Next in Thread]