Commit fea03cb4 authored by Paolo 'Blaisorblade' Giarrusso's avatar Paolo 'Blaisorblade' Giarrusso Committed by Linus Torvalds

[PATCH] uml: avoid fixing faults while atomic

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: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 12ebcd73
...@@ -40,6 +40,12 @@ int handle_page_fault(unsigned long address, unsigned long ip, ...@@ -40,6 +40,12 @@ int handle_page_fault(unsigned long address, unsigned long ip,
int err = -EFAULT; int err = -EFAULT;
*code_out = SEGV_MAPERR; *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); down_read(&mm->mmap_sem);
vma = find_vma(mm, address); vma = find_vma(mm, address);
if(!vma) if(!vma)
...@@ -90,6 +96,7 @@ survive: ...@@ -90,6 +96,7 @@ survive:
flush_tlb_page(vma, address); flush_tlb_page(vma, address);
out: out:
up_read(&mm->mmap_sem); up_read(&mm->mmap_sem);
out_nosemaphore:
return(err); return(err);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment