Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH 3/4] NOMMU: Use copy_*_user_page() in access_process_vm()

0 views
Skip to first unread message

David Howells

unread,
Jan 6, 2010, 12:30:02 PM1/6/10
to
From: Jie Zhang <jie....@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....@analog.com>
Signed-off-by: Mike Frysinger <vap...@gentoo.org>
Signed-off-by: David Howells <dhow...@redhat.com>
Acked-by: David McCullough <david_mc...@mcafee.com>
Acked-by: Paul Mundt <let...@linux-sh.org>
Acked-by: Greg Ungerer <ge...@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 {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Paul Mundt

unread,
Jan 6, 2010, 12:30:03 PM1/6/10
to
On Wed, Jan 06, 2010 at 05:23:33PM +0000, David Howells wrote:
> From: Daisuke HATAYAMA <d.hat...@jp.fujitsu.com>
>
> Commit f6151dfea21496d43dbaba32cfcd9c9f404769bc causes ELF-FDPIC to break
> during building, so this patch fixes it together with a correction for the
> printk format.
>
> Signed-off-by: Daisuke HATAYAMA <d.hat...@jp.fujitsu.com>
> Reviewed-by: Masami Hiramatsu <mhir...@redhat.com>
> Acked-by: Paul Mundt <let...@linux-sh.org>
> Signed-off-by: David Howells <dhow...@redhat.com>

I already pushed this through my tree, so you can just ignore this one.

David Howells

unread,
Jan 6, 2010, 12:30:02 PM1/6/10
to
From: Daisuke HATAYAMA <d.hat...@jp.fujitsu.com>

Commit f6151dfea21496d43dbaba32cfcd9c9f404769bc causes ELF-FDPIC to break
during building, so this patch fixes it together with a correction for the
printk format.

Signed-off-by: Daisuke HATAYAMA <d.hat...@jp.fujitsu.com>
Reviewed-by: Masami Hiramatsu <mhir...@redhat.com>
Acked-by: Paul Mundt <let...@linux-sh.org>
Signed-off-by: David Howells <dhow...@redhat.com>

---

fs/binfmt_elf_fdpic.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index c57d9ce..384a19f 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -1809,8 +1809,8 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)

if (cprm->file->f_pos != offset) {
/* Sanity check */
- printk(KERN_WARNING
- "elf_core_dump: file->f_pos (%lld) != offset (%lld)\n",
+ printk(KERN_WARNING "elf_fdpic_core_dump:"
+ " cprm->file->f_pos (%lld) != offset (%lld)\n",
cprm->file->f_pos, offset);

Linus Torvalds

unread,
Jan 6, 2010, 1:50:02 PM1/6/10
to

On Wed, 6 Jan 2010, David Howells wrote:
>
> From: Daisuke HATAYAMA <d.hat...@jp.fujitsu.com>
>
> Commit f6151dfea21496d43dbaba32cfcd9c9f404769bc causes ELF-FDPIC to break
> during building, so this patch fixes it together with a correction for the
> printk format.

The comment doesn't match the patch. There's no build breakage fix (the
actual fix was already merged, and your patch reflects that), there's only
a printk format "fix" that is actually a de-provement because it splits
the string across multiple lines.

So a strong NAK to this patch.

Linus

David Howells

unread,
Jan 6, 2010, 7:20:02 PM1/6/10
to
Linus Torvalds <torv...@linux-foundation.org> wrote:

> So a strong NAK to this patch.

Okay, forget that one then. Can you take the others?

David

0 new messages