Skip to content

Commit

Permalink
x86, signals: fix xine & firefox bustage
Browse files Browse the repository at this point in the history
Impact: fix bad frame in rt_sigreturn on 64-bit

After commit 97286a2 some applications
fail to return from signal handler:

[  145.150133] firefox[3250] bad frame in rt_sigreturn frame:00007f902b44eb28 ip:352e80b307 sp:7f902b44ef70 orax:ffffffffffffffff in libpthread-2.9.so[352e800000+17000]
[  665.519017] firefox[5420] bad frame in rt_sigreturn frame:00007faa8deaeb28 ip:352e80b307 sp:7faa8deaef70 orax:ffffffffffffffff in libpthread-2.9.so[352e800000+17000]

The root cause is forgetting to keep 64 byte aligned value of
fpstate for next stack pointer calculation.

Reported-by: Jaswinder Singh Rajput <jaswinder@kernel.org>
Reported-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
LKML-Reference: <49AC85C1.7060600@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Hiroshi Shimamoto authored and Ingo Molnar committed Mar 3, 2009
1 parent 1fae027 commit 2505170
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions arch/x86/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,10 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size,

if (used_math()) {
sp -= sig_xstate_size;
#ifdef CONFIG_X86_32
*fpstate = (void __user *) sp;
#else /* !CONFIG_X86_32 */
*fpstate = (void __user *)round_down(sp, 64);
#endif /* CONFIG_X86_32 */
#ifdef CONFIG_X86_64
sp = round_down(sp, 64);
#endif /* CONFIG_X86_64 */
*fpstate = (void __user *)sp;

if (save_i387_xstate(*fpstate) < 0)
return (void __user *)-1L;
Expand Down

0 comments on commit 2505170

Please sign in to comment.