diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2010-05-17 04:00:21 -0400 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2010-05-17 04:00:17 -0400 |
commit | ab3c68ee5fd329ba48094d3417fd60e30ea14a87 (patch) | |
tree | e5c3daa56821c33ea80b6853b4f817193b22df99 /arch/s390/mm/fault.c | |
parent | 57b28f66316d287b9dbf7b28358ca90257230769 (diff) |
[S390] debug: enable exception-trace debug facility
The exception-trace facility on x86 and other architectures prints
traces to dmesg whenever a user space application crashes.
s390 has such a feature since ages however it is called
userprocess_debug and is enabled differently.
This patch makes sure that whenever one of the two procfs files
/proc/sys/kernel/userprocess_debug
/proc/sys/debug/exception-trace
is modified the contents of the second one changes as well.
That way we keep backwards compatibilty but also support the same
interface like other architectures do.
Besides that the output of the traces is improved since it will now
also contain the corresponding filename of the vma (when available)
where the process caused a fault or trap.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/mm/fault.c')
-rw-r--r-- | arch/s390/mm/fault.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 3040d7c78fe0..2505b2ea0ef1 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -48,10 +48,6 @@ | |||
48 | #define __PF_RES_FIELD 0x8000000000000000ULL | 48 | #define __PF_RES_FIELD 0x8000000000000000ULL |
49 | #endif /* CONFIG_64BIT */ | 49 | #endif /* CONFIG_64BIT */ |
50 | 50 | ||
51 | #ifdef CONFIG_SYSCTL | ||
52 | extern int sysctl_userprocess_debug; | ||
53 | #endif | ||
54 | |||
55 | #define VM_FAULT_BADCONTEXT 0x010000 | 51 | #define VM_FAULT_BADCONTEXT 0x010000 |
56 | #define VM_FAULT_BADMAP 0x020000 | 52 | #define VM_FAULT_BADMAP 0x020000 |
57 | #define VM_FAULT_BADACCESS 0x040000 | 53 | #define VM_FAULT_BADACCESS 0x040000 |
@@ -120,6 +116,22 @@ static inline int user_space_fault(unsigned long trans_exc_code) | |||
120 | return trans_exc_code != 3; | 116 | return trans_exc_code != 3; |
121 | } | 117 | } |
122 | 118 | ||
119 | static inline void report_user_fault(struct pt_regs *regs, long int_code, | ||
120 | int signr, unsigned long address) | ||
121 | { | ||
122 | if ((task_pid_nr(current) > 1) && !show_unhandled_signals) | ||
123 | return; | ||
124 | if (!unhandled_signal(current, signr)) | ||
125 | return; | ||
126 | if (!printk_ratelimit()) | ||
127 | return; | ||
128 | printk("User process fault: interruption code 0x%lX ", int_code); | ||
129 | print_vma_addr(KERN_CONT "in ", regs->psw.addr & PSW_ADDR_INSN); | ||
130 | printk("\n"); | ||
131 | printk("failing address: %lX\n", address); | ||
132 | show_regs(regs); | ||
133 | } | ||
134 | |||
123 | /* | 135 | /* |
124 | * Send SIGSEGV to task. This is an external routine | 136 | * Send SIGSEGV to task. This is an external routine |
125 | * to keep the stack usage of do_page_fault small. | 137 | * to keep the stack usage of do_page_fault small. |
@@ -133,17 +145,7 @@ static noinline void do_sigsegv(struct pt_regs *regs, long int_code, | |||
133 | address = trans_exc_code & __FAIL_ADDR_MASK; | 145 | address = trans_exc_code & __FAIL_ADDR_MASK; |
134 | current->thread.prot_addr = address; | 146 | current->thread.prot_addr = address; |
135 | current->thread.trap_no = int_code; | 147 | current->thread.trap_no = int_code; |
136 | #if defined(CONFIG_SYSCTL) || defined(CONFIG_PROCESS_DEBUG) | 148 | report_user_fault(regs, int_code, SIGSEGV, address); |
137 | #if defined(CONFIG_SYSCTL) | ||
138 | if (sysctl_userprocess_debug) | ||
139 | #endif | ||
140 | { | ||
141 | printk("User process fault: interruption code 0x%lX\n", | ||
142 | int_code); | ||
143 | printk("failing address: %lX\n", address); | ||
144 | show_regs(regs); | ||
145 | } | ||
146 | #endif | ||
147 | si.si_signo = SIGSEGV; | 149 | si.si_signo = SIGSEGV; |
148 | si.si_code = si_code; | 150 | si.si_code = si_code; |
149 | si.si_addr = (void __user *) address; | 151 | si.si_addr = (void __user *) address; |