WSL2-Linux-Kernel/arch
Jeff Dike 2f56debd77 uml: fix FP register corruption
Commit ee3d9bd4de ("uml: simplify SIGSEGV
handling"), while greatly simplifying the kernel SIGSEGV handler that
runs in the process address space, introduced a bug which corrupts FP
state in the process.

Previously, the SIGSEGV handler called the sigreturn system call by hand - it
couldn't return through the restorer provided to it because that could try to
call the libc restorer which likely wouldn't exist in the process address
space.  So, it blocked off some signals, including SIGUSR1, on entry to the
SIGSEGV handler, queued a SIGUSR1 to itself, and invoked sigreturn.  The
SIGUSR1 was delivered, and was visible to the UML kernel after sigreturn
finished.

The commit eliminated the signal masking and the call to sigreturn.  The
handler simply hits itself with a SIGTRAP to let the UML kernel know that it
is finished.  UML then restores the process registers, which effectively
longjmps the process out of the signal handler, skipping sigreturn's restoring
of register state and the signal mask.

The bug is that the host apparently sets used_fp to 0 when it saves the
process FP state in the sigcontext on the process signal stack.  Thus, when
the process is longjmped out of the handler, its FP state is corrupt because
it wasn't saved on the context switch to the UML kernel.

This manifested itself as sleep hanging.  For some reason, sleep uses floating
point in order to calculate the sleep interval.  When a page fault corrupts
its FP state, it is faked into essentially sleeping forever.

This patch saves the FP state before entering the SIGSEGV handler and restores
it afterwards.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-23 17:12:15 -08:00
..
alpha Introduce path_put() 2008-02-14 21:13:33 -08:00
arm [ARM] 4829/1: add .get method to pxa-cpufreq to silence a warning 2008-02-17 10:42:10 +00:00
avr32 ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
blackfin d_path: Make d_path() use a struct path 2008-02-14 21:17:09 -08:00
cris cris: import memset.c from newlib: fixes compile error with newer (pre4.3) gcc 2008-02-14 20:58:04 -08:00
frv FRV: Change the timerfd syscalls to be the same as i386 2008-02-20 19:58:16 -08:00
h8300 ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
ia64 [IA64] Fix build for sim_defconfig 2008-02-11 13:23:46 -08:00
m32r ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
m68k ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
m68knommu m68knommu: fix profile timer 2008-02-14 20:58:05 -08:00
mips [MIPS] BCM47XX: Use new SSB SPROM data structure 2008-02-19 17:01:34 +00:00
mn10300 MN10300: define HZ as a config option 2008-02-23 17:12:13 -08:00
parisc Introduce path_put() 2008-02-14 21:13:33 -08:00
powerpc Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-02-21 16:18:05 -08:00
ppc [POWERPC] PPC440EP Interrupt Triggering and Level Settings 2008-02-15 21:33:02 -06:00
s390 [S390] Fix futex_atomic_cmpxchg_std inline assembly. 2008-02-19 15:29:35 +01:00
sh sh: Fix multiple UTLB hit on UP SH-4. 2008-02-14 14:45:08 +09:00
sparc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6 2008-02-19 07:53:28 -08:00
sparc64 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6 2008-02-19 07:53:28 -08:00
um uml: fix FP register corruption 2008-02-23 17:12:15 -08:00
v850 ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
x86 Mark CC_STACKPROTECTOR as being BROKEN 2008-02-22 08:21:38 -08:00
xtensa [XTENSA] Allow debugger to modify the WINDOWBASE register. 2008-02-13 17:45:36 -08:00
.gitignore arch: Ignore arch/i386 and arch/x86_64 2008-01-19 21:29:39 -08:00
Kconfig Move Kconfig.instrumentation to arch/Kconfig and init/Kconfig 2008-02-03 08:58:08 +01:00