Skip to contentSkip to conversation

linux-user/sh4: Notice gUSA regions during signal delivery

PATCH John Paul Adrian Glaubitz 1 participant 2 messages Jul 6, 2017

lore
Share & tools
lore

John Paul Adrian Glaubitz

author Tested-by
#0 lore raw
Quoted 17 lines · Richard Henderson

kernel also checks PC < gUSA region end point,
try this:

linux-user/signal.c +2 -1
index 1e716a9..4e1e4f0 100644
@@ -3477,7 +3477,8 @@ static abi_ulong get_sigframe(struct
 target_sigaction *ka,
 static void unwind_gusa(CPUSH4State *regs)
 {
     /* If the stack pointer is sufficiently negative... */
-    if ((regs->gregs[15] & 0xc0000000u) == 0xc0000000u) {
+    if ((regs->gregs[15] & 0xc0000000u) == 0xc0000000u &&
+        regs->pc < regs->gregs[0]) {
         /* Reset the PC to before the gUSA region, as computed from
            R0 = region end, SP = -(region size), plus one more insn
Quoted 1 line

that actually sets SP to the region size. */

This fixes the segfaults for me with newer chroots.

So, just in case:

Thanks,
Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#1 lore raw
Quoted 1 line · John Paul Adrian Glaubitz

This fixes the segfaults for me with newer chroots.

Ok, that was too fast. While some segfaults are now gone, there are still some other commands segfaulting. Again, reverting patch 5 and Laurent's patch makes these segfaults go away.

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913