* [PATCH 1/2] ARM: mm: DEBUG_RODATA makes no sense with XIP_KERNEL
@ 2016-02-16 16:03 ` Arnd Bergmann
0 siblings, 0 replies; 18+ messages in thread
From: Arnd Bergmann @ 2016-02-16 16:03 UTC (permalink / raw)
To: Russell King
Cc: linux-arm-kernel, Arnd Bergmann, Kees Cook, Laura Abbott,
Ard Biesheuvel, linux-kernel
When CONFIG_DEBUG_ALIGN_RODATA is set, we get a link error:
arch/arm/mm/built-in.o:(.data+0x4bc): undefined reference to `__start_rodata_section_aligned'
However, this combination is useless, as XIP_KERNEL implies that all the
RODATA is already marked readonly, so both CONFIG_DEBUG_RODATA and
CONFIG_DEBUG_ALIGN_RODATA (which depends on the other) are not
needed with XIP_KERNEL, and this patches enforces that using a Kconfig
dependency.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 25362dc496ed ("ARM: 8501/1: mm: flip priority of CONFIG_DEBUG_RODATA")
---
arch/arm/mm/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index fbf2296388ce..8894045caba9 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -1039,7 +1039,7 @@ config ARCH_SUPPORTS_BIG_ENDIAN
config DEBUG_RODATA
bool "Make kernel text and rodata read-only"
- depends on MMU
+ depends on MMU && !XIP_KERNEL
default y if CPU_V7
help
If this is set, kernel text and rodata memory will be made
--
2.7.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 1/2] ARM: mm: DEBUG_RODATA makes no sense with XIP_KERNEL
@ 2016-02-16 16:03 ` Arnd Bergmann
0 siblings, 0 replies; 18+ messages in thread
From: Arnd Bergmann @ 2016-02-16 16:03 UTC (permalink / raw)
To: linux-arm-kernel
When CONFIG_DEBUG_ALIGN_RODATA is set, we get a link error:
arch/arm/mm/built-in.o:(.data+0x4bc): undefined reference to `__start_rodata_section_aligned'
However, this combination is useless, as XIP_KERNEL implies that all the
RODATA is already marked readonly, so both CONFIG_DEBUG_RODATA and
CONFIG_DEBUG_ALIGN_RODATA (which depends on the other) are not
needed with XIP_KERNEL, and this patches enforces that using a Kconfig
dependency.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 25362dc496ed ("ARM: 8501/1: mm: flip priority of CONFIG_DEBUG_RODATA")
---
arch/arm/mm/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index fbf2296388ce..8894045caba9 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -1039,7 +1039,7 @@ config ARCH_SUPPORTS_BIG_ENDIAN
config DEBUG_RODATA
bool "Make kernel text and rodata read-only"
- depends on MMU
+ depends on MMU && !XIP_KERNEL
default y if CPU_V7
help
If this is set, kernel text and rodata memory will be made
--
2.7.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/2] ARM: mm: hide __start_rodata_section_aligned for non-debug builds
2016-02-16 16:03 ` Arnd Bergmann
@ 2016-02-16 16:03 ` Arnd Bergmann
-1 siblings, 0 replies; 18+ messages in thread
From: Arnd Bergmann @ 2016-02-16 16:03 UTC (permalink / raw)
To: Russell King
Cc: linux-arm-kernel, Arnd Bergmann, Kees Cook, Laura Abbott,
Ard Biesheuvel, Chris Brandt, linux-kernel
The __start_rodata_section_aligned is only referenced by the
DEBUG_RODATA code, which is only used when the MMU is enabled,
but the definition fails on !MMU builds:
arch/arm/kernel/vmlinux.lds:702: undefined symbol `SECTION_SHIFT' referenced in expression
This hides the symbol whenever DEBUG_RODATA is disabled.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 64ac2e74f0b2 ("ARM: 8502/1: mm: mark section-aligned portion of rodata NX")
---
arch/arm/kernel/vmlinux.lds.S | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 2d7085ae1c2f..bb12933aee22 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -322,12 +322,14 @@ SECTIONS
STABS_DEBUG
}
+#ifdef CONFIG_DEBUG_RODATA
/*
* Without CONFIG_DEBUG_ALIGN_RODATA, __start_rodata_section_aligned will
* be the first section-aligned location after __start_rodata. Otherwise,
* it will be equal to __start_rodata.
*/
__start_rodata_section_aligned = ALIGN(__start_rodata, 1 << SECTION_SHIFT);
+#endif
/*
* These must never be empty
--
2.7.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/2] ARM: mm: hide __start_rodata_section_aligned for non-debug builds
@ 2016-02-16 16:03 ` Arnd Bergmann
0 siblings, 0 replies; 18+ messages in thread
From: Arnd Bergmann @ 2016-02-16 16:03 UTC (permalink / raw)
To: linux-arm-kernel
The __start_rodata_section_aligned is only referenced by the
DEBUG_RODATA code, which is only used when the MMU is enabled,
but the definition fails on !MMU builds:
arch/arm/kernel/vmlinux.lds:702: undefined symbol `SECTION_SHIFT' referenced in expression
This hides the symbol whenever DEBUG_RODATA is disabled.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 64ac2e74f0b2 ("ARM: 8502/1: mm: mark section-aligned portion of rodata NX")
---
arch/arm/kernel/vmlinux.lds.S | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 2d7085ae1c2f..bb12933aee22 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -322,12 +322,14 @@ SECTIONS
STABS_DEBUG
}
+#ifdef CONFIG_DEBUG_RODATA
/*
* Without CONFIG_DEBUG_ALIGN_RODATA, __start_rodata_section_aligned will
* be the first section-aligned location after __start_rodata. Otherwise,
* it will be equal to __start_rodata.
*/
__start_rodata_section_aligned = ALIGN(__start_rodata, 1 << SECTION_SHIFT);
+#endif
/*
* These must never be empty
--
2.7.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 1/2] ARM: mm: DEBUG_RODATA makes no sense with XIP_KERNEL
2016-02-16 16:03 ` Arnd Bergmann
@ 2016-02-16 16:05 ` Ard Biesheuvel
-1 siblings, 0 replies; 18+ messages in thread
From: Ard Biesheuvel @ 2016-02-16 16:05 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Russell King, linux-arm-kernel, Kees Cook, Laura Abbott, linux-kernel
On 16 February 2016 at 17:03, Arnd Bergmann <arnd@arndb.de> wrote:
> When CONFIG_DEBUG_ALIGN_RODATA is set, we get a link error:
>
> arch/arm/mm/built-in.o:(.data+0x4bc): undefined reference to `__start_rodata_section_aligned'
>
> However, this combination is useless, as XIP_KERNEL implies that all the
> RODATA is already marked readonly, so both CONFIG_DEBUG_RODATA and
> CONFIG_DEBUG_ALIGN_RODATA (which depends on the other) are not
> needed with XIP_KERNEL, and this patches enforces that using a Kconfig
s/patches/patch/
> dependency.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Fixes: 25362dc496ed ("ARM: 8501/1: mm: flip priority of CONFIG_DEBUG_RODATA")
> ---
> arch/arm/mm/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
> index fbf2296388ce..8894045caba9 100644
> --- a/arch/arm/mm/Kconfig
> +++ b/arch/arm/mm/Kconfig
> @@ -1039,7 +1039,7 @@ config ARCH_SUPPORTS_BIG_ENDIAN
>
> config DEBUG_RODATA
> bool "Make kernel text and rodata read-only"
> - depends on MMU
> + depends on MMU && !XIP_KERNEL
> default y if CPU_V7
> help
> If this is set, kernel text and rodata memory will be made
> --
> 2.7.0
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/2] ARM: mm: DEBUG_RODATA makes no sense with XIP_KERNEL
@ 2016-02-16 16:05 ` Ard Biesheuvel
0 siblings, 0 replies; 18+ messages in thread
From: Ard Biesheuvel @ 2016-02-16 16:05 UTC (permalink / raw)
To: linux-arm-kernel
On 16 February 2016 at 17:03, Arnd Bergmann <arnd@arndb.de> wrote:
> When CONFIG_DEBUG_ALIGN_RODATA is set, we get a link error:
>
> arch/arm/mm/built-in.o:(.data+0x4bc): undefined reference to `__start_rodata_section_aligned'
>
> However, this combination is useless, as XIP_KERNEL implies that all the
> RODATA is already marked readonly, so both CONFIG_DEBUG_RODATA and
> CONFIG_DEBUG_ALIGN_RODATA (which depends on the other) are not
> needed with XIP_KERNEL, and this patches enforces that using a Kconfig
s/patches/patch/
> dependency.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Fixes: 25362dc496ed ("ARM: 8501/1: mm: flip priority of CONFIG_DEBUG_RODATA")
> ---
> arch/arm/mm/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
> index fbf2296388ce..8894045caba9 100644
> --- a/arch/arm/mm/Kconfig
> +++ b/arch/arm/mm/Kconfig
> @@ -1039,7 +1039,7 @@ config ARCH_SUPPORTS_BIG_ENDIAN
>
> config DEBUG_RODATA
> bool "Make kernel text and rodata read-only"
> - depends on MMU
> + depends on MMU && !XIP_KERNEL
> default y if CPU_V7
> help
> If this is set, kernel text and rodata memory will be made
> --
> 2.7.0
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/2] ARM: mm: hide __start_rodata_section_aligned for non-debug builds
2016-02-16 16:03 ` Arnd Bergmann
@ 2016-02-16 16:12 ` Ard Biesheuvel
-1 siblings, 0 replies; 18+ messages in thread
From: Ard Biesheuvel @ 2016-02-16 16:12 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Russell King, linux-arm-kernel, Kees Cook, Laura Abbott,
Chris Brandt, linux-kernel
On 16 February 2016 at 17:03, Arnd Bergmann <arnd@arndb.de> wrote:
> The __start_rodata_section_aligned is only referenced by the
> DEBUG_RODATA code, which is only used when the MMU is enabled,
> but the definition fails on !MMU builds:
>
> arch/arm/kernel/vmlinux.lds:702: undefined symbol `SECTION_SHIFT' referenced in expression
>
> This hides the symbol whenever DEBUG_RODATA is disabled.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 64ac2e74f0b2 ("ARM: 8502/1: mm: mark section-aligned portion of rodata NX")
> ---
> arch/arm/kernel/vmlinux.lds.S | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
> index 2d7085ae1c2f..bb12933aee22 100644
> --- a/arch/arm/kernel/vmlinux.lds.S
> +++ b/arch/arm/kernel/vmlinux.lds.S
> @@ -322,12 +322,14 @@ SECTIONS
> STABS_DEBUG
> }
>
> +#ifdef CONFIG_DEBUG_RODATA
> /*
> * Without CONFIG_DEBUG_ALIGN_RODATA, __start_rodata_section_aligned will
> * be the first section-aligned location after __start_rodata. Otherwise,
> * it will be equal to __start_rodata.
> */
> __start_rodata_section_aligned = ALIGN(__start_rodata, 1 << SECTION_SHIFT);
> +#endif
>
Does
PROVIDE(__start_rodata_section_aligned = xxx);
do the trick as well? If it does, it's a bit cleaner.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 2/2] ARM: mm: hide __start_rodata_section_aligned for non-debug builds
@ 2016-02-16 16:12 ` Ard Biesheuvel
0 siblings, 0 replies; 18+ messages in thread
From: Ard Biesheuvel @ 2016-02-16 16:12 UTC (permalink / raw)
To: linux-arm-kernel
On 16 February 2016 at 17:03, Arnd Bergmann <arnd@arndb.de> wrote:
> The __start_rodata_section_aligned is only referenced by the
> DEBUG_RODATA code, which is only used when the MMU is enabled,
> but the definition fails on !MMU builds:
>
> arch/arm/kernel/vmlinux.lds:702: undefined symbol `SECTION_SHIFT' referenced in expression
>
> This hides the symbol whenever DEBUG_RODATA is disabled.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 64ac2e74f0b2 ("ARM: 8502/1: mm: mark section-aligned portion of rodata NX")
> ---
> arch/arm/kernel/vmlinux.lds.S | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
> index 2d7085ae1c2f..bb12933aee22 100644
> --- a/arch/arm/kernel/vmlinux.lds.S
> +++ b/arch/arm/kernel/vmlinux.lds.S
> @@ -322,12 +322,14 @@ SECTIONS
> STABS_DEBUG
> }
>
> +#ifdef CONFIG_DEBUG_RODATA
> /*
> * Without CONFIG_DEBUG_ALIGN_RODATA, __start_rodata_section_aligned will
> * be the first section-aligned location after __start_rodata. Otherwise,
> * it will be equal to __start_rodata.
> */
> __start_rodata_section_aligned = ALIGN(__start_rodata, 1 << SECTION_SHIFT);
> +#endif
>
Does
PROVIDE(__start_rodata_section_aligned = xxx);
do the trick as well? If it does, it's a bit cleaner.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/2] ARM: mm: hide __start_rodata_section_aligned for non-debug builds
2016-02-16 16:12 ` Ard Biesheuvel
@ 2016-02-16 16:34 ` Arnd Bergmann
-1 siblings, 0 replies; 18+ messages in thread
From: Arnd Bergmann @ 2016-02-16 16:34 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Ard Biesheuvel, Russell King, Kees Cook, linux-kernel,
Chris Brandt, Laura Abbott
On Tuesday 16 February 2016 17:12:52 Ard Biesheuvel wrote:
> > +#ifdef CONFIG_DEBUG_RODATA
> > /*
> > * Without CONFIG_DEBUG_ALIGN_RODATA, __start_rodata_section_aligned will
> > * be the first section-aligned location after __start_rodata. Otherwise,
> > * it will be equal to __start_rodata.
> > */
> > __start_rodata_section_aligned = ALIGN(__start_rodata, 1 << SECTION_SHIFT);
> > +#endif
> >
>
> Does
>
> PROVIDE(__start_rodata_section_aligned = xxx);
>
> do the trick as well? If it does, it's a bit cleaner.
>
I would assume not, as the problem is that SECTION_SHIFT is a macro that
is not defined when the MMU is disabled.
Arnd
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 2/2] ARM: mm: hide __start_rodata_section_aligned for non-debug builds
@ 2016-02-16 16:34 ` Arnd Bergmann
0 siblings, 0 replies; 18+ messages in thread
From: Arnd Bergmann @ 2016-02-16 16:34 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 16 February 2016 17:12:52 Ard Biesheuvel wrote:
> > +#ifdef CONFIG_DEBUG_RODATA
> > /*
> > * Without CONFIG_DEBUG_ALIGN_RODATA, __start_rodata_section_aligned will
> > * be the first section-aligned location after __start_rodata. Otherwise,
> > * it will be equal to __start_rodata.
> > */
> > __start_rodata_section_aligned = ALIGN(__start_rodata, 1 << SECTION_SHIFT);
> > +#endif
> >
>
> Does
>
> PROVIDE(__start_rodata_section_aligned = xxx);
>
> do the trick as well? If it does, it's a bit cleaner.
>
I would assume not, as the problem is that SECTION_SHIFT is a macro that
is not defined when the MMU is disabled.
Arnd
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/2] ARM: mm: hide __start_rodata_section_aligned for non-debug builds
2016-02-16 16:34 ` Arnd Bergmann
@ 2016-02-16 16:36 ` Ard Biesheuvel
-1 siblings, 0 replies; 18+ messages in thread
From: Ard Biesheuvel @ 2016-02-16 16:36 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-arm-kernel, Russell King, Kees Cook, linux-kernel,
Chris Brandt, Laura Abbott
On 16 February 2016 at 17:34, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 16 February 2016 17:12:52 Ard Biesheuvel wrote:
>> > +#ifdef CONFIG_DEBUG_RODATA
>> > /*
>> > * Without CONFIG_DEBUG_ALIGN_RODATA, __start_rodata_section_aligned will
>> > * be the first section-aligned location after __start_rodata. Otherwise,
>> > * it will be equal to __start_rodata.
>> > */
>> > __start_rodata_section_aligned = ALIGN(__start_rodata, 1 << SECTION_SHIFT);
>> > +#endif
>> >
>>
>> Does
>>
>> PROVIDE(__start_rodata_section_aligned = xxx);
>>
>> do the trick as well? If it does, it's a bit cleaner.
>>
>
> I would assume not, as the problem is that SECTION_SHIFT is a macro that
> is not defined when the MMU is disabled.
>
I just tested it myself, and it in fact does work.
PROVIDE() means the expression is evaluated lazily, and SECTION_SHIFT
is just an undefined identifier in the linker script scope if the
preprocessor does not define it.
Anyway, I don't have a strong preference, so ack either way.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 2/2] ARM: mm: hide __start_rodata_section_aligned for non-debug builds
@ 2016-02-16 16:36 ` Ard Biesheuvel
0 siblings, 0 replies; 18+ messages in thread
From: Ard Biesheuvel @ 2016-02-16 16:36 UTC (permalink / raw)
To: linux-arm-kernel
On 16 February 2016 at 17:34, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 16 February 2016 17:12:52 Ard Biesheuvel wrote:
>> > +#ifdef CONFIG_DEBUG_RODATA
>> > /*
>> > * Without CONFIG_DEBUG_ALIGN_RODATA, __start_rodata_section_aligned will
>> > * be the first section-aligned location after __start_rodata. Otherwise,
>> > * it will be equal to __start_rodata.
>> > */
>> > __start_rodata_section_aligned = ALIGN(__start_rodata, 1 << SECTION_SHIFT);
>> > +#endif
>> >
>>
>> Does
>>
>> PROVIDE(__start_rodata_section_aligned = xxx);
>>
>> do the trick as well? If it does, it's a bit cleaner.
>>
>
> I would assume not, as the problem is that SECTION_SHIFT is a macro that
> is not defined when the MMU is disabled.
>
I just tested it myself, and it in fact does work.
PROVIDE() means the expression is evaluated lazily, and SECTION_SHIFT
is just an undefined identifier in the linker script scope if the
preprocessor does not define it.
Anyway, I don't have a strong preference, so ack either way.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/2] ARM: mm: DEBUG_RODATA makes no sense with XIP_KERNEL
2016-02-16 16:03 ` Arnd Bergmann
@ 2016-02-16 18:41 ` Kees Cook
-1 siblings, 0 replies; 18+ messages in thread
From: Kees Cook @ 2016-02-16 18:41 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Russell King, linux-arm-kernel, Laura Abbott, Ard Biesheuvel, LKML
On Tue, Feb 16, 2016 at 8:03 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> When CONFIG_DEBUG_ALIGN_RODATA is set, we get a link error:
>
> arch/arm/mm/built-in.o:(.data+0x4bc): undefined reference to `__start_rodata_section_aligned'
>
> However, this combination is useless, as XIP_KERNEL implies that all the
> RODATA is already marked readonly, so both CONFIG_DEBUG_RODATA and
> CONFIG_DEBUG_ALIGN_RODATA (which depends on the other) are not
> needed with XIP_KERNEL, and this patches enforces that using a Kconfig
> dependency.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 25362dc496ed ("ARM: 8501/1: mm: flip priority of CONFIG_DEBUG_RODATA")
Oh, hm, I didn't see this before sending my fix for the rodata start issue.
> ---
> arch/arm/mm/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
> index fbf2296388ce..8894045caba9 100644
> --- a/arch/arm/mm/Kconfig
> +++ b/arch/arm/mm/Kconfig
> @@ -1039,7 +1039,7 @@ config ARCH_SUPPORTS_BIG_ENDIAN
>
> config DEBUG_RODATA
> bool "Make kernel text and rodata read-only"
> - depends on MMU
> + depends on MMU && !XIP_KERNEL
If we do this, we need to probably clean up the xip linker script to
remove all the references to DEBUG_*RODATA too.
-Kees
> default y if CPU_V7
> help
> If this is set, kernel text and rodata memory will be made
> --
> 2.7.0
>
--
Kees Cook
Chrome OS & Brillo Security
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/2] ARM: mm: DEBUG_RODATA makes no sense with XIP_KERNEL
@ 2016-02-16 18:41 ` Kees Cook
0 siblings, 0 replies; 18+ messages in thread
From: Kees Cook @ 2016-02-16 18:41 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Feb 16, 2016 at 8:03 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> When CONFIG_DEBUG_ALIGN_RODATA is set, we get a link error:
>
> arch/arm/mm/built-in.o:(.data+0x4bc): undefined reference to `__start_rodata_section_aligned'
>
> However, this combination is useless, as XIP_KERNEL implies that all the
> RODATA is already marked readonly, so both CONFIG_DEBUG_RODATA and
> CONFIG_DEBUG_ALIGN_RODATA (which depends on the other) are not
> needed with XIP_KERNEL, and this patches enforces that using a Kconfig
> dependency.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 25362dc496ed ("ARM: 8501/1: mm: flip priority of CONFIG_DEBUG_RODATA")
Oh, hm, I didn't see this before sending my fix for the rodata start issue.
> ---
> arch/arm/mm/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
> index fbf2296388ce..8894045caba9 100644
> --- a/arch/arm/mm/Kconfig
> +++ b/arch/arm/mm/Kconfig
> @@ -1039,7 +1039,7 @@ config ARCH_SUPPORTS_BIG_ENDIAN
>
> config DEBUG_RODATA
> bool "Make kernel text and rodata read-only"
> - depends on MMU
> + depends on MMU && !XIP_KERNEL
If we do this, we need to probably clean up the xip linker script to
remove all the references to DEBUG_*RODATA too.
-Kees
> default y if CPU_V7
> help
> If this is set, kernel text and rodata memory will be made
> --
> 2.7.0
>
--
Kees Cook
Chrome OS & Brillo Security
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/2] ARM: mm: DEBUG_RODATA makes no sense with XIP_KERNEL
2016-02-16 16:03 ` Arnd Bergmann
@ 2016-02-16 20:31 ` Kees Cook
-1 siblings, 0 replies; 18+ messages in thread
From: Kees Cook @ 2016-02-16 20:31 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Russell King, linux-arm-kernel, Laura Abbott, Ard Biesheuvel, LKML
On Tue, Feb 16, 2016 at 8:03 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> When CONFIG_DEBUG_ALIGN_RODATA is set, we get a link error:
>
> arch/arm/mm/built-in.o:(.data+0x4bc): undefined reference to `__start_rodata_section_aligned'
>
> However, this combination is useless, as XIP_KERNEL implies that all the
> RODATA is already marked readonly, so both CONFIG_DEBUG_RODATA and
> CONFIG_DEBUG_ALIGN_RODATA (which depends on the other) are not
> needed with XIP_KERNEL, and this patches enforces that using a Kconfig
> dependency.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 25362dc496ed ("ARM: 8501/1: mm: flip priority of CONFIG_DEBUG_RODATA")
For this and the 2/2 patch:
Acked-by: Kees Cook <keescook@chromium.org>
I've sent follow-up to clean up the XIP linker script too, if you want
to take that as the 3rd patch in this series of fixes.
-Kees
> ---
> arch/arm/mm/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
> index fbf2296388ce..8894045caba9 100644
> --- a/arch/arm/mm/Kconfig
> +++ b/arch/arm/mm/Kconfig
> @@ -1039,7 +1039,7 @@ config ARCH_SUPPORTS_BIG_ENDIAN
>
> config DEBUG_RODATA
> bool "Make kernel text and rodata read-only"
> - depends on MMU
> + depends on MMU && !XIP_KERNEL
> default y if CPU_V7
> help
> If this is set, kernel text and rodata memory will be made
> --
> 2.7.0
>
--
Kees Cook
Chrome OS & Brillo Security
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/2] ARM: mm: DEBUG_RODATA makes no sense with XIP_KERNEL
@ 2016-02-16 20:31 ` Kees Cook
0 siblings, 0 replies; 18+ messages in thread
From: Kees Cook @ 2016-02-16 20:31 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Feb 16, 2016 at 8:03 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> When CONFIG_DEBUG_ALIGN_RODATA is set, we get a link error:
>
> arch/arm/mm/built-in.o:(.data+0x4bc): undefined reference to `__start_rodata_section_aligned'
>
> However, this combination is useless, as XIP_KERNEL implies that all the
> RODATA is already marked readonly, so both CONFIG_DEBUG_RODATA and
> CONFIG_DEBUG_ALIGN_RODATA (which depends on the other) are not
> needed with XIP_KERNEL, and this patches enforces that using a Kconfig
> dependency.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 25362dc496ed ("ARM: 8501/1: mm: flip priority of CONFIG_DEBUG_RODATA")
For this and the 2/2 patch:
Acked-by: Kees Cook <keescook@chromium.org>
I've sent follow-up to clean up the XIP linker script too, if you want
to take that as the 3rd patch in this series of fixes.
-Kees
> ---
> arch/arm/mm/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
> index fbf2296388ce..8894045caba9 100644
> --- a/arch/arm/mm/Kconfig
> +++ b/arch/arm/mm/Kconfig
> @@ -1039,7 +1039,7 @@ config ARCH_SUPPORTS_BIG_ENDIAN
>
> config DEBUG_RODATA
> bool "Make kernel text and rodata read-only"
> - depends on MMU
> + depends on MMU && !XIP_KERNEL
> default y if CPU_V7
> help
> If this is set, kernel text and rodata memory will be made
> --
> 2.7.0
>
--
Kees Cook
Chrome OS & Brillo Security
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/2] ARM: mm: DEBUG_RODATA makes no sense with XIP_KERNEL
2016-02-16 20:31 ` Kees Cook
@ 2016-02-16 23:12 ` Kees Cook
-1 siblings, 0 replies; 18+ messages in thread
From: Kees Cook @ 2016-02-16 23:12 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Russell King, linux-arm-kernel, Laura Abbott, Ard Biesheuvel, LKML
On Tue, Feb 16, 2016 at 12:31 PM, Kees Cook <keescook@chromium.org> wrote:
> On Tue, Feb 16, 2016 at 8:03 AM, Arnd Bergmann <arnd@arndb.de> wrote:
>> When CONFIG_DEBUG_ALIGN_RODATA is set, we get a link error:
>>
>> arch/arm/mm/built-in.o:(.data+0x4bc): undefined reference to `__start_rodata_section_aligned'
>>
>> However, this combination is useless, as XIP_KERNEL implies that all the
>> RODATA is already marked readonly, so both CONFIG_DEBUG_RODATA and
>> CONFIG_DEBUG_ALIGN_RODATA (which depends on the other) are not
>> needed with XIP_KERNEL, and this patches enforces that using a Kconfig
>> dependency.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> Fixes: 25362dc496ed ("ARM: 8501/1: mm: flip priority of CONFIG_DEBUG_RODATA")
>
> For this and the 2/2 patch:
>
> Acked-by: Kees Cook <keescook@chromium.org>
>
> I've sent follow-up to clean up the XIP linker script too, if you want
> to take that as the 3rd patch in this series of fixes.
Arnd, when you send your 2 patches to the tracker, can you also send
mine (so the ordering is correct)?
Thanks!
-Kees
--
Kees Cook
Chrome OS & Brillo Security
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/2] ARM: mm: DEBUG_RODATA makes no sense with XIP_KERNEL
@ 2016-02-16 23:12 ` Kees Cook
0 siblings, 0 replies; 18+ messages in thread
From: Kees Cook @ 2016-02-16 23:12 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Feb 16, 2016 at 12:31 PM, Kees Cook <keescook@chromium.org> wrote:
> On Tue, Feb 16, 2016 at 8:03 AM, Arnd Bergmann <arnd@arndb.de> wrote:
>> When CONFIG_DEBUG_ALIGN_RODATA is set, we get a link error:
>>
>> arch/arm/mm/built-in.o:(.data+0x4bc): undefined reference to `__start_rodata_section_aligned'
>>
>> However, this combination is useless, as XIP_KERNEL implies that all the
>> RODATA is already marked readonly, so both CONFIG_DEBUG_RODATA and
>> CONFIG_DEBUG_ALIGN_RODATA (which depends on the other) are not
>> needed with XIP_KERNEL, and this patches enforces that using a Kconfig
>> dependency.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> Fixes: 25362dc496ed ("ARM: 8501/1: mm: flip priority of CONFIG_DEBUG_RODATA")
>
> For this and the 2/2 patch:
>
> Acked-by: Kees Cook <keescook@chromium.org>
>
> I've sent follow-up to clean up the XIP linker script too, if you want
> to take that as the 3rd patch in this series of fixes.
Arnd, when you send your 2 patches to the tracker, can you also send
mine (so the ordering is correct)?
Thanks!
-Kees
--
Kees Cook
Chrome OS & Brillo Security
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2016-02-16 23:12 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-16 16:03 [PATCH 1/2] ARM: mm: DEBUG_RODATA makes no sense with XIP_KERNEL Arnd Bergmann
2016-02-16 16:03 ` Arnd Bergmann
2016-02-16 16:03 ` [PATCH 2/2] ARM: mm: hide __start_rodata_section_aligned for non-debug builds Arnd Bergmann
2016-02-16 16:03 ` Arnd Bergmann
2016-02-16 16:12 ` Ard Biesheuvel
2016-02-16 16:12 ` Ard Biesheuvel
2016-02-16 16:34 ` Arnd Bergmann
2016-02-16 16:34 ` Arnd Bergmann
2016-02-16 16:36 ` Ard Biesheuvel
2016-02-16 16:36 ` Ard Biesheuvel
2016-02-16 16:05 ` [PATCH 1/2] ARM: mm: DEBUG_RODATA makes no sense with XIP_KERNEL Ard Biesheuvel
2016-02-16 16:05 ` Ard Biesheuvel
2016-02-16 18:41 ` Kees Cook
2016-02-16 18:41 ` Kees Cook
2016-02-16 20:31 ` Kees Cook
2016-02-16 20:31 ` Kees Cook
2016-02-16 23:12 ` Kees Cook
2016-02-16 23:12 ` Kees Cook
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.