All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [Rebased for 4.14] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
@ 2022-01-30  9:55 Christophe Leroy
  2022-01-30 12:53 ` gregkh
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2022-01-30  9:55 UTC (permalink / raw)
  To: gregkh, stable
  Cc: Christophe Leroy, linux-kernel, Kees Cook, Arnd Bergmann,
	Nick Desaulniers, Nathan Chancellor

This is backport for 4.14

(cherry picked from commit bc93a22a19eb2b68a16ecf04cdf4b2ed65aaf398)

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>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/8900731fbc05fb8b0de18af7133a8fc07c3c53a1.1633712176.git.christophe.leroy@csgroup.eu
---
 drivers/misc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 76f6a4f628b3..cc0df7280fe5 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -69,7 +69,7 @@ KCOV_INSTRUMENT_lkdtm_rodata.o	:= n
 
 OBJCOPYFLAGS :=
 OBJCOPYFLAGS_lkdtm_rodata_objcopy.o := \
-	--rename-section .text=.rodata,alloc,readonly,load
+	--rename-section .text=.rodata,alloc,readonly,load,contents
 targets += lkdtm_rodata.o lkdtm_rodata_objcopy.o
 $(obj)/lkdtm_rodata_objcopy.o: $(obj)/lkdtm_rodata.o FORCE
 	$(call if_changed,objcopy)
-- 
2.33.1

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

* Re: [PATCH] [Rebased for 4.14] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
  2022-01-30  9:55 [PATCH] [Rebased for 4.14] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing() Christophe Leroy
@ 2022-01-30 12:53 ` gregkh
  0 siblings, 0 replies; 2+ messages in thread
From: gregkh @ 2022-01-30 12:53 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: stable, linux-kernel, Kees Cook, Arnd Bergmann, Nick Desaulniers,
	Nathan Chancellor

On Sun, Jan 30, 2022 at 09:55:39AM +0000, Christophe Leroy wrote:
> This is backport for 4.14
> 
> (cherry picked from commit bc93a22a19eb2b68a16ecf04cdf4b2ed65aaf398)
> 

Now queued up, thanks.

greg k-h

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

end of thread, other threads:[~2022-01-30 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-30  9:55 [PATCH] [Rebased for 4.14] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing() Christophe Leroy
2022-01-30 12:53 ` gregkh

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.