[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201905131602.DD63783846@keescook>
Date: Mon, 13 May 2019 16:04:02 -0700
From: Kees Cook <keescook@...omium.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: clang-built-linux@...glegroups.com,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nathan Chancellor <nathanchance@...il.com>,
Jordan Rupprect <rupprecht@...gle.com>,
Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lkdtm: support llvm-objcopy
On Mon, May 13, 2019 at 03:21:09PM -0700, Nick Desaulniers wrote:
> 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@...il.com>
> Suggested-by: Jordan Rupprect <rupprecht@...gle.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
Thanks! This looks good. Greg, can you please take this for drivers/misc?
Acked-by: Kees Cook <keescook@...omium.org>
-Kees
> ---
> 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
>
--
Kees Cook
Powered by blists - more mailing lists