mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pstore: Use memcpy_toio instead of memcpy
@ 2014-11-13 18:09 Furquan Shaikh
  2014-11-13 18:10 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Furquan Shaikh @ 2014-11-13 18:09 UTC (permalink / raw)
  To: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
  Cc: linux-kernel, olofj, adurbin, Furquan Shaikh

persistent_ram_update uses vmap / iomap based on whether the buffer is in memory
region or reserved region. However, both map it as non-cacheable memory. For
armv8 specifically, non-cacheable mapping requests use a memory type that has to
be accessed aligned to the request size. memcpy() doesn't guarantee that.

Signed-off-by: Furquan Shaikh <furquan@google.com>
---
 fs/pstore/ram_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index 9d7b9a8..cfbc5e4 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -299,7 +299,7 @@ static void notrace persistent_ram_update(struct persistent_ram_zone *prz,
 	const void *s, unsigned int start, unsigned int count)
 {
 	struct persistent_ram_buffer *buffer = prz->buffer;
-	memcpy(buffer->data + start, s, count);
+	memcpy_toio(buffer->data + start, s, count);
 	persistent_ram_update_ecc(prz, start, count);
 }
 
-- 
2.1.0.rc2.206.gedb03e5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] pstore: Use memcpy_toio instead of memcpy
  2014-11-13 18:09 [PATCH] pstore: Use memcpy_toio instead of memcpy Furquan Shaikh
@ 2014-11-13 18:10 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2014-11-13 18:10 UTC (permalink / raw)
  To: Furquan Shaikh
  Cc: Anton Vorontsov, Colin Cross, Tony Luck, LKML, Olof Johansson,
	Aaron Durbin

On Thu, Nov 13, 2014 at 10:09 AM, Furquan Shaikh <furquan@google.com> wrote:
> persistent_ram_update uses vmap / iomap based on whether the buffer is in memory
> region or reserved region. However, both map it as non-cacheable memory. For
> armv8 specifically, non-cacheable mapping requests use a memory type that has to
> be accessed aligned to the request size. memcpy() doesn't guarantee that.
>
> Signed-off-by: Furquan Shaikh <furquan@google.com>
> ---
>  fs/pstore/ram_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
> index 9d7b9a8..cfbc5e4 100644
> --- a/fs/pstore/ram_core.c
> +++ b/fs/pstore/ram_core.c
> @@ -299,7 +299,7 @@ static void notrace persistent_ram_update(struct persistent_ram_zone *prz,
>         const void *s, unsigned int start, unsigned int count)
>  {
>         struct persistent_ram_buffer *buffer = prz->buffer;
> -       memcpy(buffer->data + start, s, count);
> +       memcpy_toio(buffer->data + start, s, count);
>         persistent_ram_update_ecc(prz, start, count);
>  }
>
> --
> 2.1.0.rc2.206.gedb03e5
>

Acked-by: Kees Cook <keescook@chromium.org>

Thanks!

-Kees

-- 
Kees Cook
Chrome OS Security

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-13 18:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-13 18:09 [PATCH] pstore: Use memcpy_toio instead of memcpy Furquan Shaikh
2014-11-13 18:10 ` Kees Cook

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®