Exemple #1
0
asmlinkage void do_reserved(struct pt_regs *regs)
{
	/*
	 * Game over - no way to handle this if it ever occurs.  Most probably
	 * caused by a new unknown cpu type or after another deadly
	 * hard/software error.
	 */
	die_if_kernel("do_reserved execution Exception", regs);
	show_regs(regs);
	panic("Caught reserved exception - should not happen.");
}
Exemple #2
0
dotraplinkage void do_page_fault(struct pt_regs *regs, long error_code)
{
	unsigned long address = read_cr2();

	__do_page_fault(regs, error_code, address);

	printk("BUG: unable to handle kernel paging request at %#lx\n", address);
	printk("CPU: %d PID: %u Comm: %s\n", smp_processor_id(), current->pid, current->comm);
	show_regs(regs);
	panic("panic at #PF");
}
Exemple #3
0
void ps2_be_board_handler(struct pt_regs *regs)
{
	u_int sr, paddr;

	sr = read_32bit_cp0_register(CP0_STATUS);
	paddr = read_32bit_cp0_register($23);			/* BadPAddr */
	force_sig(SIGBUS, current);
	show_regs(regs);
	printk("paddr : %08x\n", paddr);
	write_32bit_cp0_register(CP0_STATUS, sr & ~(1 << 12));  /* clear BM */
}
Exemple #4
0
asmlinkage void double_fault_c(struct pt_regs *fp)
{
    console_verbose();
    oops_in_progress = 1;
    printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n");
    dump_bfin_process(fp);
    dump_bfin_mem(fp);
    show_regs(fp);
    panic("Double Fault - unrecoverable event\n");

}
static void sysrq_handle_showallcpus(int key)
{
	if (!trigger_all_cpu_backtrace()) {
		struct pt_regs *regs = get_irq_regs();

		if (regs) {
			printk(KERN_INFO "CPU%d:\n", smp_processor_id());
			show_regs(regs);
		}
		schedule_work(&sysrq_showallcpus);
	}
}
Exemple #6
0
void die(const char *str, struct pt_regs *fp, long err)
{
	console_verbose();
	spin_lock_irq(&die_lock);
	printk(KERN_WARNING "Oops: %s, sig: %ld\n", str, err);
	show_regs(fp);
	spin_unlock_irq(&die_lock);
	/* do_exit() should take care of panic'ing from an interrupt
	 * context so we don't handle it here
	 */
	do_exit(err);
}
Exemple #7
0
/* we come to here via sys_nis_syscall so it can setup the regs argument */
asmlinkage unsigned long
c_sys_nis_syscall (struct pt_regs *regs)
{
	static int count = 0;
	
	if (count++ > 5) return -ENOSYS;
	printk ("%s[%d]: Unimplemented SPARC system call %d\n", current->comm, current->pid, (int)regs->u_regs[1]);
#ifdef DEBUG_UNIMP_SYSCALL	
	show_regs (regs);
#endif
	return -ENOSYS;
}
Exemple #8
0
void show_kernel_fault_diag(const char *str, struct pt_regs *regs,
			    unsigned long address)
{
	current->thread.fault_address = address;

	/* Caller and Callee regs */
	show_regs(regs);

	/* Show stack trace if this Fatality happened in kernel mode */
	if (!user_mode(regs))
		show_stacktrace(current, regs);
}
/* ======================================================================
 * Interpreter command to dump the registers.  Calls the CPU-specific
 * show registers routine.
 * ====================================================================== */
