mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: torvalds@osdl.org, akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, uclinux-dev@uclinux.org,
	Jie Zhang <jie.zhang@analog.com>,
	Mike Frysinger <vapier@gentoo.org>,
	David Howells <dhowells@redhat.com>,
	David McCullough <david_mccullough@mcafee.com>,
	Paul Mundt <lethal@linux-sh.org>, Greg Ungerer <gerg@uclinux.org>
Subject: [PATCH 3/4] NOMMU: Use copy_*_user_page() in access_process_vm()
Date: Wed, 06 Jan 2010 17:23:28 +0000	[thread overview]
Message-ID: <20100106172328.25862.85664.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <20100106172317.25862.64950.stgit@warthog.procyon.org.uk>

From: Jie Zhang <jie.zhang@analog.com>

The MMU code uses the copy_*_user_page() variants in access_process_vm()
rather than copy_*_user() as the former includes an icache flush.  This is
important when doing things like setting software breakpoints with gdb.
So switch the NOMMU code over to do the same.

This patch makes the reasonable assumption that copy_from_user_page() won't
fail - which is probably fine, as we've checked the VMA from which we're
copying is usable, and the copy is not allowed to cross VMAs.  The one case
where it might go wrong is if the VMA is a device rather than RAM, and that
device returns an error which - in which case rubbish will be returned rather
than EIO.

Signed-off-by: Jie Zhang <jie.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: David McCullough <david_mccullough@mcafee.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Greg Ungerer <gerg@uclinux.org>
---

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


diff --git a/mm/nommu.c b/mm/nommu.c
index a8d1752..1777386 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1921,9 +1921,11 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
 
 		/* only read or write mappings where it is permitted */
 		if (write && vma->vm_flags & VM_MAYWRITE)
-			len -= copy_to_user((void *) addr, buf, len);
+			copy_to_user_page(vma, NULL, addr,
+					 (void *) addr, buf, len);
 		else if (!write && vma->vm_flags & VM_MAYREAD)
-			len -= copy_from_user(buf, (void *) addr, len);
+			copy_from_user_page(vma, NULL, addr,
+					    buf, (void *) addr, len);
 		else
 			len = 0;
 	} else {


  parent reply	other threads:[~2010-01-06 17:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-06 17:23 [PATCH 1/4] FDPIC: Respect PT_GNU_STACK exec protection markings when creating NOMMU stack David Howells
2010-01-06 17:23 ` [PATCH 2/4] NOMMU: Avoiding duplicate icache flushes of shared maps David Howells
2010-01-06 17:23 ` David Howells [this message]
2010-01-06 17:23 ` [PATCH 4/4] elf_fdpic_core_dump(): fix build break in 2.6.33-rc1 David Howells
2010-01-06 17:26   ` Paul Mundt
2010-01-06 18:45   ` Linus Torvalds
2010-01-07  0:12   ` David Howells
  -- strict thread matches above, loose matches on Subject: below --
2009-12-22 17:17 [PATCH 1/4] FDPIC: Respect PT_GNU_STACK exec protection markings when creating NOMMU stack David Howells
2009-12-22 17:17 ` [PATCH 3/4] NOMMU: Use copy_*_user_page() in access_process_vm() David Howells

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=20100106172328.25862.85664.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=david_mccullough@mcafee.com \
    --cc=gerg@uclinux.org \
    --cc=jie.zhang@analog.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=uclinux-dev@uclinux.org \
    --cc=vapier@gentoo.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®