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

From: Linus Torvalds (torvalds_at_osdl.org)
Date: 12/31/03

  • Next message: Andy Isaacson: "Re: [PATCH] 2.6.0 - Watchdog patches (BK consistency checks)"
    Date:	Wed, 31 Dec 2003 11:08:21 -0800 (PST)
    To: Srivatsa Vaddagiri <vatsa@in.ibm.com>
    
    

    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@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Andy Isaacson: "Re: [PATCH] 2.6.0 - Watchdog patches (BK consistency checks)"

    Relevant Pages

    • Re: [RFC] SPI core -- revisited
      ... >DMA to copy data from user to kernel space? ... >cause page faults which ensure that the user space pages are paged in ... where dev is actually an SPI device. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Linux 2.6.9-ac3
      ... If you're a Republican he's "wishy-washy", ... >>user space, but it would have to be in EVERY user application to be ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: out-of-line x86 "put_user()" implementation
      ... macro). ... Andrew - do you want to put it in -mm? ... - Write a simple value into user space. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Hyper-Threading Vulnerability
      ... > Is this flaw affects the current stable Linux kernels? ... This is not a kernel problem, but a user space problem. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: User mode drivers: part 1, interrupt handling (patch for 2.6.11)
      ... > user-mode PCI and other drivers. ... > handle interrupts from user space. ... > infrastructure for setting up DMA for PCI devices. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)