mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 16:25:07 +07:00
e9e08a0738
With CONFIG_LKDTM=y and make OBJCOPY=llvm-objcopy, llvm-objcopy errors: llvm-objcopy: error: --set-section-flags=.text conflicts with --rename-section=.text=.rodata Rather than support setting flags then renaming sections vs renaming then setting flags, it's simpler to just change both at the same time via --rename-section. Adding the load flag is required for GNU objcopy to mark .rodata Type as PROGBITS after the rename. This can be verified with: $ readelf -S drivers/misc/lkdtm/rodata_objcopy.o ... Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align ... [ 1] .rodata PROGBITS 0000000000000000 00000040 0000000000000004 0000000000000000 A 0 0 4 ... Which shows that .text is now renamed .rodata, the alloc flag A is set, the type is PROGBITS, and the section is not flagged as writeable W. Cc: stable@vger.kernel.org Link: https://sourceware.org/bugzilla/show_bug.cgi?id=24554 Link: https://github.com/ClangBuiltLinux/linux/issues/448 Reported-by: Nathan Chancellor <natechancellor@gmail.com> Suggested-by: Alan Modra <amodra@gmail.com> Suggested-by: Jordan Rupprect <rupprecht@google.com> Suggested-by: Kees Cook <keescook@chromium.org> Acked-by: Kees Cook <keescook@chromium.org> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 lines
637 B
Makefile
22 lines
637 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
obj-$(CONFIG_LKDTM) += lkdtm.o
|
|
|
|
lkdtm-$(CONFIG_LKDTM) += core.o
|
|
lkdtm-$(CONFIG_LKDTM) += bugs.o
|
|
lkdtm-$(CONFIG_LKDTM) += heap.o
|
|
lkdtm-$(CONFIG_LKDTM) += perms.o
|
|
lkdtm-$(CONFIG_LKDTM) += refcount.o
|
|
lkdtm-$(CONFIG_LKDTM) += rodata_objcopy.o
|
|
lkdtm-$(CONFIG_LKDTM) += usercopy.o
|
|
lkdtm-$(CONFIG_LKDTM) += stackleak.o
|
|
|
|
KASAN_SANITIZE_stackleak.o := n
|
|
KCOV_INSTRUMENT_rodata.o := n
|
|
|
|
OBJCOPYFLAGS :=
|
|
OBJCOPYFLAGS_rodata_objcopy.o := \
|
|
--rename-section .text=.rodata,alloc,readonly,load
|
|
targets += rodata.o rodata_objcopy.o
|
|
$(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE
|
|
$(call if_changed,objcopy)
|