[IA64] Remove getting break_num by decoding instruction

break.b always sets cr.iim to 0 and the current code tries to
get the break_num by decoding instruction. However, their
seems to be a race condition while reading the regs->cr_iip,
as on other cpu the break.b at regs->cr_iip might have been
replaced with the original instruction as a result of
unregister_kprobe() and hence decoding instruction to
obtain break_num will result in wrong value in this case.

Also includes changes to kprobes.c which now has to handle
break number zero.

Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>

authored by Keshavamurthy Anil S and committed by Tony Luck 5a94bcfd b77dae52

+1 -19
+1 -1
arch/ia64/kernel/kprobes.c
··· 740 switch(val) { 741 case DIE_BREAK: 742 /* err is break number from ia64_bad_break() */ 743 - if (args->err == 0x80200 || args->err == 0x80300) 744 if (pre_kprobes_handler(args)) 745 ret = NOTIFY_STOP; 746 break;
··· 740 switch(val) { 741 case DIE_BREAK: 742 /* err is break number from ia64_bad_break() */ 743 + if (args->err == 0x80200 || args->err == 0x80300 || args->err == 0) 744 if (pre_kprobes_handler(args)) 745 ret = NOTIFY_STOP; 746 break;
-18
arch/ia64/kernel/traps.c
··· 132 siginfo_t siginfo; 133 int sig, code; 134 135 - /* break.b always sets cr.iim to 0, which causes problems for 136 - * debuggers. Get the real break number from the original instruction, 137 - * but only for kernel code. User space break.b is left alone, to 138 - * preserve the existing behaviour. All break codings have the same 139 - * format, so there is no need to check the slot type. 140 - */ 141 - if (break_num == 0 && !user_mode(regs)) { 142 - struct ia64_psr *ipsr = ia64_psr(regs); 143 - unsigned long *bundle = (unsigned long *)regs->cr_iip; 144 - unsigned long slot; 145 - switch (ipsr->ri) { 146 - case 0: slot = (bundle[0] >> 5); break; 147 - case 1: slot = (bundle[0] >> 46) | (bundle[1] << 18); break; 148 - default: slot = (bundle[1] >> 23); break; 149 - } 150 - break_num = ((slot >> 36 & 1) << 20) | (slot >> 6 & 0xfffff); 151 - } 152 - 153 /* SIGILL, SIGFPE, SIGSEGV, and SIGBUS want these field initialized: */ 154 siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri); 155 siginfo.si_imm = break_num;
··· 132 siginfo_t siginfo; 133 int sig, code; 134 135 /* SIGILL, SIGFPE, SIGSEGV, and SIGBUS want these field initialized: */ 136 siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri); 137 siginfo.si_imm = break_num;