do_rt_sigreturn provide the target sp
PATCH 2/2 do_rt_sigreturn provide the target sp
From: bob picco <[email protected]>
do_sigaltstack expects the stack we are returning to. An issue will manifest with an alternate stack. That is, a sigaltstack followed by a sigaction (aka. rt_sigaction) with SA_ONSTACK for flags will sigsegv. do_sigaltstack returns -EPERM having found on_sig_stack to be true and a sigsegv results.
Let's teach do_rt_sigreturn to provide do_sigaltstack with our target stack.
--- arch/sparc/kernel/signal_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/kernel/signal_64.c +1 -1
@@ -295,7 +295,7 @@ void do_rt_sigreturn(struct pt_regs *regs) err |=restore_fpu_state (regs, fpu_save); err |=__copy_from_user (&set, &sf->mask,sizeof (sigset_t)); - err |=do_sigaltstack (&sf->stack,NULL , (unsigned long )sf); + err |=do_sigaltstack (&sf->stack,NULL , regs->u_regs[UREG_FP ]);if (err) goto segv;
Signature · 1 line
1.7.10
David Miller
maintainerFrom: Bob Picco <[email protected]>
Date: Thu, 27 Sep 2012 11:36:45 -0400
Quoted 6 lines
do_sigaltstackexpects the stack we are returning to. An issue will manifest with an alternate stack. That is, a sigaltstack followed by a sigaction (aka.rt_sigaction) withSA_ONSTACKfor flags will sigsegv.do_sigaltstackreturns-EPERMhaving foundon_sig_stackto be true and a sigsegv results.Let's teach
do_rt_sigreturnto providedo_sigaltstackwith our target stack.
"sf" is our target stack frame in the stack frame pointed to by UREG_FP.
You really haven't described the real reason why this doesn't work as-is, and therefore your commit message is inadequate and made me do a lot of work I shouldn't have to do.
Your commit message implies that we are not passing in something related to the stack frame, but we actually are.
And if this location is wrong, why didn't you update all of the other do_sigaltstack() callers in the sparc port. By your description they should be wrong too.
But those cases don't matter like this one does. This case here is special, but you haven't described what is so unique about this case which causes only it to need special handling.
Do you know the real reason why it fails without your change?
Hi:
David Miller wrote: [Thu Sep 27 2012, 10:15:54PM EDT]
Quoted 24 lines
From: Bob Picco <[email protected]>
Date: Thu, 27 Sep 2012 11:36:45 -0400Quoted 6 lines
do_sigaltstackexpects the stack we are returning to. An issue will manifest with an alternate stack. That is, a sigaltstack followed by a sigaction (aka.rt_sigaction) withSA_ONSTACKfor flags will sigsegv.do_sigaltstackreturns-EPERMhaving foundon_sig_stackto be true and a sigsegv results.Let's teach
do_rt_sigreturnto providedo_sigaltstackwith our target stack."sf" is our target stack frame in the stack frame pointed to by
UREG_FP.You really haven't described the real reason why this doesn't work as-is, and therefore your commit message is inadequate and made me do a lot of work I shouldn't have to do.
Your commit message implies that we are not passing in something related to the stack frame, but we actually are.
And if this location is wrong, why didn't you update all of the other
do_sigaltstack()callers in the sparc port. By your description they should be wrong too.
Quoted 5 lines
But those cases don't matter like this one does. This case here is special, but you haven't described what is so unique about this case which causes only it to need special handling.
Do you know the real reason why it fails without your change?
Sorry about the deficient change log. Won't happen again! It was a couple months ago when I had full context and was perhaps wrong. It was a combination of glibc and kernel investigation/debug and very subtle. I'll review and have a thorough explanation in the change log soon.
thanx,
bob
David Miller
maintainerFrom: Bob Picco <[email protected]>
Date: Fri, 28 Sep 2012 05:56:30 -0400
Quoted 4 lines
Sorry about the deficient change log. Won't happen again! It was a couple months ago when I had full context and was perhaps wrong. It was a combination of glibc and kernel investigation/debug and very subtle. I'll review and have a thorough explanation in the change log soon.
I thought you actually knew offhand. :-/
It's because of the STACK_BIAS, that's what's unique in this case.