Skip to content

Commit

Permalink
enable interrupts in user path of page fault.
Browse files Browse the repository at this point in the history
This is a minor fix, but what is currently there is essentially wrong.
In do_page_fault, if the faulting address from user code happens to be
in kernel address space (int *p = (int*)-1; p = 0xbed;)  then the
do_page_fault handler will jump over the local_irq_enable with the

  goto bad_area_nosemaphore;

But the first line there sees this is user code and goes through the
process of sending a signal to send SIGSEGV to the user task. This whole
time interrupts are disabled and the task can not be preempted by a
higher priority task.

This patch always enables interrupts in the user path of the
bad_area_nosemaphore.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Steven Rostedt authored and Linus Torvalds committed Jun 8, 2007
1 parent c52ecda commit e5e3c84
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/i386/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,11 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
bad_area_nosemaphore:
/* User mode accesses just cause a SIGSEGV */
if (error_code & 4) {
/*
* It's possible to have interrupts off here.
*/
local_irq_enable();

/*
* Valid to do another page fault here because this one came
* from user space.
Expand Down
6 changes: 6 additions & 0 deletions arch/x86_64/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,12 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
bad_area_nosemaphore:
/* User mode accesses just cause a SIGSEGV */
if (error_code & PF_USER) {

/*
* It's possible to have interrupts off here.
*/
local_irq_enable();

if (is_prefetch(regs, address, error_code))
return;

Expand Down

0 comments on commit e5e3c84

Please sign in to comment.