* [PATCHv2 1/2] fs/pstore: Use memcpy_toio instead of memcpy
2016-02-15 8:19 [PATCHv2 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy Enric Balletbo i Serra
@ 2016-02-15 8:19 ` Enric Balletbo i Serra
2016-02-15 8:19 ` [PATCHv2 2/2] fs/pstore: Use memcpy_fromio() to save old ramoops buffer Enric Balletbo i Serra
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Enric Balletbo i Serra @ 2016-02-15 8:19 UTC (permalink / raw)
To: linux-kernel
Cc: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck,
Furquan Shaikh, Aaron Durbin, Olof Johansson, Andrew Bresticker,
Puneet Kumar, tomeu.vizoso, gustavo.padovan, emilio.lopez,
sjoerd.simons, Enric Balletbo Serra
From: Furquan Shaikh <furquan@google.com>
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>
Signed-off-by: Enric Balletbo Serra <enric.balletbo@collabora.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Acked-by: Kees Cook <keescook@chromium.org>
---
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 76c3f80..351164d 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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCHv2 2/2] fs/pstore: Use memcpy_fromio() to save old ramoops buffer
2016-02-15 8:19 [PATCHv2 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy Enric Balletbo i Serra
2016-02-15 8:19 ` [PATCHv2 1/2] fs/pstore: Use memcpy_toio " Enric Balletbo i Serra
@ 2016-02-15 8:19 ` Enric Balletbo i Serra
2016-02-17 22:54 ` [PATCHv2 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy Kees Cook
2016-09-08 20:35 ` Kees Cook
3 siblings, 0 replies; 9+ messages in thread
From: Enric Balletbo i Serra @ 2016-02-15 8:19 UTC (permalink / raw)
To: linux-kernel
Cc: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck,
Furquan Shaikh, Aaron Durbin, Olof Johansson, Andrew Bresticker,
Puneet Kumar, tomeu.vizoso, gustavo.padovan, emilio.lopez,
sjoerd.simons, Enric Balletbo Serra
From: Andrew Bresticker <abrestic@chromium.org>
The ramoops buffer may be mapped as either I/O memory or uncached
memory. On ARM64, this results in a device-type (strongly-ordered)
mapping. Since unnaligned accesses to device-type memory will
generate an alignment fault (regardless of whether or not strict
alignment checking is enabled), it is not safe to use memcpy().
memcpy_fromio() is guaranteed to only use aligned accesses, so use
that instead.
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Signed-off-by: Enric Balletbo Serra <enric.balletbo@collabora.com>
Reviewed-by: Puneet Kumar <puneetster@chromium.org>
Acked-by: Kees Cook <keescook@chromium.org>
---
fs/pstore/ram_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index 351164d..5308277 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -322,8 +322,8 @@ void persistent_ram_save_old(struct persistent_ram_zone *prz)
}
prz->old_log_size = size;
- memcpy(prz->old_log, &buffer->data[start], size - start);
- memcpy(prz->old_log + size - start, &buffer->data[0], start);
+ memcpy_fromio(prz->old_log, &buffer->data[start], size - start);
+ memcpy_fromio(prz->old_log + size - start, &buffer->data[0], start);
}
int notrace persistent_ram_write(struct persistent_ram_zone *prz,
--
2.1.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCHv2 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy.
2016-02-15 8:19 [PATCHv2 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy Enric Balletbo i Serra
2016-02-15 8:19 ` [PATCHv2 1/2] fs/pstore: Use memcpy_toio " Enric Balletbo i Serra
2016-02-15 8:19 ` [PATCHv2 2/2] fs/pstore: Use memcpy_fromio() to save old ramoops buffer Enric Balletbo i Serra
@ 2016-02-17 22:54 ` Kees Cook
2016-02-17 22:57 ` Luck, Tony
2016-09-08 20:35 ` Kees Cook
3 siblings, 1 reply; 9+ messages in thread
From: Kees Cook @ 2016-02-17 22:54 UTC (permalink / raw)
To: Tony Luck
Cc: Enric Balletbo i Serra, LKML, Anton Vorontsov, Colin Cross,
Furquan Shaikh, Aaron Durbin, Olof Johansson, Andrew Bresticker,
Puneet Kumar, Tomeu Vizoso, gustavo.padovan, emilio.lopez,
Sjoerd Simons
On Mon, Feb 15, 2016 at 12:19 AM, Enric Balletbo i Serra
<enric.balletbo@collabora.com> wrote:
> Dear all,
>
> These patches were needed in order to make ramoops work in my armv8 board. They
> originally come from chrome os kernel, so I kept the original authors. I found
> that weren't in mainline so I thought that will be really interesting send them.
>
> Best regards,
> Enric
>
> Changes since v1:
> - Added Acked-by: Kees Cook <keescook@chromium.org>
Tony, are you able to pull these?
-Kees
>
> Andrew Bresticker (1):
> fs/pstore: Use memcpy_fromio() to save old ramoops buffer
>
> Furquan Shaikh (1):
> fs/pstore: Use memcpy_toio instead of memcpy
>
> fs/pstore/ram_core.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> --
> 2.1.0
>
--
Kees Cook
Chrome OS & Brillo Security
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCHv2 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy.
2016-02-17 22:54 ` [PATCHv2 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy Kees Cook
@ 2016-02-17 22:57 ` Luck, Tony
2016-02-17 23:00 ` Kees Cook
0 siblings, 1 reply; 9+ messages in thread
From: Luck, Tony @ 2016-02-17 22:57 UTC (permalink / raw)
To: Kees Cook
Cc: Enric Balletbo i Serra, LKML, Anton Vorontsov, Colin Cross,
Furquan Shaikh, Aaron Durbin, Olof Johansson, Andrew Bresticker,
Puneet Kumar, Tomeu Vizoso, gustavo.padovan, emilio.lopez,
Sjoerd Simons
> Tony, are you able to pull these?
I've been distracted ... I need to dig into the pile of pending pstore patches.
Was there a consensus on the device tree ones? I saw a "you shouldn't do that",
and a "but it's really convenient and doesn't hurt anyone else" exchange.
-Tony
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy.
2016-02-17 22:57 ` Luck, Tony
@ 2016-02-17 23:00 ` Kees Cook
2016-02-29 8:04 ` Enric Balletbo i Serra
0 siblings, 1 reply; 9+ messages in thread
From: Kees Cook @ 2016-02-17 23:00 UTC (permalink / raw)
To: Luck, Tony
Cc: Enric Balletbo i Serra, LKML, Anton Vorontsov, Colin Cross,
Furquan Shaikh, Aaron Durbin, Olof Johansson, Andrew Bresticker,
Puneet Kumar, Tomeu Vizoso, gustavo.padovan, emilio.lopez,
Sjoerd Simons
On Wed, Feb 17, 2016 at 2:57 PM, Luck, Tony <tony.luck@intel.com> wrote:
>> Tony, are you able to pull these?
>
> I've been distracted ... I need to dig into the pile of pending pstore patches.
>
> Was there a consensus on the device tree ones? I saw a "you shouldn't do that",
> and a "but it's really convenient and doesn't hurt anyone else" exchange.
Honestly, I'm a bit unclear where the DT stuff stands... that thread
got long. :)
-Kees
--
Kees Cook
Chrome OS & Brillo Security
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy.
2016-02-17 23:00 ` Kees Cook
@ 2016-02-29 8:04 ` Enric Balletbo i Serra
2016-02-29 16:12 ` Olof Johansson
0 siblings, 1 reply; 9+ messages in thread
From: Enric Balletbo i Serra @ 2016-02-29 8:04 UTC (permalink / raw)
To: Kees Cook, Luck, Tony
Cc: LKML, Anton Vorontsov, Colin Cross, Furquan Shaikh, Aaron Durbin,
Olof Johansson, Andrew Bresticker, Puneet Kumar, Tomeu Vizoso,
gustavo.padovan, emilio.lopez, Sjoerd Simons
Hi all,
On 18/02/16 00:00, Kees Cook wrote:
> On Wed, Feb 17, 2016 at 2:57 PM, Luck, Tony <tony.luck@intel.com> wrote:
>>> Tony, are you able to pull these?
>>
>> I've been distracted ... I need to dig into the pile of pending pstore patches.
>>
>> Was there a consensus on the device tree ones? I saw a "you shouldn't do that",
>> and a "but it's really convenient and doesn't hurt anyone else" exchange.
>
> Honestly, I'm a bit unclear where the DT stuff stands... that thread
> got long. :)
>
> -Kees
>
There are more pstore related patches in these patch series, would be
good if you have a chance to look at these also, thanks.
https://lkml.org/lkml/2016/2/16/109
-Enric
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy.
2016-02-29 8:04 ` Enric Balletbo i Serra
@ 2016-02-29 16:12 ` Olof Johansson
0 siblings, 0 replies; 9+ messages in thread
From: Olof Johansson @ 2016-02-29 16:12 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: Kees Cook, Luck, Tony, LKML, Anton Vorontsov, Colin Cross,
Furquan Shaikh, Aaron Durbin, Olof Johansson, Andrew Bresticker,
Puneet Kumar, Tomeu Vizoso, gustavo.padovan, emilio.lopez,
Sjoerd Simons
[From the right account and in text format this time]
On Mon, Feb 29, 2016 at 12:04 AM, Enric Balletbo i Serra
<enric.balletbo@collabora.com> wrote:
> Hi all,
>
> On 18/02/16 00:00, Kees Cook wrote:
>>
>> On Wed, Feb 17, 2016 at 2:57 PM, Luck, Tony <tony.luck@intel.com> wrote:
>>>>
>>>> Tony, are you able to pull these?
>>>
>>>
>>> I've been distracted ... I need to dig into the pile of pending pstore
>>> patches.
>>>
>>> Was there a consensus on the device tree ones? I saw a "you shouldn't do
>>> that",
>>> and a "but it's really convenient and doesn't hurt anyone else" exchange.
>>
>>
>> Honestly, I'm a bit unclear where the DT stuff stands... that thread
>> got long. :)
>>
>> -Kees
>>
>
> There are more pstore related patches in these patch series, would be good
> if you have a chance to look at these also, thanks.
>
> https://lkml.org/lkml/2016/2/16/109
Yeah, those are platform/chrome patches that I'll look at and pick up this week.
-Olof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy.
2016-02-15 8:19 [PATCHv2 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy Enric Balletbo i Serra
` (2 preceding siblings ...)
2016-02-17 22:54 ` [PATCHv2 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy Kees Cook
@ 2016-09-08 20:35 ` Kees Cook
3 siblings, 0 replies; 9+ messages in thread
From: Kees Cook @ 2016-09-08 20:35 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: LKML, Anton Vorontsov, Colin Cross, Tony Luck, Furquan Shaikh,
Aaron Durbin, Olof Johansson, Andrew Bresticker, Puneet Kumar,
Tomeu Vizoso, gustavo.padovan, emilio.lopez, Sjoerd Simons
On Mon, Feb 15, 2016 at 12:19 AM, Enric Balletbo i Serra
<enric.balletbo@collabora.com> wrote:
> Dear all,
>
> These patches were needed in order to make ramoops work in my armv8 board. They
> originally come from chrome os kernel, so I kept the original authors. I found
> that weren't in mainline so I thought that will be really interesting send them.
>
> Best regards,
> Enric
>
> Changes since v1:
> - Added Acked-by: Kees Cook <keescook@chromium.org>
>
> Andrew Bresticker (1):
> fs/pstore: Use memcpy_fromio() to save old ramoops buffer
>
> Furquan Shaikh (1):
> fs/pstore: Use memcpy_toio instead of memcpy
>
> fs/pstore/ram_core.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Eek, these got missed when I took over pstore maintaintership. I've
pulled these for -next now. Thanks!
-Kees
--
Kees Cook
Nexus Security
^ permalink raw reply [flat|nested] 9+ messages in thread