* [PATCH v2] ARM: mm: fix reporting of read-only PMD bits
@ 2014-02-12 22:43 Kees Cook
2014-03-13 18:38 ` Kees Cook
0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2014-02-12 22:43 UTC (permalink / raw)
To: linux-arm-kernel
On non-LPAE, read-only PMD bits are defined with the combination
"PMD_SECT_APX | PMD_SECT_AP_WRITE". Adjusted the bit masks to correctly
detect this.
Signed-off-by: Kees Cook <keescook@chromium.org>
---
v2:
- reorder bits, suggested by Olof Johansson.
---
arch/arm/mm/dump.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c
index 2b3a56414271..2b342177f5de 100644
--- a/arch/arm/mm/dump.c
+++ b/arch/arm/mm/dump.c
@@ -123,19 +123,19 @@ static const struct prot_bits section_bits[] = {
#ifndef CONFIG_ARM_LPAE
/* These are approximate */
{
- .mask = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
- .val = 0,
+ .mask = PMD_SECT_APX | PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
+ .val = PMD_SECT_APX | PMD_SECT_AP_WRITE,
.set = " ro",
}, {
- .mask = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
+ .mask = PMD_SECT_APX | PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
.val = PMD_SECT_AP_WRITE,
.set = " RW",
}, {
- .mask = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
+ .mask = PMD_SECT_APX | PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
.val = PMD_SECT_AP_READ,
.set = "USR ro",
}, {
- .mask = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
+ .mask = PMD_SECT_APX | PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
.val = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
.set = "USR RW",
#else
--
1.7.9.5
--
Kees Cook
Chrome OS Security
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH v2] ARM: mm: fix reporting of read-only PMD bits
2014-02-12 22:43 [PATCH v2] ARM: mm: fix reporting of read-only PMD bits Kees Cook
@ 2014-03-13 18:38 ` Kees Cook
0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2014-03-13 18:38 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Feb 12, 2014 at 2:43 PM, Kees Cook <keescook@chromium.org> wrote:
> On non-LPAE, read-only PMD bits are defined with the combination
> "PMD_SECT_APX | PMD_SECT_AP_WRITE". Adjusted the bit masks to correctly
> detect this.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> v2:
> - reorder bits, suggested by Olof Johansson.
> ---
> arch/arm/mm/dump.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c
> index 2b3a56414271..2b342177f5de 100644
> --- a/arch/arm/mm/dump.c
> +++ b/arch/arm/mm/dump.c
> @@ -123,19 +123,19 @@ static const struct prot_bits section_bits[] = {
> #ifndef CONFIG_ARM_LPAE
> /* These are approximate */
> {
> - .mask = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
> - .val = 0,
> + .mask = PMD_SECT_APX | PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
> + .val = PMD_SECT_APX | PMD_SECT_AP_WRITE,
> .set = " ro",
> }, {
As Russell pointed out, this won't be valid for pre-v6 CPUs. What's
the best config for handling this? I'd like something like
CONFIG_ARM_LPAE, but using the CPU_* stuff seems a bit sloppy:
#if !defined(CONFIG_ARM_CPU_V6) && !defined(CONFIG_ARM_CPU_V7)
...new masks...
#else
...old masks...
#endif
But that seems to be the only thing I can find. Is CPU_* good enough here?
-Kees
> - .mask = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
> + .mask = PMD_SECT_APX | PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
> .val = PMD_SECT_AP_WRITE,
> .set = " RW",
> }, {
> - .mask = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
> + .mask = PMD_SECT_APX | PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
> .val = PMD_SECT_AP_READ,
> .set = "USR ro",
> }, {
> - .mask = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
> + .mask = PMD_SECT_APX | PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
> .val = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
> .set = "USR RW",
> #else
> --
> 1.7.9.5
>
>
> --
> Kees Cook
> Chrome OS Security
--
Kees Cook
Chrome OS Security
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-13 18:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-12 22:43 [PATCH v2] ARM: mm: fix reporting of read-only PMD bits Kees Cook
2014-03-13 18:38 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox