Skip to content

Commit fb28a88

Browse files
committed
lkdtm: Disable CFI checking for perms functions
The EXEC_RODATA test plays a lot of tricks to live in the .rodata section, and once again ran into objtool's (completely reasonable) assumptions that executable code should live in an executable section. However, this manifested only under CONFIG_CFI_CLANG=y, as one of the .cfi_sites was pointing into the .rodata section. Since we're testing non-CFI execution properties in perms.c (and rodata.c), we can disable CFI for the involved functions, and remove the CFI arguments from rodata.c entirely. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-lkp/[email protected] Fixes: 6342a20 ("objtool: Add elf_create_section_pair()") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent 26f812b commit fb28a88

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/misc/lkdtm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ KASAN_SANITIZE_rodata.o := n
1919
KCSAN_SANITIZE_rodata.o := n
2020
KCOV_INSTRUMENT_rodata.o := n
2121
OBJECT_FILES_NON_STANDARD_rodata.o := y
22-
CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LTO) $(RETHUNK_CFLAGS)
22+
CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LTO) $(RETHUNK_CFLAGS) $(CC_FLAGS_CFI)
2323

2424
OBJCOPYFLAGS :=
2525
OBJCOPYFLAGS_rodata_objcopy.o := \

drivers/misc/lkdtm/perms.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static void *setup_function_descriptor(func_desc_t *fdesc, void *dst)
6161
return fdesc;
6262
}
6363

64-
static noinline void execute_location(void *dst, bool write)
64+
static noinline __nocfi void execute_location(void *dst, bool write)
6565
{
6666
void (*func)(void);
6767
func_desc_t fdesc;

0 commit comments

Comments
 (0)