Re: [kerneloops] regression in 2.6.27 wrt "lock_page" and the"hwclock" program

From: Linus Torvalds
Date: Sun Oct 05 2008 - 14:18:50 EST




On Sat, 4 Oct 2008, Andrew Morton wrote:
> > Pid: 9591, comm: hwclock Tainted: G W 2.6.27-0.372.rc8.fc10.i686 #1
> > [<c0427a53>] __might_sleep+0xd1/0xd6
> > [<c0479a8b>] lock_page+0x1a/0x34
> > [<c0479cfa>] find_lock_page+0x23/0x48
> > [<c047a215>] filemap_fault+0x9b/0x330
> > [<c0486493>] __do_fault+0x40/0x2e6
> > [<c0487d63>] handle_mm_fault+0x2ec/0x6d2
> > [<c06e8260>] do_page_fault+0x2e5/0x693
>
> Looks like `hwclock' disabled interrupts in userspace with sys_iopl()?

We probably should enable interrupts in the page fault code. We already do

#ifdef CONFIG_X86_32
/* It's safe to allow irq's after cr2 has been saved and the vmalloc
fault has been handled. */
if (regs->flags & (X86_EFLAGS_IF | X86_VM_MASK))
local_irq_enable();

/*
* 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)
goto bad_area_nosemaphore;
#endif
...

so we have code to do so, it's just that we don't do it if the page fault
happened in an interrupt. But that's for the _kernel_ having interrupts
disabled and us needing to fix up the vmalloc area lazily (do we ever even
do that any more.. I dunno).

So we could easily add a check for 'user_space_vm(regs)' instead of
checking the VM_MASK, and fix it that way. Hmm?

Linus
--
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/