Commit 7ee1dd3f authored by David Howells's avatar David Howells Committed by Linus Torvalds

[PATCH] FRV: Make futex code compilable on nommu [try #2]

Make the futex code compilable and usable on NOMMU by making the attempt to
handle page faults conditional on CONFIG_MMU.  If this is not enabled, then
we can assume that EFAULT returned from futex_atomic_op_inuser() is not
recoverable, and that the address lies outside of valid memory.

handle_mm_fault() is made to BUG if called on NOMMU without attempting to
invoke the actual handler (__handle_mm_fault).
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5c40f7f3
...@@ -717,12 +717,28 @@ extern int vmtruncate(struct inode * inode, loff_t offset); ...@@ -717,12 +717,28 @@ extern int vmtruncate(struct inode * inode, loff_t offset);
extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end); extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end);
extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot); extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot);
extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot); extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot);
extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
static inline int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, int write_access) #ifdef CONFIG_MMU
extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma,
unsigned long address, int write_access);
static inline int handle_mm_fault(struct mm_struct *mm,
struct vm_area_struct *vma, unsigned long address,
int write_access)
{ {
return __handle_mm_fault(mm, vma, address, write_access) & (~VM_FAULT_WRITE); return __handle_mm_fault(mm, vma, address, write_access) &
(~VM_FAULT_WRITE);
} }
#else
static inline int handle_mm_fault(struct mm_struct *mm,
struct vm_area_struct *vma, unsigned long address,
int write_access)
{
/* should never happen if there's no MMU */
BUG();
return VM_FAULT_SIGBUS;
}
#endif
extern int make_pages_present(unsigned long addr, unsigned long end); extern int make_pages_present(unsigned long addr, unsigned long end);
extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
......
...@@ -356,6 +356,13 @@ static int futex_wake_op(unsigned long uaddr1, unsigned long uaddr2, int nr_wake ...@@ -356,6 +356,13 @@ static int futex_wake_op(unsigned long uaddr1, unsigned long uaddr2, int nr_wake
if (bh1 != bh2) if (bh1 != bh2)
spin_unlock(&bh2->lock); spin_unlock(&bh2->lock);
#ifndef CONFIG_MMU
/* we don't get EFAULT from MMU faults if we don't have an MMU,
* but we might get them from range checking */
ret = op_ret;
goto out;
#endif
if (unlikely(op_ret != -EFAULT)) { if (unlikely(op_ret != -EFAULT)) {
ret = op_ret; ret = op_ret;
goto out; goto out;
......
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