aboutsummaryrefslogtreecommitdiff
blob: 1162542233813ba3d8773c7c92578e588cf69838 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From db186a3f83454268c43fc793a48bc28c41368a6c Mon Sep 17 00:00:00 2001
From: Petros Angelatos <petrosagg@gmail.com>
Date: Thu, 3 Mar 2016 23:58:53 -0800
Subject: [PATCH] linux-user: ignore signals 33 and 64 to allow golang
 emulation

Signal 33 will always fail. This causes golang crash since
https://github.com/golang/go/commit/675eb72c285cd0dd44a5f280bb3fa456ddf6de16

As explained in that commit, these signals are very rarely used in a
way that causes problems, so it's ok-ish to ignore one of them.

Signal 64 will fail because QEMU uses SIGRTMAX for itself. This causes
golang to crash for versions earlier than
https://github.com/golang/go/commit/d10675089d74db0408f2432eae3bd89a8e1c2d6a

Since after that commit golang ignores that signal, we also ignore it here to
allow earlier versions to run as well.

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
---
 linux-user/signal.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/linux-user/signal.c b/linux-user/signal.c
index 9a4d894..90aca55 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -744,6 +744,27 @@ int do_sigaction(int sig, const struct target_sigaction *act,
     }
 
     k = &sigact_table[sig - 1];
+
+    /* This signal will always fail. This causes golang crash since
+     * https://github.com/golang/go/commit/675eb72c285cd0dd44a5f280bb3fa456ddf6de16
+     *
+     * As explained in that commit, these signals are very rarely used in a
+     * way that causes problems, so it's ok-ish to ignore one of them here.
+     */
+    if (sig == 33) {
+        return 0;
+    }
+    /* This signal will fail because QEMU uses SIGRTMAX for itself. This causes
+     * golang to crash for versions earlier than
+     * https://github.com/golang/go/commit/d10675089d74db0408f2432eae3bd89a8e1c2d6a
+     *
+     * Since after that commit golang ignores that signal, we also ignore it here to
+     * allow earlier versions to run as well.
+     */
+    if (sig == 64) {
+        return 0;
+    }
+
     if (oact) {
         __put_user(k->_sa_handler, &oact->_sa_handler);
         __put_user(k->sa_flags, &oact->sa_flags);