linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lkdtm: avoid link error on ARM
@ 2016-06-17 10:07 Arnd Bergmann
  2016-06-17 15:33 ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2016-06-17 10:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Arnd Bergmann, Kees Cook, linux-kernel

The lkdtm_rodata file is built so that a function in it gets linked into
the .rodata ELF section. This works fine normally, but on 32-bit ARM
with really large kernels, it prevents the linker from inserting a
veneer for the call to __gnu_mcount_nc in case we are building with
"gcc -pg":

drivers/misc/built-in.o: In function `lkdtm_rodata_do_nothing':
panel.c:(.rodata+0x1480): relocation truncated to fit: R_ARM_CALL against symbol `__gnu_mcount_nc' defined in .text section in arch/arm/kernel/built-in.o

We probably never want the profiling code to be enabled for this file
anyway, so this just removes the option here, and for the sake of
consistency also in the lkdtm core module.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 9a49a528dcf3 ("lkdtm: add function for testing .rodata section")
---
 drivers/misc/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 7d45ed4a1549..4a25eeaa30f9 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -60,6 +60,8 @@ obj-$(CONFIG_PANEL)             += panel.o
 
 lkdtm-$(CONFIG_LKDTM)		+= lkdtm_core.o
 lkdtm-$(CONFIG_LKDTM)		+= lkdtm_rodata_objcopy.o
+CFLAGS_REMOVE_lkdtm_core.o	+= -pg
+CFLAGS_REMOVE_lkdtm_rodata.o	+= -pg
 
 OBJCOPYFLAGS :=
 OBJCOPYFLAGS_lkdtm_rodata_objcopy.o := \
-- 
2.9.0

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

* Re: [PATCH] lkdtm: avoid link error on ARM
  2016-06-17 10:07 [PATCH] lkdtm: avoid link error on ARM Arnd Bergmann
@ 2016-06-17 15:33 ` Kees Cook
  2016-06-17 15:36   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2016-06-17 15:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Arnd Bergmann, LKML

On Fri, Jun 17, 2016 at 3:07 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> The lkdtm_rodata file is built so that a function in it gets linked into
> the .rodata ELF section. This works fine normally, but on 32-bit ARM
> with really large kernels, it prevents the linker from inserting a
> veneer for the call to __gnu_mcount_nc in case we are building with
> "gcc -pg":
>
> drivers/misc/built-in.o: In function `lkdtm_rodata_do_nothing':
> panel.c:(.rodata+0x1480): relocation truncated to fit: R_ARM_CALL against symbol `__gnu_mcount_nc' defined in .text section in arch/arm/kernel/built-in.o
>
> We probably never want the profiling code to be enabled for this file
> anyway, so this just removes the option here, and for the sake of
> consistency also in the lkdtm core module.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 9a49a528dcf3 ("lkdtm: add function for testing .rodata section")

Looks fine to me, thanks!

Acked-by: Kees Cook <keescook@chromium.org>

Greg, can you take this into your tree for -next?

Thanks!

-Kees

> ---
>  drivers/misc/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> index 7d45ed4a1549..4a25eeaa30f9 100644
> --- a/drivers/misc/Makefile
> +++ b/drivers/misc/Makefile
> @@ -60,6 +60,8 @@ obj-$(CONFIG_PANEL)             += panel.o
>
>  lkdtm-$(CONFIG_LKDTM)          += lkdtm_core.o
>  lkdtm-$(CONFIG_LKDTM)          += lkdtm_rodata_objcopy.o
> +CFLAGS_REMOVE_lkdtm_core.o     += -pg
> +CFLAGS_REMOVE_lkdtm_rodata.o   += -pg
>
>  OBJCOPYFLAGS :=
>  OBJCOPYFLAGS_lkdtm_rodata_objcopy.o := \
> --
> 2.9.0
>



-- 
Kees Cook
Chrome OS & Brillo Security

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

* Re: [PATCH] lkdtm: avoid link error on ARM
  2016-06-17 15:33 ` Kees Cook
@ 2016-06-17 15:36   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2016-06-17 15:36 UTC (permalink / raw)
  To: Kees Cook; +Cc: Arnd Bergmann, LKML

On Fri, Jun 17, 2016 at 08:33:00AM -0700, Kees Cook wrote:
> On Fri, Jun 17, 2016 at 3:07 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> > The lkdtm_rodata file is built so that a function in it gets linked into
> > the .rodata ELF section. This works fine normally, but on 32-bit ARM
> > with really large kernels, it prevents the linker from inserting a
> > veneer for the call to __gnu_mcount_nc in case we are building with
> > "gcc -pg":
> >
> > drivers/misc/built-in.o: In function `lkdtm_rodata_do_nothing':
> > panel.c:(.rodata+0x1480): relocation truncated to fit: R_ARM_CALL against symbol `__gnu_mcount_nc' defined in .text section in arch/arm/kernel/built-in.o
> >
> > We probably never want the profiling code to be enabled for this file
> > anyway, so this just removes the option here, and for the sake of
> > consistency also in the lkdtm core module.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > Fixes: 9a49a528dcf3 ("lkdtm: add function for testing .rodata section")
> 
> Looks fine to me, thanks!
> 
> Acked-by: Kees Cook <keescook@chromium.org>
> 
> Greg, can you take this into your tree for -next?

Yes,will do.

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

end of thread, other threads:[~2016-06-17 15:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-17 10:07 [PATCH] lkdtm: avoid link error on ARM Arnd Bergmann
2016-06-17 15:33 ` Kees Cook
2016-06-17 15:36   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).