16 #include <linux/sched.h>
19 #include <linux/kernel.h>
20 #include <linux/signal.h>
21 #include <linux/errno.h>
22 #include <linux/wait.h>
24 #include <linux/stddef.h>
25 #include <linux/personality.h>
27 #include <linux/ptrace.h>
28 #include <linux/elf.h>
32 #include <asm/processor.h>
33 #include <asm/ucontext.h>
34 #include <asm/sigframe.h>
35 #include <asm/syscalls.h>
67 for (i = 0; i <
sizeof(
struct pt_regs)/sizeof(long); ++
i)
120 for (i = 0; i <
sizeof(
struct pt_regs)/sizeof(long); ++
i)
143 if (on_sig_stack(sp) && !
likely(on_sig_stack(sp - frame_size)))
148 if (sas_ss_flags(sp) == 0)
158 return (
void __user *)
sp;
164 unsigned long restorer;
194 &frame->
uc.uc_stack.ss_sp);
196 &frame->
uc.uc_stack.ss_flags);
205 restorer = (
unsigned long) ka->
sa.sa_restorer;
214 regs->
pc = (
unsigned long) ka->
sa.sa_handler;
216 regs->
sp = (
unsigned long) frame;
218 regs->
regs[0] = (
unsigned long) usig;
220 regs->
regs[2] = (
unsigned long) &frame->
uc;
233 static void handle_signal(
unsigned long sig,
siginfo_t *info,
237 sigset_t *oldset = sigmask_to_save();
243 switch (regs->
regs[0]) {
269 ret = setup_rt_frame(sig, ka, info, oldset, regs);
297 handle_signal(signr, &info, &ka, regs);
304 switch (regs->
regs[0]) {
322 restore_saved_sigmask();
340 show_unhandled_signals =
val;
341 switch (show_unhandled_signals) {
352 pr_info(
"%s crash reports will be generated on the console\n", word);
355 __setup(
"crashinfo", crashinfo);
360 enum { region_size = 256, bytes_per_line = 16 };
362 int found_readable_mem = 0;
366 pr_err(
"Not dumping at address 0x%lx (kernel address)\n",
367 (
unsigned long)address);
372 (((
unsigned long)address & -bytes_per_line) - region_size/2);
375 for (i = 0; i < region_size;
376 addr += bytes_per_line, i += bytes_per_line) {
377 unsigned char buf[bytes_per_line];
381 if (!found_readable_mem) {
382 pr_err(
"Dumping memory around address 0x%lx:\n",
383 (
unsigned long)address);
384 found_readable_mem = 1;
387 for (k = 0; k < bytes_per_line; ++
k)
388 j +=
sprintf(&line[j],
" %02x", buf[k]);
391 if (!found_readable_mem)
392 pr_err(
"No readable memory around address 0x%lx\n",
393 (
unsigned long)address);
397 unsigned long address,
int sig)
401 if (show_unhandled_signals == 0)
405 if (!is_global_init(tsk)) {
407 tsk->
sighand->action[sig-1].sa.sa_handler;
413 if (show_unhandled_signals <= 1 && !printk_ratelimit())
418 tsk->
comm, task_pid_nr(tsk), type, address, regs->
pc, sig);
424 if (show_unhandled_signals > 1) {
430 pr_err(
"User crash: signal %d,"
431 " trap %ld, address 0x%lx\n",
437 pr_err(
"User crash: signal %d, trap %ld\n",