[IA64] Handle debug traps in fsys mode

We need to handle debug traps in fsys mode non-fatally. They can
happen now that we have fsyscalls which contain probe instructions.

Signed-off-by: Jason Uhlenkott <jasonuhl@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>

authored by Jason Uhlenkott and committed by Tony Luck 15029285 6d6e4200

+22 -8
+19 -7
arch/ia64/kernel/traps.c
··· 530 if (fsys_mode(current, &regs)) { 531 extern char __kernel_syscall_via_break[]; 532 /* 533 - * Got a trap in fsys-mode: Taken Branch Trap and Single Step trap 534 - * need special handling; Debug trap is not supposed to happen. 535 */ 536 if (unlikely(vector == 29)) { 537 - die("Got debug trap in fsys-mode---not supposed to happen!", 538 - &regs, 0); 539 return; 540 } 541 /* re-do the system call via break 0x100000: */ ··· 592 case 34: 593 if (isr & 0x2) { 594 /* Lower-Privilege Transfer Trap */ 595 /* 596 - * Just clear PSR.lp and then return immediately: all the 597 - * interesting work (e.g., signal delivery is done in the kernel 598 - * exit path). 599 */ 600 ia64_psr(&regs)->lp = 0; 601 return;
··· 530 if (fsys_mode(current, &regs)) { 531 extern char __kernel_syscall_via_break[]; 532 /* 533 + * Got a trap in fsys-mode: Taken Branch Trap 534 + * and Single Step trap need special handling; 535 + * Debug trap is ignored (we disable it here 536 + * and re-enable it in the lower-privilege trap). 537 */ 538 if (unlikely(vector == 29)) { 539 + set_thread_flag(TIF_DB_DISABLED); 540 + ia64_psr(&regs)->db = 0; 541 + ia64_psr(&regs)->lp = 1; 542 return; 543 } 544 /* re-do the system call via break 0x100000: */ ··· 589 case 34: 590 if (isr & 0x2) { 591 /* Lower-Privilege Transfer Trap */ 592 + 593 + /* If we disabled debug traps during an fsyscall, 594 + * re-enable them here. 595 + */ 596 + if (test_thread_flag(TIF_DB_DISABLED)) { 597 + clear_thread_flag(TIF_DB_DISABLED); 598 + ia64_psr(&regs)->db = 1; 599 + } 600 + 601 /* 602 + * Just clear PSR.lp and then return immediately: 603 + * all the interesting work (e.g., signal delivery) 604 + * is done in the kernel exit path. 605 */ 606 ia64_psr(&regs)->lp = 0; 607 return;
+3 -1
include/asm-ia64/thread_info.h
··· 93 #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 94 #define TIF_MEMDIE 17 95 #define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */ 96 97 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 98 #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) ··· 101 #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 102 #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 103 #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 104 - #define _TIF_SIGDELAYED (1 << TIF_SIGDELAYED) 105 #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 106 #define _TIF_MCA_INIT (1 << TIF_MCA_INIT) 107 108 /* "work to do on user-return" bits */ 109 #define TIF_ALLWORK_MASK (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SIGDELAYED)
··· 93 #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 94 #define TIF_MEMDIE 17 95 #define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */ 96 + #define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */ 97 98 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 99 #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) ··· 100 #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 101 #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 102 #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 103 + #define _TIF_SIGDELAYED (1 << TIF_SIGDELAYED) 104 #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 105 #define _TIF_MCA_INIT (1 << TIF_MCA_INIT) 106 + #define _TIF_DB_DISABLED (1 << TIF_DB_DISABLED) 107 108 /* "work to do on user-return" bits */ 109 #define TIF_ALLWORK_MASK (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SIGDELAYED)