Re: BUG in x86 do_page_fault? [was Re: in_atomic doesn't countlocal_irq_disable?]

From: Linus Torvalds
Date: Wed Dec 31 2003 - 14:10:09 EST




On Wed, 31 Dec 2003, Srivatsa Vaddagiri wrote:
>
> in_atomic() doesn't seem to return true
> in code sections where IRQ's have been disabled (using
> local_irq_disable).
>
> As a result, I think do_page_fault() on x86 needs to
> be updated to note this fact:

NO.

Please don't do this, it will result in some _really_ nasty problems with
X and other programs that potentially disable interrupts in user space.

Also, there are broken old drivers that potentially have interrupts
disabled, and we shouldn't just oops them. We should have a warning, but
we already do have that: that's what "might_sleep()" does.

So something like this may be appropriate at some point, but not in this
format. At the very least you absolutely _have_ to check for user mode
(possibly in the same place where we now have that

/* It's safe to allow irq's after cr2 has been saved */

comment).

Lnus

> --- fault.c.org Wed Dec 31 18:34:18 2003
> +++ fault.c Wed Dec 31 18:35:02 2003
> @@ -259,7 +259,7 @@
> * If we're in an interrupt, have no user context or are running in an
> * atomic region then we must not take the fault..
> */
> - if (in_atomic() || !mm)
> + if (in_atomic() || irqs_disabled() || !mm)
> goto bad_area_nosemaphore;
>
> down_read(&mm->mmap_sem);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/