int do_bedbug_rdump (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
	/* -------------------------------------------------- */

	if (!bug_ctx.stopped) {
		printf ("Not at a breakpoint\n");
		return 1;
	}

	show_regs (bug_ctx.regs);
	return 0;
}				/* do_bedbug_rdump */
Exemple #10
0
void
StackOverflow(struct pt_regs *regs)
{
	printk(KERN_CRIT "Kernel stack overflow in process %p, r1=%lx\n",
	       current, regs->gpr[1]);
#if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
	debugger(regs);
#endif
	show_regs(regs);
	print_backtrace((unsigned long *)regs->gpr[1]);
	instruction_dump((unsigned long *)regs->nip);
	panic("kernel stack overflow");
}
Exemple #11
0
static int ip32_be_handler(struct pt_regs *regs, int is_fixup)
{
	int data = regs->cp0_cause & 4;

	if (is_fixup)
		return MIPS_BE_FIXUP;

	printk("Got %cbe at 0x%lx\n", data ? 'd' : 'i', regs->cp0_epc);
	show_regs(regs);
	dump_tlb_all();
	while(1);
	force_sig(SIGBUS, current);
}
void die_if_kernel(char *str, struct pt_regs *regs, long err)
{
	if (user_mode(regs)) {
#ifdef PRINT_USER_FAULTS
		if (err == 0)
			return; /* STFU */

		/* XXX for debugging only */
		printk(KERN_DEBUG "%s (pid %d): %s (code %ld)\n",
			current->comm, current->pid, str, err);
		show_regs(regs);
#endif
		return;
	}
	
	/* unlock the pdc lock if necessary */
	pdc_emergency_unlock();

	/* maybe the kernel hasn't booted very far yet and hasn't been able 
	 * to initialize the serial or STI console. In that case we should 
	 * re-enable the pdc console, so that the user will be able to 
	 * identify the problem. */
	if (!console_drivers)
		pdc_console_restart();
	
	printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n",
		current->comm, current->pid, str, err);
	show_regs(regs);

	/* Wot's wrong wif bein' racy? */
	if (current->thread.flags & PARISC_KERNEL_DEATH) {
		printk(KERN_CRIT "%s() recursion detected.\n", __FUNCTION__);
		sti();
		while (1);
	}

	current->thread.flags |= PARISC_KERNEL_DEATH;
	do_exit(SIGSEGV);
}
int handle_watch_interrupt(struct pt_regs *regs, int fault)
{
	/* Rewrite status register to clear set bits. */
	unsigned long status = pmc_get_overflow();
	pmc_ack_overflow(status);

	printk("Hit watchpoint somewhat before the following:\n");
	show_regs(regs);

	__insn_mtspr(SPR_PERF_COUNT_0, -1);

	return 0;
}
Exemple #14
0
/* Callback function for perf event subsystem */
static void watchdog_overflow_callback(struct perf_event *event,
		 struct perf_sample_data *data,
		 struct pt_regs *regs)
{
	/* Ensure the watchdog never gets throttled */
	event->hw.interrupts = 0;

	if (__this_cpu_read(watchdog_nmi_touch) == true) {
		__this_cpu_write(watchdog_nmi_touch, false);
		return;
	}

	/* check for a hardlockup
	 * This is done by making sure our timer interrupt
	 * is incrementing.  The timer interrupt should have
	 * fired multiple times before we overflow'd.  If it hasn't
	 * then this is a good indication the cpu is stuck
	 */
	if (is_hardlockup()) {
		int this_cpu = smp_processor_id();

		/* only print hardlockups once */
		if (__this_cpu_read(hard_watchdog_warn) == true)
			return;

		pr_emerg("Watchdog detected hard LOCKUP on cpu %d", this_cpu);
		print_modules();
		print_irqtrace_events(current);
		if (regs)
			show_regs(regs);
		else
			dump_stack();

		/*
		 * Perform all-CPU dump only once to avoid multiple hardlockups
		 * generating interleaving traces
		 */
		if (sysctl_hardlockup_all_cpu_backtrace &&
				!test_and_set_bit(0, &hardlockup_allcpu_dumped))
			trigger_allbutself_cpu_backtrace();

		if (hardlockup_panic)
			nmi_panic(regs, "Hard LOCKUP");

		__this_cpu_write(hard_watchdog_warn, true);
		return;
	}

