mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] Check if start address is in vma region in NOMMU function get_user_pages().
@ 2006-09-01 12:42 David Howells
  2006-09-01 12:42 ` [PATCH 2/2] NOMMU: Check VMA protections David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2006-09-01 12:42 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-kernel, uclinux-dev, dhowells

From: Sonic Zhang <sonic.adi@gmail.com>

Hi,

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.

Thanks

Sonic Zhang


Signed-off-by: Sonic Zhang <sonic.adi@gmail.com>
Signed-Off-By: David Howells <dhowells@redhat.com>
---

 mm/nommu.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index 3215f46..2fe3fe4 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -129,16 +129,20 @@ int get_user_pages(struct task_struct *t
 	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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-01 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-01 12:42 [PATCH 1/2] Check if start address is in vma region in NOMMU function get_user_pages() David Howells
2006-09-01 12:42 ` [PATCH 2/2] NOMMU: Check VMA protections David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®