[IA64] honor notify_die() returning NOTIFY_STOP

This requires making die() and die_if_kernel() return a value, and their
callers to honor this (and be prepared that it returns).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>

authored by Jan Beulich and committed by Tony Luck 620de2f5 ef3c4cb9

+39 -22
+3 -2
arch/ia64/ia32/ia32_support.c
··· 27 28 #include "ia32priv.h" 29 30 - extern void die_if_kernel (char *str, struct pt_regs *regs, long err); 31 32 struct exec_domain ia32_exec_domain; 33 struct page *ia32_shared_page[NR_CPUS]; ··· 217 { 218 siginfo_t siginfo; 219 220 - die_if_kernel("Bad IA-32 interrupt", regs, int_num); 221 222 siginfo.si_signo = SIGTRAP; 223 siginfo.si_errno = int_num; /* XXX is it OK to abuse si_errno like this? */
··· 27 28 #include "ia32priv.h" 29 30 + extern int die_if_kernel (char *str, struct pt_regs *regs, long err); 31 32 struct exec_domain ia32_exec_domain; 33 struct page *ia32_shared_page[NR_CPUS]; ··· 217 { 218 siginfo_t siginfo; 219 220 + if (die_if_kernel("Bad IA-32 interrupt", regs, int_num)) 221 + return; 222 223 siginfo.si_signo = SIGTRAP; 224 siginfo.si_errno = int_num; /* XXX is it OK to abuse si_errno like this? */
+23 -12
arch/ia64/kernel/traps.c
··· 35 fpswa_interface = __va(ia64_boot_param->fpswa); 36 } 37 38 - void 39 die (const char *str, struct pt_regs *regs, long err) 40 { 41 static struct { ··· 62 if (++die.lock_owner_depth < 3) { 63 printk("%s[%d]: %s %ld [%d]\n", 64 current->comm, task_pid_nr(current), str, err, ++die_counter); 65 - (void) notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); 66 - show_regs(regs); 67 } else 68 printk(KERN_ERR "Recursive die() failure, output suppressed\n"); 69 ··· 75 add_taint(TAINT_DIE); 76 spin_unlock_irq(&die.lock); 77 78 if (panic_on_oops) 79 panic("Fatal exception"); 80 81 do_exit(SIGSEGV); 82 } 83 84 - void 85 die_if_kernel (char *str, struct pt_regs *regs, long err) 86 { 87 if (!user_mode(regs)) 88 - die(str, regs, err); 89 } 90 91 void ··· 110 if (notify_die(DIE_BREAK, "break 0", regs, break_num, TRAP_BRKPT, SIGTRAP) 111 == NOTIFY_STOP) 112 return; 113 - die_if_kernel("bugcheck!", regs, break_num); 114 sig = SIGILL; code = ILL_ILLOPC; 115 break; 116 ··· 164 break; 165 166 default: 167 - if (break_num < 0x40000 || break_num > 0x100000) 168 - die_if_kernel("Bad break", regs, break_num); 169 170 if (break_num < 0x80000) { 171 sig = SIGILL; code = __ILL_BREAK; ··· 412 #endif 413 414 sprintf(buf, "IA-64 Illegal operation fault"); 415 - die_if_kernel(buf, &regs, 0); 416 417 memset(&si, 0, sizeof(si)); 418 si.si_signo = SIGILL; 419 si.si_code = ILL_ILLOPC; 420 si.si_addr = (void __user *) (regs.cr_iip + ia64_psr(&regs)->ri); 421 force_sig_info(SIGILL, &si, current); 422 - rv.fkt = 0; 423 return rv; 424 } 425 ··· 655 sprintf(buf, "Fault %lu", vector); 656 break; 657 } 658 - die_if_kernel(buf, &regs, error); 659 - force_sig(SIGILL, current); 660 }
··· 35 fpswa_interface = __va(ia64_boot_param->fpswa); 36 } 37 38 + int 39 die (const char *str, struct pt_regs *regs, long err) 40 { 41 static struct { ··· 62 if (++die.lock_owner_depth < 3) { 63 printk("%s[%d]: %s %ld [%d]\n", 64 current->comm, task_pid_nr(current), str, err, ++die_counter); 65 + if (notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV) 66 + != NOTIFY_STOP) 67 + show_regs(regs); 68 + else 69 + regs = NULL; 70 } else 71 printk(KERN_ERR "Recursive die() failure, output suppressed\n"); 72 ··· 72 add_taint(TAINT_DIE); 73 spin_unlock_irq(&die.lock); 74 75 + if (!regs) 76 + return 1; 77 + 78 if (panic_on_oops) 79 panic("Fatal exception"); 80 81 do_exit(SIGSEGV); 82 + return 0; 83 } 84 85 + int 86 die_if_kernel (char *str, struct pt_regs *regs, long err) 87 { 88 if (!user_mode(regs)) 89 + return die(str, regs, err); 90 + return 0; 91 } 92 93 void ··· 102 if (notify_die(DIE_BREAK, "break 0", regs, break_num, TRAP_BRKPT, SIGTRAP) 103 == NOTIFY_STOP) 104 return; 105 + if (die_if_kernel("bugcheck!", regs, break_num)) 106 + return; 107 sig = SIGILL; code = ILL_ILLOPC; 108 break; 109 ··· 155 break; 156 157 default: 158 + if ((break_num < 0x40000 || break_num > 0x100000) 159 + && die_if_kernel("Bad break", regs, break_num)) 160 + return; 161 162 if (break_num < 0x80000) { 163 sig = SIGILL; code = __ILL_BREAK; ··· 402 #endif 403 404 sprintf(buf, "IA-64 Illegal operation fault"); 405 + rv.fkt = 0; 406 + if (die_if_kernel(buf, &regs, 0)) 407 + return rv; 408 409 memset(&si, 0, sizeof(si)); 410 si.si_signo = SIGILL; 411 si.si_code = ILL_ILLOPC; 412 si.si_addr = (void __user *) (regs.cr_iip + ia64_psr(&regs)->ri); 413 force_sig_info(SIGILL, &si, current); 414 return rv; 415 } 416 ··· 644 sprintf(buf, "Fault %lu", vector); 645 break; 646 } 647 + if (!die_if_kernel(buf, &regs, error)) 648 + force_sig(SIGILL, current); 649 }
+8 -5
arch/ia64/kernel/unaligned.c
··· 23 #include <asm/uaccess.h> 24 #include <asm/unaligned.h> 25 26 - extern void die_if_kernel(char *str, struct pt_regs *regs, long err); 27 28 #undef DEBUG_UNALIGNED_TRAP 29 ··· 675 */ 676 if (ld.x6_op == 1 || ld.x6_op == 3) { 677 printk(KERN_ERR "%s: register update on speculative load, error\n", __FUNCTION__); 678 - die_if_kernel("unaligned reference on speculative load with register update\n", 679 - regs, 30); 680 } 681 682 ··· 1318 1319 if (ia64_psr(regs)->be) { 1320 /* we don't support big-endian accesses */ 1321 - die_if_kernel("big-endian unaligned accesses are not supported", regs, 0); 1322 goto force_sigbus; 1323 } 1324 ··· 1536 ia64_handle_exception(regs, eh); 1537 goto done; 1538 } 1539 - die_if_kernel("error during unaligned kernel access\n", regs, ret); 1540 /* NOT_REACHED */ 1541 } 1542 force_sigbus:
··· 23 #include <asm/uaccess.h> 24 #include <asm/unaligned.h> 25 26 + extern int die_if_kernel(char *str, struct pt_regs *regs, long err); 27 28 #undef DEBUG_UNALIGNED_TRAP 29 ··· 675 */ 676 if (ld.x6_op == 1 || ld.x6_op == 3) { 677 printk(KERN_ERR "%s: register update on speculative load, error\n", __FUNCTION__); 678 + if (die_if_kernel("unaligned reference on speculative load with register update\n", 679 + regs, 30)) 680 + return; 681 } 682 683 ··· 1317 1318 if (ia64_psr(regs)->be) { 1319 /* we don't support big-endian accesses */ 1320 + if (die_if_kernel("big-endian unaligned accesses are not supported", regs, 0)) 1321 + return; 1322 goto force_sigbus; 1323 } 1324 ··· 1534 ia64_handle_exception(regs, eh); 1535 goto done; 1536 } 1537 + if (die_if_kernel("error during unaligned kernel access\n", regs, ret)) 1538 + return; 1539 /* NOT_REACHED */ 1540 } 1541 force_sigbus:
+5 -3
arch/ia64/mm/fault.c
··· 16 #include <asm/system.h> 17 #include <asm/uaccess.h> 18 19 - extern void die (char *, struct pt_regs *, long); 20 21 #ifdef CONFIG_KPROBES 22 static inline int notify_page_fault(struct pt_regs *regs, int trap) ··· 267 else 268 printk(KERN_ALERT "Unable to handle kernel paging request at " 269 "virtual address %016lx\n", address); 270 - die("Oops", regs, isr); 271 bust_spinlocks(0); 272 - do_exit(SIGKILL); 273 return; 274 275 out_of_memory:
··· 16 #include <asm/system.h> 17 #include <asm/uaccess.h> 18 19 + extern int die(char *, struct pt_regs *, long); 20 21 #ifdef CONFIG_KPROBES 22 static inline int notify_page_fault(struct pt_regs *regs, int trap) ··· 267 else 268 printk(KERN_ALERT "Unable to handle kernel paging request at " 269 "virtual address %016lx\n", address); 270 + if (die("Oops", regs, isr)) 271 + regs = NULL; 272 bust_spinlocks(0); 273 + if (regs) 274 + do_exit(SIGKILL); 275 return; 276 277 out_of_memory: