Exemple #1
0
void segv_handler(int sig, struct uml_pt_regs *regs)
{
    struct faultinfo * fi = UPT_FAULTINFO(regs);

    if (UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)) {
        bad_segv(*fi, UPT_IP(regs));
        return;
    }
    segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs);
}
Exemple #2
0
void segv_handler(int sig, union uml_pt_regs *regs)
{
	int index, max;
        struct faultinfo * fi = UPT_FAULTINFO(regs);

        if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){
                bad_segv(*fi, UPT_IP(regs));
		return;
	}
	max = sizeof(segfault_record)/sizeof(segfault_record[0]);
	index = next_trap_index(max);

	nsegfaults++;
        segfault_record[index].address = FAULT_ADDRESS(*fi);
	segfault_record[index].pid = os_getpid();
        segfault_record[index].is_write = FAULT_WRITE(*fi);
	segfault_record[index].sp = UPT_SP(regs);
	segfault_record[index].is_user = UPT_IS_USER(regs);
        segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs);
}
Exemple #3
0
void relay_signal(int sig, struct uml_pt_regs *regs)
{
    if (!UPT_IS_USER(regs)) {
        if (sig == SIGBUS)
            printk(KERN_ERR "Bus error - the host /dev/shm or /tmp "
                   "mount likely just ran out of space\n");
        panic("Kernel mode signal %d", sig);
    }

    arch_examine_signal(sig, regs);

    current->thread.arch.faultinfo = *UPT_FAULTINFO(regs);
    force_sig(sig, current);
}
Exemple #4
0
static void send_sigtrap(struct task_struct *tsk, struct uml_pt_regs *regs,
		  int error_code)
{
	struct siginfo info;

	memset(&info, 0, sizeof(info));
	info.si_signo = SIGTRAP;
	info.si_code = TRAP_BRKPT;

	/* User-mode eip? */
	info.si_addr = UPT_IS_USER(regs) ? (void __user *) UPT_IP(regs) : NULL;

	/* Send us the fake SIGTRAP */
	force_sig_info(SIGTRAP, &info, tsk);
}
Exemple #5
0
void relay_signal(int sig, union uml_pt_regs *regs)
{
	if(arch_handle_signal(sig, regs))
		return;

	if(!UPT_IS_USER(regs)){
		if(sig == SIGBUS)
			printk("Bus error - the /dev/shm or /tmp mount likely "
			       "just ran out of space\n");
		panic("Kernel mode signal %d", sig);
	}

        current->thread.arch.faultinfo = *UPT_FAULTINFO(regs);
	force_sig(sig, current);
}
void relay_signal(int sig, struct siginfo *si, struct uml_pt_regs *regs)
{
	struct faultinfo *fi;
	struct siginfo clean_si;

	if (!UPT_IS_USER(regs)) {
		if (sig == SIGBUS)
			printk(KERN_ERR "Bus error - the host /dev/shm or /tmp "
			       "mount likely just ran out of space\n");
		panic("Kernel mode signal %d", sig);
	}

	arch_examine_signal(sig, regs);

	memset(&clean_si, 0, sizeof(clean_si));
	clean_si.si_signo = si->si_signo;
	clean_si.si_errno = si->si_errno;
	clean_si.si_code = si->si_code;
	switch (sig) {
	case SIGILL:
	case SIGFPE:
	case SIGSEGV:
	case SIGBUS:
	case SIGTRAP:
		fi = UPT_FAULTINFO(regs);
		clean_si.si_addr = (void __user *) FAULT_ADDRESS(*fi);
		current->thread.arch.faultinfo = *fi;
#ifdef __ARCH_SI_TRAPNO
		clean_si.si_trapno = si->si_trapno;
#endif
		break;
	default:
		printk(KERN_ERR "Attempted to relay unknown signal %d (si_code = %d)\n",
			sig, si->si_code);
	}

	force_sig_info(sig, &clean_si, current);
}