Skip to content

Commit

Permalink
[PATCH] uml: avoid fixing faults while atomic
Browse files Browse the repository at this point in the history
Following i386, we should maybe refuse trying to fault in pages when we're
doing atomic operations, because to handle the fault we could need to take
already taken spinlocks.

Also, if we're doing an atomic operation (in the sense of in_atomic()) we're
surely in kernel mode and we're surely going to handle adequately the failed
fault, so it's safe to behave this way.

Currently, on UML SMP is rarely used, and we don't support PREEMPT, so this is
unlikely to create problems right now, but it might in the future.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Paolo 'Blaisorblade' Giarrusso authored and Linus Torvalds committed Sep 23, 2005
1 parent 12ebcd7 commit fea03cb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/um/kernel/trap_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ int handle_page_fault(unsigned long address, unsigned long ip,
int err = -EFAULT;

*code_out = SEGV_MAPERR;

/* If the fault was during atomic operation, don't take the fault, just
* fail. */
if (in_atomic())
goto out_nosemaphore;

down_read(&mm->mmap_sem);
vma = find_vma(mm, address);
if(!vma)
Expand Down Expand Up @@ -90,6 +96,7 @@ int handle_page_fault(unsigned long address, unsigned long ip,
flush_tlb_page(vma, address);
out:
up_read(&mm->mmap_sem);
out_nosemaphore:
return(err);

/*
Expand Down

0 comments on commit fea03cb

Please sign in to comment.