i386: fix incorrect FP signal delivery
Quoted 1 line · Linus Torvalds
Wouldn't this simpler patch result in exactly the same behaviour?
I thought the extra code would be good documentation, but the comments
work just as well. This is a little clearer (hand edited patch:)
arch/i386/kernel/traps.c +6 -4
@@ -803,15 +803,17 @@ void math_error(void __user *eip)*/ cwd =get_fpu_cwd (task); swd =get_fpu_swd (task); -switch (((~cwd) & swd &0x3f ) | (swd &0x240 )) { +switch (swd & ~cwd &0x3f ) {case 0x000 :default :break ;case 0x001 :/* Invalid Op */ -case 0x041 :/* Stack Fault */ -case 0x241 :/* Stack Fault | Direction */ +/* +* swd & 0x240 == 0x040: Stack Underflow +* swd & 0x240 == 0x240: Stack Overflow +* User must clear the SF bit (0x40) if set +*/ info.si_code =FPE_FLTINV ; -/* Should we clear the SF or let user space do it ???? */ break ;case 0x002 :/* Denormalize */ case 0x010 :/* Underflow */
__
Chuck