* [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
@ 2021-10-08 16:58 ` Christophe Leroy
0 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2021-10-08 16:58 UTC (permalink / raw)
To: Kees Cook, Greg Kroah-Hartman
Cc: Christophe Leroy, linux-kernel, linuxppc-dev, stable,
Arnd Bergmann, Nick Desaulniers, Nathan Chancellor
On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA
test leads to "Illegal instruction" failure.
Looking at the content of rodata_objcopy.o, we see that the
function content zeroes only:
Disassembly of section .rodata:
0000000000000000 <.lkdtm_rodata_do_nothing>:
0: 00 00 00 00 .long 0x0
Add the contents flag in order to keep the content of the section
while renaming it.
Disassembly of section .rodata:
0000000000000000 <.lkdtm_rodata_do_nothing>:
0: 4e 80 00 20 blr
Fixes: e9e08a07385e ("lkdtm: support llvm-objcopy")
Cc: stable@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
drivers/misc/lkdtm/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile
index aa12097668d3..e2984ce51fe4 100644
--- a/drivers/misc/lkdtm/Makefile
+++ b/drivers/misc/lkdtm/Makefile
@@ -20,7 +20,7 @@ CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LTO)
OBJCOPYFLAGS :=
OBJCOPYFLAGS_rodata_objcopy.o := \
- --rename-section .noinstr.text=.rodata,alloc,readonly,load
+ --rename-section .noinstr.text=.rodata,alloc,readonly,load,contents
targets += rodata.o rodata_objcopy.o
$(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE
$(call if_changed,objcopy)
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
@ 2021-10-08 16:58 ` Christophe Leroy
0 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2021-10-08 16:58 UTC (permalink / raw)
To: Kees Cook, Greg Kroah-Hartman
Cc: Arnd Bergmann, Nick Desaulniers, linux-kernel, stable,
Nathan Chancellor, linuxppc-dev
On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA
test leads to "Illegal instruction" failure.
Looking at the content of rodata_objcopy.o, we see that the
function content zeroes only:
Disassembly of section .rodata:
0000000000000000 <.lkdtm_rodata_do_nothing>:
0: 00 00 00 00 .long 0x0
Add the contents flag in order to keep the content of the section
while renaming it.
Disassembly of section .rodata:
0000000000000000 <.lkdtm_rodata_do_nothing>:
0: 4e 80 00 20 blr
Fixes: e9e08a07385e ("lkdtm: support llvm-objcopy")
Cc: stable@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
drivers/misc/lkdtm/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile
index aa12097668d3..e2984ce51fe4 100644
--- a/drivers/misc/lkdtm/Makefile
+++ b/drivers/misc/lkdtm/Makefile
@@ -20,7 +20,7 @@ CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LTO)
OBJCOPYFLAGS :=
OBJCOPYFLAGS_rodata_objcopy.o := \
- --rename-section .noinstr.text=.rodata,alloc,readonly,load
+ --rename-section .noinstr.text=.rodata,alloc,readonly,load,contents
targets += rodata.o rodata_objcopy.o
$(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE
$(call if_changed,objcopy)
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
2021-10-08 16:58 ` Christophe Leroy
@ 2021-10-08 18:09 ` Nick Desaulniers
-1 siblings, 0 replies; 8+ messages in thread
From: Nick Desaulniers @ 2021-10-08 18:09 UTC (permalink / raw)
To: Christophe Leroy
Cc: Kees Cook, Arnd Bergmann, Greg Kroah-Hartman, linux-kernel,
stable, Nathan Chancellor, linuxppc-dev
On Fri, Oct 8, 2021 at 9:59 AM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
> On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA
> test leads to "Illegal instruction" failure.
>
> Looking at the content of rodata_objcopy.o, we see that the
> function content zeroes only:
>
> Disassembly of section .rodata:
>
> 0000000000000000 <.lkdtm_rodata_do_nothing>:
> 0: 00 00 00 00 .long 0x0
>
> Add the contents flag in order to keep the content of the section
> while renaming it.
>
> Disassembly of section .rodata:
>
> 0000000000000000 <.lkdtm_rodata_do_nothing>:
> 0: 4e 80 00 20 blr
>
> Fixes: e9e08a07385e ("lkdtm: support llvm-objcopy")
Thanks for the patch; sorry I broke this.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Cc: stable@vger.kernel.org
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Nick Desaulniers <ndesaulniers@google.com>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> drivers/misc/lkdtm/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile
> index aa12097668d3..e2984ce51fe4 100644
> --- a/drivers/misc/lkdtm/Makefile
> +++ b/drivers/misc/lkdtm/Makefile
> @@ -20,7 +20,7 @@ CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LTO)
>
> OBJCOPYFLAGS :=
> OBJCOPYFLAGS_rodata_objcopy.o := \
> - --rename-section .noinstr.text=.rodata,alloc,readonly,load
> + --rename-section .noinstr.text=.rodata,alloc,readonly,load,contents
> targets += rodata.o rodata_objcopy.o
> $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE
> $(call if_changed,objcopy)
> --
> 2.31.1
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
@ 2021-10-08 18:09 ` Nick Desaulniers
0 siblings, 0 replies; 8+ messages in thread
From: Nick Desaulniers @ 2021-10-08 18:09 UTC (permalink / raw)
To: Christophe Leroy
Cc: Kees Cook, Greg Kroah-Hartman, linux-kernel, linuxppc-dev,
stable, Arnd Bergmann, Nathan Chancellor
On Fri, Oct 8, 2021 at 9:59 AM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
> On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA
> test leads to "Illegal instruction" failure.
>
> Looking at the content of rodata_objcopy.o, we see that the
> function content zeroes only:
>
> Disassembly of section .rodata:
>
> 0000000000000000 <.lkdtm_rodata_do_nothing>:
> 0: 00 00 00 00 .long 0x0
>
> Add the contents flag in order to keep the content of the section
> while renaming it.
>
> Disassembly of section .rodata:
>
> 0000000000000000 <.lkdtm_rodata_do_nothing>:
> 0: 4e 80 00 20 blr
>
> Fixes: e9e08a07385e ("lkdtm: support llvm-objcopy")
Thanks for the patch; sorry I broke this.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Cc: stable@vger.kernel.org
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Nick Desaulniers <ndesaulniers@google.com>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> drivers/misc/lkdtm/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile
> index aa12097668d3..e2984ce51fe4 100644
> --- a/drivers/misc/lkdtm/Makefile
> +++ b/drivers/misc/lkdtm/Makefile
> @@ -20,7 +20,7 @@ CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LTO)
>
> OBJCOPYFLAGS :=
> OBJCOPYFLAGS_rodata_objcopy.o := \
> - --rename-section .noinstr.text=.rodata,alloc,readonly,load
> + --rename-section .noinstr.text=.rodata,alloc,readonly,load,contents
> targets += rodata.o rodata_objcopy.o
> $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE
> $(call if_changed,objcopy)
> --
> 2.31.1
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
2021-10-08 18:09 ` Nick Desaulniers
@ 2021-10-08 21:16 ` Kees Cook
-1 siblings, 0 replies; 8+ messages in thread
From: Kees Cook @ 2021-10-08 21:16 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Christophe Leroy, Greg Kroah-Hartman, linux-kernel, linuxppc-dev,
stable, Arnd Bergmann, Nathan Chancellor
On Fri, Oct 08, 2021 at 11:09:47AM -0700, Nick Desaulniers wrote:
> On Fri, Oct 8, 2021 at 9:59 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
> >
> > On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA
> > test leads to "Illegal instruction" failure.
> >
> > Looking at the content of rodata_objcopy.o, we see that the
> > function content zeroes only:
> >
> > Disassembly of section .rodata:
> >
> > 0000000000000000 <.lkdtm_rodata_do_nothing>:
> > 0: 00 00 00 00 .long 0x0
> >
> > Add the contents flag in order to keep the content of the section
> > while renaming it.
> >
> > Disassembly of section .rodata:
> >
> > 0000000000000000 <.lkdtm_rodata_do_nothing>:
> > 0: 4e 80 00 20 blr
> >
> > Fixes: e9e08a07385e ("lkdtm: support llvm-objcopy")
>
> Thanks for the patch; sorry I broke this.
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Hah! Whoops; sorry I don't have an inverted version of this test! I
should have caught this when it broke. :|
-Kees
--
Kees Cook
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
@ 2021-10-08 21:16 ` Kees Cook
0 siblings, 0 replies; 8+ messages in thread
From: Kees Cook @ 2021-10-08 21:16 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-kernel, stable,
Nathan Chancellor, linuxppc-dev
On Fri, Oct 08, 2021 at 11:09:47AM -0700, Nick Desaulniers wrote:
> On Fri, Oct 8, 2021 at 9:59 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
> >
> > On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA
> > test leads to "Illegal instruction" failure.
> >
> > Looking at the content of rodata_objcopy.o, we see that the
> > function content zeroes only:
> >
> > Disassembly of section .rodata:
> >
> > 0000000000000000 <.lkdtm_rodata_do_nothing>:
> > 0: 00 00 00 00 .long 0x0
> >
> > Add the contents flag in order to keep the content of the section
> > while renaming it.
> >
> > Disassembly of section .rodata:
> >
> > 0000000000000000 <.lkdtm_rodata_do_nothing>:
> > 0: 4e 80 00 20 blr
> >
> > Fixes: e9e08a07385e ("lkdtm: support llvm-objcopy")
>
> Thanks for the patch; sorry I broke this.
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Hah! Whoops; sorry I don't have an inverted version of this test! I
should have caught this when it broke. :|
-Kees
--
Kees Cook
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
2021-10-08 16:58 ` Christophe Leroy
@ 2021-10-08 21:17 ` Kees Cook
-1 siblings, 0 replies; 8+ messages in thread
From: Kees Cook @ 2021-10-08 21:17 UTC (permalink / raw)
To: Greg Kroah-Hartman, Christophe Leroy
Cc: Kees Cook, linux-kernel, Nick Desaulniers, Nathan Chancellor,
stable, Arnd Bergmann, linuxppc-dev
On Fri, 8 Oct 2021 18:58:40 +0200, Christophe Leroy wrote:
> On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA
> test leads to "Illegal instruction" failure.
>
> Looking at the content of rodata_objcopy.o, we see that the
> function content zeroes only:
>
> Disassembly of section .rodata:
>
> [...]
Applied to for-next/lkdtm, thanks!
[1/1] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
https://git.kernel.org/kees/c/19c3069c5f5f
Also, can you take a moment and get "patatt" set up[1] for signing your
patches? I would appreciate that since b4 yells at me when patches aren't
signed. :)
-Kees
[1] https://github.com/mricon/patatt
--
Kees Cook
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
@ 2021-10-08 21:17 ` Kees Cook
0 siblings, 0 replies; 8+ messages in thread
From: Kees Cook @ 2021-10-08 21:17 UTC (permalink / raw)
To: Greg Kroah-Hartman, Christophe Leroy
Cc: Kees Cook, Arnd Bergmann, Nick Desaulniers, linux-kernel, stable,
Nathan Chancellor, linuxppc-dev
On Fri, 8 Oct 2021 18:58:40 +0200, Christophe Leroy wrote:
> On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA
> test leads to "Illegal instruction" failure.
>
> Looking at the content of rodata_objcopy.o, we see that the
> function content zeroes only:
>
> Disassembly of section .rodata:
>
> [...]
Applied to for-next/lkdtm, thanks!
[1/1] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
https://git.kernel.org/kees/c/19c3069c5f5f
Also, can you take a moment and get "patatt" set up[1] for signing your
patches? I would appreciate that since b4 yells at me when patches aren't
signed. :)
-Kees
[1] https://github.com/mricon/patatt
--
Kees Cook
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-10-08 21:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-08 16:58 [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing() Christophe Leroy
2021-10-08 16:58 ` Christophe Leroy
2021-10-08 18:09 ` Nick Desaulniers
2021-10-08 18:09 ` Nick Desaulniers
2021-10-08 21:16 ` Kees Cook
2021-10-08 21:16 ` Kees Cook
2021-10-08 21:17 ` Kees Cook
2021-10-08 21:17 ` 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.