From: David Howells <dhowells@redhat.com>
To: torvalds@osdl.org, akpm@linux-foundation.org
Cc: dhowells@redhat.com, vapier@gentoo.org, lethal@linux-sh.org,
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 5/6] NOMMU: Use copy_*_user_page() in access_process_vm()
Date: Wed, 16 Dec 2009 23:56:19 +0000 [thread overview]
Message-ID: <20091216235619.4310.96799.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <20091216235558.4310.19365.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 db52886..1e1ecb2 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1896,9 +1896,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 {
next prev parent reply other threads:[~2009-12-16 23:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-16 23:55 [PATCH 1/6] NOMMU: Optimise away the {dac_,}mmap_min_addr tests David Howells
2009-12-16 23:56 ` [PATCH 2/6] NOMMU: Provide per-task stack usage through /proc for NOMMU David Howells
2009-12-17 7:21 ` Stefani Seibold
2009-12-16 23:56 ` [PATCH 3/6] FDPIC: Respect PT_GNU_STACK exec protection markings when creating NOMMU stack David Howells
2009-12-16 23:56 ` [PATCH 4/6] NOMMU: Avoiding duplicate icache flushes of shared maps David Howells
2009-12-16 23:56 ` David Howells [this message]
2009-12-16 23:56 ` [PATCH 6/6] NOMMU: ramfs: Drop unused local var 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=20091216235619.4310.96799.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®