Skip to content

Commit

Permalink
[PATCH] Check if start address is in vma region in NOMMU function get…
Browse files Browse the repository at this point in the history
…_user_pages()

In NOMMU arch, if run "cat /proc/self/mem", data from physical address 0
are read.  This behavior is different from MMU arch.  In IA32, message
"cat: /proc/self/mem: Input/output error" is reported.

This issue is rootcaused by not validate the start address in NOMMU
function get_user_pages().  Following patch solves this issue.

Signed-off-by: Sonic Zhang <sonic.adi@gmail.com>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Sonic Zhang authored and Linus Torvalds committed Sep 27, 2006
1 parent 0159b14 commit 910e46d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mm/nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,20 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
struct page **pages, struct vm_area_struct **vmas)
{
int i;
static struct vm_area_struct dummy_vma;
struct vm_area_struct *vma;

for (i = 0; i < len; i++) {
vma = find_vma(mm, start);
if(!vma)
return i ? : -EFAULT;

if (pages) {
pages[i] = virt_to_page(start);
if (pages[i])
page_cache_get(pages[i]);
}
if (vmas)
vmas[i] = &dummy_vma;
vmas[i] = vma;
start += PAGE_SIZE;
}
return(i);
Expand Down

0 comments on commit 910e46d

Please sign in to comment.