Commit 1c400de9 authored by Linus Torvalds's avatar Linus Torvalds

x86: fix stackframe ownership confusion in sys_sigaltstack()

gcc doesn't understand that "asmlinkage" routines have the
argument stack owned by the assembly-language caller, and the
recent sparse cleanup made gcc think it owns enough stack
frame space to make a tailcall by overwriting "struct pt_regs"
that is set up by the low-level system call code.

Hide that problem again.

The real fix would be to tell gcc that the caller owns the
stack frame that it set up, but we don't have any such
interfaces, so for now the best we can do is to hide it.
parent b0a395c5
...@@ -116,11 +116,14 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, ...@@ -116,11 +116,14 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
} }
asmlinkage int asmlinkage int
sys_sigaltstack(struct pt_regs regs) sys_sigaltstack(unsigned long ebx)
{ {
const stack_t __user *uss = (const stack_t __user *)regs.ebx; /* This is needed to make gcc realize it doesn't own the "struct pt_regs" */
stack_t __user *uoss = (stack_t __user *)regs.ecx; struct pt_regs *regs = (struct pt_regs *)&ebx;
return do_sigaltstack(uss, uoss, regs.esp); const stack_t __user *uss = (const stack_t __user *)ebx;
stack_t __user *uoss = (stack_t __user *)regs->ecx;
return do_sigaltstack(uss, uoss, regs->esp);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment