Skip to contentSkip to conversation

s390: rt_sigreturn fix.

PATCH New Martin Schwidefsky 1 participant 1 message Nov 21, 2005 s390

lore
Share & tools
lore
#0 lore raw

PATCH 4/5 s390: rt_sigreturn fix.

From: Cedric Le Goater <[email protected]>

[patch 4/5] s390: rt_sigreturn fix.

Check return code of do_sigaltstack and force a SIGSEGV if it is -EFAULT.

---

 arch/s390/kernel/compat_signal.c |    2 --
 arch/s390/kernel/signal.c        |    6 +++---
 2 files changed, 3 insertions(+), 5 deletions(-)
arch/s390/kernel/compat_signal.c +0 -2
diff -urpN linux-2.6/arch/s390/kernel/compat_signal.c linux-2.6-patched/arch/s390/kernel/compat_signal.c
@@ -467,8 +467,6 @@ asmlinkage long sys32_rt_sigreturn(struc
 	if (err)
 		goto badframe; 
 
-	/* It is more difficult to avoid calling this function than to
-	   call it and ignore errors.  */
 	set_fs (KERNEL_DS);
 	do_sigaltstack((stack_t __user *)&st, NULL, regs->gprs[15]);
 	set_fs (old_fs);
arch/s390/kernel/signal.c +3 -3
diff -urpN linux-2.6/arch/s390/kernel/signal.c linux-2.6-patched/arch/s390/kernel/signal.c
@@ -254,9 +254,9 @@ asmlinkage long sys_rt_sigreturn(struct 
 	if (restore_sigregs(regs, &frame->uc.uc_mcontext))
 		goto badframe;
 
-	/* It is more difficult to avoid calling this function than to
-	   call it and ignore errors.  */
-	do_sigaltstack(&frame->uc.uc_stack, NULL, regs->gprs[15]);
+	if (do_sigaltstack(&frame->uc.uc_stack, NULL,
+			   regs->gprs[15]) == -EFAULT)
+		goto badframe;
 	return regs->gprs[2];
 
 badframe: