mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Sonic Zhang" <sonic.adi@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Check if start address is in vma region in NOMMU function get_user_pages().
Date: Thu, 31 Aug 2006 16:09:30 +0800	[thread overview]
Message-ID: <4e5ebad50608310109l489f39c0te466cfc3dbe3dc13@mail.gmail.com> (raw)

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>

--- linux-2.6.x/mm/nommu.c	2006-08-31 15:53:09.269952304 +0800
+++ linux-2.6.x/mm/nommu.c	2006-08-31 15:49:58.634933232 +0800
@@ -138,16 +138,20 @@
 	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);

                 reply	other threads:[~2006-08-31  8:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e5ebad50608310109l489f39c0te466cfc3dbe3dc13@mail.gmail.com \
    --to=sonic.adi@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®