提交 910e46da 编写于 作者: S Sonic Zhang 提交者: Linus Torvalds

[PATCH] Check if start address is in vma region in NOMMU function get_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: NSonic Zhang <sonic.adi@gmail.com>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 0159b141
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册