linux/drivers/misc/lkdtm
Christophe Leroy bc93a22a19 lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
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: e9e08a0738 ("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
2021-12-16 15:54:37 -08:00
..
bugs.c lkdtm: avoid printk() in recursive_loop() 2021-12-16 15:54:37 -08:00
cfi.c lkdtm: Add CONFIG hints in errors where possible 2021-06-24 15:32:08 +02:00
core.c lkdtm: Note that lkdtm_kernel_info should be removed in the future 2021-12-16 15:54:36 -08:00
fortify.c lkdtm/fortify: Consolidate FORTIFY_SOURCE tests 2021-08-18 22:28:51 +02:00
heap.c lkdtm/heap: Avoid __alloc_size hint warning for VMALLOC_LINEAR_OVERFLOW 2021-08-18 22:28:51 +02:00
lkdtm.h lkdtm/bugs: Check that a per-task stack canary exists 2021-10-25 09:13:46 +02:00
Makefile lkdtm: Fix content of section containing lkdtm_rodata_do_nothing() 2021-12-16 15:54:37 -08:00
perms.c lkdtm: Avoid more compiler optimizations for bad writes 2020-06-29 18:41:39 +02:00
powerpc.c lkdtm/powerpc: Add SLB multihit test 2020-12-04 01:01:34 +11:00
refcount.c lkdtm: Remove references to CONFIG_REFCOUNT_FULL 2019-11-25 09:15:46 +01:00
rodata.c lkdtm: don't move ctors to .rodata 2020-12-09 15:51:14 +01:00
stackleak.c lkdtm: Add CONFIG hints in errors where possible 2021-06-24 15:32:08 +02:00
usercopy.c lkdtm: Add CONFIG hints in errors where possible 2021-06-24 15:32:08 +02:00