	__this_cpu_write(hard_watchdog_warn, false);
	return;
}
void handle_break(unsigned iir, struct pt_regs *regs)
{
	struct siginfo si;

	switch(iir) {
	case 0x00:
#ifdef PRINT_USER_FAULTS
		printk(KERN_DEBUG "break 0,0: pid=%d command='%s'\n",
		       current->pid, current->comm);
#endif
		die_if_kernel("Breakpoint", regs, 0);
#ifdef PRINT_USER_FAULTS
		show_regs(regs);
#endif
		si.si_code = TRAP_BRKPT;
		si.si_addr = (void *) (regs->iaoq[0] & ~3);
		si.si_signo = SIGTRAP;
		force_sig_info(SIGTRAP, &si, current);
		break;

	case GDB_BREAK_INSN:
		die_if_kernel("Breakpoint", regs, 0);
		handle_gdb_break(regs, TRAP_BRKPT);
		break;

	default:
#ifdef PRINT_USER_FAULTS
		printk(KERN_DEBUG "break %#08x: pid=%d command='%s'\n",
		       iir, current->pid, current->comm);
		show_regs(regs);
#endif
		si.si_signo = SIGTRAP;
		si.si_code = TRAP_BRKPT;
		si.si_addr = (void *) (regs->iaoq[0] & ~3);
		force_sig_info(SIGTRAP, &si, current);
		return;
	}
}
Exemple #16
0
void
_exception(int signr, struct pt_regs *regs)
{
	if (!user_mode(regs))
	{
		show_regs(regs);
#if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
		debugger(regs);
#endif
		print_backtrace((unsigned long *)regs->gpr[1]);
		panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
	}
	force_sig(signr, current);
}
Exemple #17
0
asmlinkage int sunos_nosys(void)
{
	struct pt_regs *regs;

	regs = (struct pt_regs *) (current->saved_kernel_stack +
				   sizeof(struct reg_window));
	current->tss.sig_address = regs->pc;
	current->tss.sig_desc = regs->u_regs[UREG_G1];
	send_sig(SIGSYS, current, 1);
	printk("Process makes ni_syscall number %d, register dump:\n",
	       (int) regs->u_regs[UREG_G1]);
	show_regs(regs);
	return -ENOSYS;
}
Exemple #18
0
static inline void report_user_fault(struct pt_regs *regs, int signr)
{
    if ((task_pid_nr(current) > 1) && !show_unhandled_signals)
        return;
    if (!unhandled_signal(current, signr))
        return;
    if (!printk_ratelimit())
        return;
    printk("User process fault: interruption code %04x ilc:%d ",
           regs->int_code & 0xffff, regs->int_code >> 17);
    print_vma_addr("in ", regs->psw.addr & PSW_ADDR_INSN);
    printk("\n");
    show_regs(regs);
}
Exemple #19
0
void die(char *str, struct pt_regs *fp, int nr)
{
	console_verbose();
	pr_err("%s: %08x\n", str, nr);
	show_regs(fp);

	pr_err("Process %s (pid: %d, stackpage=%08lx)\n",
	       current->comm, current->pid, (PAGE_SIZE +
					     (unsigned long) current));

	dump_stack();
	while (1)
		;
}
Exemple #20
0
/* Unhandled exception handler */
asmlinkage void unhandled_exception(struct pt_regs *regs, int cause)
{
	unsigned long addr = RDCTL(CTL_BADADDR);

	cause /= 4;

	pr_emerg("Unhandled exception #%d in %s mode (badaddr=0x%08lx)\n",
			cause, user_mode(regs) ? "user" : "kernel", addr);

	regs->ea -= 4;
	show_regs(regs);

	pr_emerg("opcode: 0x%08lx\n", *(unsigned long *)(regs->ea));
}
static inline void report_user_fault(struct pt_regs *regs, long int_code,
				     int signr, unsigned long address)
{
	if ((task_pid_nr(current) > 1) && !show_unhandled_signals)
		return;
	if (!unhandled_signal(current, signr))
		return;
	if (!printk_ratelimit())
		return;
	printk("User process fault: interruption code 0x%lX ", int_code);
	print_vma_addr(KERN_CONT "in ", regs->psw.addr & PSW_ADDR_INSN);
	printk("\n");
	printk("failing address: %lX\n", address);
	show_regs(regs);
}
Exemple #22
0
void die_if_kernel(char *str, struct pt_regs *pregs)
{
	unsigned long pc;

	pc = pregs->pc;
	puts("");
	outhex32(pc);
	puts(" trapped to die_if_kernel");
	show_regs(pregs);
#if 0
	if(pregs->psr & PSR_SUPERVISOR)
		do_exit(SIGKILL);
	do_exit(SIGSEGV);
#endif
}
Exemple #23
0
int __die(const char *str, struct pt_regs *regs, long err)
{
#ifdef CONFIG_X86_32
	unsigned short ss;
	unsigned long sp;
#endif
	printk(KERN_DEFAULT
	       "%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter);
#ifdef CONFIG_PREEMPT
	printk("PREEMPT ");
#endif
#ifdef CONFIG_SMP
	printk("SMP ");
#endif
#ifdef CONFIG_DEBUG_PAGEALLOC
	printk("DEBUG_PAGEALLOC ");
#endif
#ifdef CONFIG_KASAN
	printk("KASAN");
#endif
	printk("\n");
	if (notify_die(DIE_OOPS, str, regs, err,
			current->thread.trap_nr, SIGSEGV) == NOTIFY_STOP)
		return 1;

	/* FIXME this should probably also need to print into buffer */
	print_modules();
	show_regs(regs);
#ifdef CONFIG_X86_32
	if (user_mode(regs)) {
		sp = regs->sp;
		ss = regs->ss & 0xffff;
	} else {
		sp = kernel_stack_pointer(regs);
		savesegment(ss, ss);
	}
	printk(KERN_EMERG "EIP: [<%08lx>] ", regs->ip);
	print_symbol("%s", regs->ip);
	printk(" SS:ESP %04x:%08lx\n", ss, sp);
#else
	/* Executive summary in case the oops scrolled away */
	printk(KERN_ALERT "RIP ");
	/* FIXME */
	printk_address(regs->ip);
	printk(" RSP <%016lx>\n", regs->sp);
#endif
	return 0;
}
Exemple #24
0
void sun4m_nmi(struct pt_regs *regs)
{
	unsigned long afsr, afar;

	printk("Aieee: sun4m NMI received!\n");
	/* XXX HyperSparc hack XXX */
	__asm__ __volatile__("mov 0x500, %%g1\n\t"
			     "lda [%%g1] 0x4, %0\n\t"
			     "mov 0x600, %%g1\n\t"
			     "lda [%%g1] 0x4, %1\n\t" :
			     "=r" (afsr), "=r" (afar));
	printk("afsr=%08lx afar=%08lx\n", afsr, afar);
	printk("you lose buddy boy...\n");
	show_regs(regs);
	prom_halt();
}
Exemple #25
0
void report_user_fault(struct pt_regs *regs, long signr, int is_mm_fault)
{
	if ((task_pid_nr(current) > 1) && !show_unhandled_signals)
		return;
	if (!unhandled_signal(current, signr))
		return;
	if (!printk_ratelimit())
		return;
	printk(KERN_ALERT "User process fault: interruption code %04x ilc:%d ",
	       regs->int_code & 0xffff, regs->int_code >> 17);
	print_vma_addr(KERN_CONT "in ", regs->psw.addr);
	printk(KERN_CONT "\n");
	if (is_mm_fault)
		dump_fault_info(regs);
	show_regs(regs);
}
static void pa7300lc_lpmc(int code, struct pt_regs *regs)
{
	u32 hpa;
	printk(KERN_WARNING "LPMC on CPU %d\n", smp_processor_id());

	show_regs(regs);

	hpa = cpu_hpa();
	printk(KERN_WARNING
		"MIOC_CONTROL %08x\n" "MIOC_STATUS  %08x\n"
		"MDERRADD     %08x\n" "DMAERR       %08x\n"
		"DIOERR       %08x\n" "HIDMAMEM     %08x\n",
		gsc_readl(hpa+MIOC_CONTROL), gsc_readl(hpa+MIOC_STATUS),
		gsc_readl(hpa+MDERRADD), gsc_readl(hpa+DMAERR),
		gsc_readl(hpa+DIOERR), gsc_readl(hpa+HIDMAMEM));
}
static inline void report_user_fault(struct pt_regs *regs, long signr)
{
	if ((task_pid_nr(current) > 1) && !show_unhandled_signals)
		return;
	if (!unhandled_signal(current, signr))
		return;
	if (!printk_ratelimit())
		return;
	printk(KERN_ALERT "User process fault: interruption code 0x%X ",
	       regs->int_code);
	print_vma_addr(KERN_CONT "in ", regs->psw.addr & PSW_ADDR_INSN);
	printk(KERN_CONT "\n");
	printk(KERN_ALERT "failing address: %lX\n",
	       regs->int_parm_long & __FAIL_ADDR_MASK);
	show_regs(regs);
}
Exemple #28
0
void
MachineCheckException(struct pt_regs *regs)
{
	if ( !user_mode(regs) )
	{
#ifdef CONFIG_MBX
		/* the mbx pci read routines can cause machine checks -- Cort */
		bad_page_fault(regs,regs->dar);
		return;
#endif /* CONFIG_MBX */
#if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
		if (debugger_fault_handler) {
			debugger_fault_handler(regs);
			return;
		}
#endif
		printk("Machine check in kernel mode.\n");
		printk("Caused by (from msr): ");
		printk("regs %p ",regs);
		switch( regs->msr & 0x0000F000)
		{
		case (1<<12) :
			printk("Machine check signal - probably due to mm fault\n"
				"with mmu off\n");
			break;
		case (1<<13) :
			printk("Transfer error ack signal\n");
			break;
		case (1<<14) :
			printk("Data parity signal\n");
			break;
		case (1<<15) :
			printk("Address parity signal\n");
			break;
		default:
			printk("Unknown values in msr\n");
		}
		show_regs(regs);
#if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
		debugger(regs);
#endif
		print_backtrace((unsigned long *)regs->gpr[1]);
		instruction_dump((unsigned long *)regs->nip);
		panic("machine check");
	}
	_exception(SIGSEGV, regs);	
}
Exemple #29
0
void trace_unhandled_signal(const char *type, struct pt_regs *regs,
			    unsigned long address, int sig)
{
	struct task_struct *tsk = current;

	if (show_unhandled_signals == 0)
		return;

	/* If the signal is handled, don't show it here. */
	if (!is_global_init(tsk)) {
		void __user *handler =
			tsk->sighand->action[sig-1].sa.sa_handler;
		if (handler != SIG_IGN && handler != SIG_DFL)
			return;
	}

	/* Rate-limit the one-line output, not the detailed output. */
	if (show_unhandled_signals <= 1 && !printk_ratelimit())
		return;

	printk("%s%s[%d]: %s at %lx pc "REGFMT" signal %d",
	       task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG,
	       tsk->comm, task_pid_nr(tsk), type, address, regs->pc, sig);

	print_vma_addr(KERN_CONT " in ", regs->pc);

	printk(KERN_CONT "\n");

	if (show_unhandled_signals > 1) {
		switch (sig) {
		case SIGILL:
		case SIGFPE:
		case SIGSEGV:
		case SIGBUS:
			pr_err("User crash: signal %d,"
			       " trap %ld, address 0x%lx\n",
			       sig, regs->faultnum, address);
			show_regs(regs);
			dump_mem((void __user *)address);
			break;
		default:
			pr_err("User crash: signal %d, trap %ld\n",
			       sig, regs->faultnum);
			break;
		}
	}
}
static void sysrq_handle_showallcpus(int key)
{
	/*
	 * Fall back to the workqueue based printing if the
	 * backtrace printing did not succeed or the
	 * architecture has no support for it:
	 */
	if (!trigger_all_cpu_backtrace()) {
		struct pt_regs *regs = get_irq_regs();

		if (regs) {
			printk(KERN_INFO "CPU%d:\n", smp_processor_id());
			show_regs(regs);
		}
		schedule_work(&sysrq_showallcpus);
	}
}