[parisc-linux-cvs] Patch to turn off printing of user faults

John Marvin jsm@udlkern.fc.hp.com
Fri, 25 May 2001 05:02:25 -0600 (MDT)


This patch is hopefully extremely low risk and very simple. It just
disables the printing of user land faults to the console (with a
fairly easy #define to turn it back on in kernel/traps.c and mm/fault.c).

This feature made sense while we were in debugging phase, but it should
be off by default for production use. We may turn it back on for
further development after we create the iso's for the next "release".

John

P.S. Note, I also removed a bogus comment regarding long pointer faults.

--- kernel/traps.c.old Tue May 22 05:35:40 2001
+++ kernel/traps.c     Fri May 25 04:41:30 2001
@@ -42,6 +42,9 @@
 #include <kdb/trap.h>		/* for I_BRK_INST */
 #endif /* CONFIG_KWDB */
 
+#undef PRINT_USER_FAULTS /* (turn this on if you want user faults to be */
+			 /*  dumped to the console via printk)          */
+
 
 void page_exception(void);
 
@@ -116,7 +119,7 @@ void
 die_if_kernel (char *str, struct pt_regs *regs, long err)
 {
 	if (user_mode(regs)) {
-#if 1
+#ifdef PRINT_USER_FAULTS
 		if (err == 0)
 			return; /* STFU */
 
@@ -169,12 +172,15 @@ void handle_break(unsigned iir, struct p
 
 	switch(iir) {
 	case 0x00:
-		/* show registers, halt */
+#ifdef PRINT_USER_FAULTS
 		cli();
 		printk("break 0,0: pid=%d command='%s'\n",
 		       current->pid, current->comm);
+#endif
 		die_if_kernel("Breakpoint", regs, 0);
+#ifdef PRINT_USER_FAULTS
 		show_regs(regs);
+#endif
 		si.si_code = TRAP_BRKPT;
 		si.si_addr = (void *) (regs->iaoq[0] & ~3);
 		si.si_signo = SIGTRAP;
@@ -210,9 +216,11 @@ void handle_break(unsigned iir, struct p
 
 	default:
 		set_eiem(0);
+#ifdef PRINT_USER_FAULTS
 		printk("break %#08x: pid=%d command='%s'\n",
 		       iir, current->pid, current->comm);
 		show_regs(regs);
+#endif
 		si.si_signo = SIGTRAP;
 		si.si_code = TRAP_BRKPT;
 		si.si_addr = (void *) (regs->iaoq[0] & ~3);
@@ -387,9 +395,11 @@ void handle_interruption(int code, struc
 
 	default:
 		if (user_mode(regs)) {
+#ifdef PRINT_USER_FAULTS
 			printk("\nhandle_interruption() pid=%d command='%s'\n",
 			    current->pid, current->comm);
 			show_regs(regs);
+#endif
 			/* SIGBUS, for lack of a better one. */
 			si.si_signo = SIGBUS;
 			si.si_code = BUS_OBJERR;
@@ -404,12 +414,14 @@ void handle_interruption(int code, struc
 
 	if (user_mode(regs)) {
 	    if (fault_space != regs->sr[7]) {
+#ifdef PRINT_USER_FAULTS
 		if (fault_space == 0)
 			printk("User Fault on Kernel Space ");
-		else /* this case should never happen, but whatever... */
+		else
 			printk("User Fault (long pointer) ");
 		printk("pid=%d command='%s'\n", current->pid, current->comm);
 		show_regs(regs);
+#endif
 		si.si_signo = SIGSEGV;
 		si.si_errno = 0;
 		si.si_code = SEGV_MAPERR;
--- mm/fault.c.old Fri May 25 04:36:23 2001
+++ mm/fault.c     Fri May 25 04:38:22 2001
@@ -18,6 +18,9 @@
 
 #include <asm/uaccess.h>
 
+#undef PRINT_USER_FAULTS /* (turn this on if you want user faults to be */
+			 /*  dumped to the console via printk)          */
+
 
 /* Defines for parisc_acctyp()	*/
 #define READ		0
@@ -209,6 +212,7 @@ bad_area:
 	if (user_mode(regs)) {
 		struct siginfo si;
 
+#ifdef PRINT_USER_FAULTS
 		printk("\ndo_page_fault() pid=%d command='%s' type=%d address=0x%08lx\n",
 		    tsk->pid, tsk->comm, code, address);
 		if (vma) {
@@ -216,6 +220,7 @@ bad_area:
 					vma->vm_start, vma->vm_end);
 		}
 		show_regs(regs);
+#endif
 		/* FIXME: actually we need to get the signo and code correct */
 		si.si_signo = SIGSEGV;
 		si.si_errno = 0;