Re: Strange interrupt behaviour

Michael O'Reilly (michael@metal.iinet.net.au)
15 Jul 1998 15:01:00 +0800


In 2.1.109-2, in i386/traps.c, there is:

void die(const char * str, struct pt_regs * regs, long err)
{
console_verbose();
spin_lock_irq(&die_lock);
printk("%s: %04lx\n", str, err & 0xffff);
show_registers(regs);
spin_unlock_irq(&die_lock);
do_exit(SIGSEGV);
}

static void die_if_kernel(const char * str, struct pt_regs * regs, long err)
{
if (!(regs->eflags & VM_MASK) && !(3 & regs->xcs))
die(str, regs, err);
}

which is almost certainly wrong somewhere. The problem here is that if
do_exit() does a page fault, then the whole thing loops back into die
== infinite recursive loop == kernel crash when the stack finally
overflows. (yes, I had this happen to me).

Looking at this, I thought that fixing it would be best done by
preventing die_if_kernel from being re-entrant, but that's hard to do
because there are cases where do_exit() won't actually return.

I then thought about doing something like...
static j, c;

if (j == jiffied && c == current) {
printk("Die would loop. exiting.\n");
return ;
}
j = jiffes;
c = current;

Which would in theory fix the problem, but it's pretty ugly.

Anyone know of a clean way to fix?

Michael.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html