patch-2.4.15 linux/arch/alpha/kernel/traps.c

Next file: linux/arch/alpha/lib/dec_and_lock.c
Previous file: linux/arch/alpha/kernel/time.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.14/linux/arch/alpha/kernel/traps.c linux/arch/alpha/kernel/traps.c
@@ -20,6 +20,7 @@
 #include <asm/unaligned.h>
 #include <asm/sysinfo.h>
 #include <asm/hwrpb.h>
+#include <asm/mmu_context.h>
 
 #include "proto.h"
 
@@ -311,8 +312,22 @@
 			if (alpha_fp_emul(regs.pc-4))
 				return;
 		}
-		/* fallthrough as illegal instruction .. */
+		break;
+
 	      case 3: /* FEN fault */
+		/* Irritating users can call PAL_clrfen to disable the
+		   FPU for the process.  The kernel will then trap in
+		   do_switch_stack and undo_switch_stack when we try
+		   to save and restore the FP registers.
+
+		   Given that GCC by default generates code that uses the
+		   FP registers, PAL_clrfen is not useful except for DoS
+		   attacks.  So turn the bleeding FPU back on and be done
+		   with it.  */
+		current->thread.pal_flags |= 1;
+		__reload_thread(&current->thread);
+		return;
+
 	      case 5: /* illoc */
 	      default: /* unexpected instruction-fault type */
 		      ;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)