x86_64 save_i387_ia32 snafu
Subsystems (2)
PATCH 1/1 x86_64 save_i387_ia32 snafu
In reply to a message not in the archiveSorry about this one, mea culpa. This should go right after the "x86 i387 user_regset" patch, or be rolled into it.
--- arch/x86/ia32/ia32_signal.c | 5 ++--- arch/x86/kernel/ptrace.c | 1 - include/asm-x86/fpu32.h | 10 ---------- include/asm-x86/i387.h | 6 ++++++ 4 files changed, 8 insertions(+), 14 deletions(-)
arch/x86/ia32/ia32_signal.c +2 -3
@@ -29,7 +29,6 @@#include <asm/ia32_unistd.h> #include <asm/user32.h> #include <asm/sigcontext32.h> -#include <asm/fpu32.h> #include <asm/proto.h> #include <asm/vdso.h>
@@ -258,7 +257,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,if (buf) {if (!access_ok (VERIFY_READ , buf,sizeof (*buf))) goto badframe; - err |=restore_i387_ia32 (current, buf,0 ); + err |=restore_i387_ia32 (buf); }else {struct task_struct *me = current;
@@ -377,7 +376,7 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, err |=__put_user ((u32 )regs->flags, &sc->flags); err |=__put_user ((u32 )regs->sp, &sc->sp_at_signal); - tmp =save_i387_ia32 (current, fpstate, regs,0 ); + tmp =save_i387_ia32 (fpstate);if (tmp <0 ) err = -EFAULT ;else {
arch/x86/kernel/ptrace.c +0 -1
@@ -981,7 +981,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)#include <linux/compat.h> #include <linux/syscalls.h> #include <asm/ia32.h> -#include <asm/fpu32.h> #include <asm/user32.h> #define R32 (l,q) \
include/asm-x86/fpu32.h deleted +0 -10
@@ -1,10 +0,0 @@ -#ifndef _FPU32_H -#define _FPU32_H 1 - -struct _fpstate_ia32 ; - -int restore_i387_ia32 (struct task_struct *tsk,struct _fpstate_ia32 __user *buf,int fsave); -int save_i387_ia32 (struct task_struct *tsk,struct _fpstate_ia32 __user *buf, -struct pt_regs *regs,int fsave); - -#endif
include/asm-x86/i387.h +6 -0
@@ -28,6 +28,12 @@ extern user_regset_active_fn fpregs_active, xfpregs_active;extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get;extern user_regset_set_fn fpregs_set, xfpregs_set, fpregs_soft_set; +#ifdef CONFIG_IA32_EMULATION +struct _fpstate_ia32 ; +extern int save_i387_ia32 (struct _fpstate_ia32 __user *buf); +extern int restore_i387_ia32 (struct _fpstate_ia32 __user *buf); +#endif +#ifdef CONFIG_X86_64 /* Ignore delayed exceptions from user space */
Ingo Molnar
AppliedQuoted 2 lines · Roland McGrath
Sorry about this one, mea culpa. This should go right after the "x86 i387
user_regset" patch, or be rolled into it.
thanks, applied. Does this explain the crash/hang problems with 32-bit apps on 64-bit kernels? What was the exact failure mode?
Ingo
Quoted 2 lines
thanks, applied. Does this explain the crash/hang problems with 32-bit apps on 64-bit kernels? What was the exact failure mode?
It does. Any 32-bit process trying to run a signal handler when it had used the FPU, would clobber "current" with FP bits. The observed failure mode was shortly after this in the signal handler setup code, when it crashed due to current->mm being zero (current->pid also being zero, and the whole first 512 bytes of the task_struct being garbage).
Thanks,
Roland
Quoted 8 lines · Roland McGrath
Quoted 2 lines
thanks, applied. Does this explain the crash/hang problems with 32-bit apps on 64-bit kernels? What was the exact failure mode?
It does. Any 32-bit process trying to run a signal handler when it had used the FPU, would clobber "current" with FP bits. The observed failure mode was shortly after this in the signal handler setup code, when it crashed due to
current->mmbeing zero (current->pidalso being zero, and the whole first 512 bytes of thetask_structbeing garbage).
For what it's worth, this patch fixes a problem I had in 24-rc6-mm1 with kernel panics when certain X programs exited (Eterm being the biggest cause), that I had bisected to "somewhere in git-x86.patch"....
Quoted 10 lines · * [email protected] <[email protected]> wrote:
Quoted 8 lines · Roland McGrath
Quoted 2 lines
thanks, applied. Does this explain the crash/hang problems with 32-bit apps on 64-bit kernels? What was the exact failure mode?
It does. Any 32-bit process trying to run a signal handler when it had used the FPU, would clobber "current" with FP bits. The observed failure mode was shortly after this in the signal handler setup code, when it crashed due to
current->mmbeing zero (current->pidalso being zero, and the whole first 512 bytes of thetask_structbeing garbage).
Quoted 4 lines
For what it's worth, this patch fixes a problem I had in 24-rc6-mm1 with kernel panics when certain X programs exited (Eterm being the biggest cause), that I had bisected to "somewhere in git-x86.patch"....
ok, good. Yesterday's x86.git update has this fix included so the next -mm iteration should have the fix as well.
Ingo