public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: jamie@shareable.org (Jamie Lokier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: Implement copy_to_user_page() for noMMU
Date: Tue, 30 Mar 2010 02:31:32 +0100	[thread overview]
Message-ID: <20100330013132.GA15598@shareable.org> (raw)
In-Reply-To: <20100329132457.1967.3394.stgit@e102109-lin.cambridge.arm.com>

Catalin Marinas wrote:
> +void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
> +		       unsigned long uaddr, void *dst, const void *src,
> +		       unsigned long len)
> +{
> +	memcpy(dst, src, len);
> +	if (vma->vm_flags & VM_EXEC)
> +		__cpuc_coherent_user_range(uaddr, uaddr + len);
> +}

Does that do the right thing with uaddr + len == 0?

Since this is debugging, it would be unfortunate if something was
mapped !VM_EXEC but executed anyway (because it works, or because of a
bug), and setting a breakpoint failed to be effective because of
entries in the i-cache.  It's forbidden semantically, and code which
wrote _itself_ to code without flushing i-cache on nommu gets what it
deserves.  But it may occur that it's executing, even if just due to
an application bug, and I'm thinking tracing under the debugger is one
time it's good to be more reliable.

Other variations such as writing when a mapping is !VM_EXEC and later
mapping or mprotecting the same shmem VM_EXEC, but it's even more
forbidden semantically to write to a read-only mapping (and just as
unchecked on nommu), and conversion of writable to VM_EXEC ought to
flush i-cache at mprotect time.

-- Jamie

  reply	other threads:[~2010-03-30  1:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-29 13:24 [PATCH] ARM: Implement copy_to_user_page() for noMMU Catalin Marinas
2010-03-30  1:31 ` Jamie Lokier [this message]
2010-03-30  7:29   ` Russell King - ARM Linux
2010-03-30  9:31     ` Catalin Marinas
2010-03-30 11:33       ` Jamie Lokier
2010-03-30  9:30   ` Catalin Marinas
2010-03-30 11:25     ` Jamie Lokier
2010-03-30 11:50       ` Catalin Marinas

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=20100330013132.GA15598@shareable.org \
    --to=jamie@shareable.org \
    --cc=linux-arm-kernel@lists.infradead.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