Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[PATCH] i386: fix incorrect FP signal code

i386 floating-point exception handling has a bug that can cause error
code 0 to be sent instead of the proper code during signal delivery.

This is caused by unconditionally checking the IS and c1 bits from the
FPU status word when they are not always relevant. The IS bit tells
whether an exception is a stack fault and is only relevant when the
exception is IE (invalid operation.) The C1 bit determines whether a
stack fault is overflow or underflow and is only relevant when IS and IE
are set.

Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Chuck Ebbert and committed by
Linus Torvalds
b1daec30 11532cc6

+6 -4
+6 -4
arch/i386/kernel/traps.c
··· 803 803 */ 804 804 cwd = get_fpu_cwd(task); 805 805 swd = get_fpu_swd(task); 806 - switch (((~cwd) & swd & 0x3f) | (swd & 0x240)) { 806 + switch (swd & ~cwd & 0x3f) { 807 807 case 0x000: 808 808 default: 809 809 break; 810 810 case 0x001: /* Invalid Op */ 811 - case 0x041: /* Stack Fault */ 812 - case 0x241: /* Stack Fault | Direction */ 811 + /* 812 + * swd & 0x240 == 0x040: Stack Underflow 813 + * swd & 0x240 == 0x240: Stack Overflow 814 + * User must clear the SF bit (0x40) if set 815 + */ 813 816 info.si_code = FPE_FLTINV; 814 - /* Should we clear the SF or let user space do it ???? */ 815 817 break; 816 818 case 0x002: /* Denormalize */ 817 819 case 0x010: /* Underflow */