Skip to contentSkip to conversation

ppc: Fix catching some segfaults in user mode

PATCH Applied Benjamin Herrenschmidt 2 participants 2 messages Aug 3, 2016 – Aug 4, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc: Fix catching some segfaults in user mode

The usermode "translate" code generates an error code value that has the "is_write" bit set, which causes our switch/case to miss and display "Invalid segfault errno" and a spurrious second state dump. Fix it.

---
 linux-user/main.c | 1 +
 1 file changed, 1 insertion(+)
linux-user/main.c +1 -0
index 24f34e6..eb9975c 100644
@@ -1656,6 +1656,7 @@ void cpu_loop(CPUPPCState *env)
             /* XXX: check this. Seems bugged */
             switch (env->error_code & 0xFF000000) {
             case 0x40000000:
+            case 0x42000000:
                 info.si_signo = TARGET_SIGSEGV;
                 info.si_errno = 0;
                 info.si_code = TARGET_SEGV_MAPERR;
Applied
#1 lore raw
Quoted 6 lines · Benjamin Herrenschmidt

The usermode "translate" code generates an error code value that has the "is_write" bit set, which causes our switch/case to miss and display "Invalid segfault errno" and a spurrious second state dump. Fix it.

Applied to ppc-for-2.8, thanks.

Quoted 17 lines
---
 linux-user/main.c | 1 +
 1 file changed, 1 insertion(+)
linux-user/main.c +1 -0
index 24f34e6..eb9975c 100644
@@ -1656,6 +1656,7 @@ void cpu_loop(CPUPPCState *env)
             /* XXX: check this. Seems bugged */
             switch (env->error_code & 0xFF000000) {
             case 0x40000000:
+            case 0x42000000:
                 info.si_signo = TARGET_SIGSEGV;
                 info.si_errno = 0;
                 info.si_code = TARGET_SEGV_MAPERR;
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson