[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdnWbKdBuSGtmu2DURy5dtVGUYWJ_mwxSL6N5OfbmjU3EA@mail.gmail.com>
Date: Fri, 8 Oct 2021 11:09:47 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Christophe Leroy <christophe.leroy@...roup.eu>
Cc: Kees Cook <keescook@...omium.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
stable@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
Nathan Chancellor <nathan@...nel.org>
Subject: Re: [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
On Fri, Oct 8, 2021 at 9:59 AM Christophe Leroy
<christophe.leroy@...roup.eu> wrote:
>
> 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: e9e08a07385e ("lkdtm: support llvm-objcopy")
Thanks for the patch; sorry I broke this.
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
> Cc: stable@...r.kernel.org
> Cc: Kees Cook <keescook@...omium.org>
> Cc: Arnd Bergmann <arnd@...db.de>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: Nick Desaulniers <ndesaulniers@...gle.com>
> Cc: Nathan Chancellor <nathan@...nel.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
> ---
> drivers/misc/lkdtm/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile
> index aa12097668d3..e2984ce51fe4 100644
> --- a/drivers/misc/lkdtm/Makefile
> +++ b/drivers/misc/lkdtm/Makefile
> @@ -20,7 +20,7 @@ CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LTO)
>
> OBJCOPYFLAGS :=
> OBJCOPYFLAGS_rodata_objcopy.o := \
> - --rename-section .noinstr.text=.rodata,alloc,readonly,load
> + --rename-section .noinstr.text=.rodata,alloc,readonly,load,contents
> targets += rodata.o rodata_objcopy.o
> $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE
> $(call if_changed,objcopy)
> --
> 2.31.1
>
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists