All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lkdtm: support llvm-objcopy
@ 2019-05-13 22:21 Nick Desaulniers
  2019-05-13 22:26 ` Nick Desaulniers
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Nick Desaulniers @ 2019-05-13 22:21 UTC (permalink / raw)
  To: keescook
  Cc: clang-built-linux, Nick Desaulniers, Nathan Chancellor,
	Jordan Rupprect, Arnd Bergmann, Greg Kroah-Hartman, linux-kernel

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.

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 in the Flags field that .text is now renamed .rodata, the
append flag A is set, and the section is not flagged as writeable W.

Link: https://github.com/ClangBuiltLinux/linux/issues/448
Reported-by: Nathan Chancellor <nathanchance@gmail.com>
Suggested-by: Jordan Rupprect <rupprecht@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 drivers/misc/lkdtm/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile
index 951c984de61a..89dee2a9d88c 100644
--- a/drivers/misc/lkdtm/Makefile
+++ b/drivers/misc/lkdtm/Makefile
@@ -15,8 +15,7 @@ KCOV_INSTRUMENT_rodata.o	:= n
 
 OBJCOPYFLAGS :=
 OBJCOPYFLAGS_rodata_objcopy.o	:= \
-			--set-section-flags .text=alloc,readonly \
-			--rename-section .text=.rodata
+			--rename-section .text=.rodata,alloc,readonly
 targets += rodata.o rodata_objcopy.o
 $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE
 	$(call if_changed,objcopy)
-- 
2.21.0.1020.gf2820cf01a-goog


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

end of thread, other threads:[~2019-05-17  4:09 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-13 22:21 [PATCH] lkdtm: support llvm-objcopy Nick Desaulniers
2019-05-13 22:26 ` Nick Desaulniers
2019-05-13 23:04 ` Kees Cook
2019-05-13 23:29 ` Nathan Chancellor
2019-05-13 23:38   ` Jordan Rupprecht
2019-05-13 23:47     ` Nathan Chancellor
2019-05-13 23:50   ` Nick Desaulniers
2019-05-14 18:10     ` Kees Cook
2019-05-14 20:24       ` Nick Desaulniers
2019-05-15 16:42         ` Kees Cook
2019-05-15 17:37           ` Nick Desaulniers
2019-05-15 18:12             ` [PATCH v2] " Nick Desaulniers
2019-05-15 18:19               ` Nathan Chancellor
2019-05-15 18:24                 ` [PATCH v3] " Nick Desaulniers
     [not found]                   ` <20190517001002.D1A262084A@mail.kernel.org>
2019-05-17  4:06                     ` Nathan Chancellor
2019-05-17  4:09                       ` Nathan Chancellor

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.