All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lkdtm: mark execute_location as noinline
@ 2016-02-08 14:34 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2016-02-08 14:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-arm-kernel, Arnd Bergmann, linux-kernel

The kernel sometimes fails to link when lkdrm is built-in and
compiled with clang:

relocation truncated to fit: R_ARM_THM_CALL against `.bss'

The reason here is that a relocation from .text to .bss fails to
generate a trampoline because .bss is not an executable section.

Marking the function 'noinline' turns the relative branch to .bss
into an absolute branch to the function argument, and that works
fine.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/misc/lkdtm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c
index 11fdadc68e53..5c1351b19029 100644
--- a/drivers/misc/lkdtm.c
+++ b/drivers/misc/lkdtm.c
@@ -335,7 +335,7 @@ static noinline void corrupt_stack(void)
 	memset((void *)data, 0, 64);
 }
 
-static void execute_location(void *dst)
+static void noinline execute_location(void *dst)
 {
 	void (*func)(void) = dst;
 
-- 
2.7.0

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

* [PATCH] lkdtm: mark execute_location as noinline
@ 2016-02-08 14:34 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2016-02-08 14:34 UTC (permalink / raw)
  To: linux-arm-kernel

The kernel sometimes fails to link when lkdrm is built-in and
compiled with clang:

relocation truncated to fit: R_ARM_THM_CALL against `.bss'

The reason here is that a relocation from .text to .bss fails to
generate a trampoline because .bss is not an executable section.

Marking the function 'noinline' turns the relative branch to .bss
into an absolute branch to the function argument, and that works
fine.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/misc/lkdtm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c
index 11fdadc68e53..5c1351b19029 100644
--- a/drivers/misc/lkdtm.c
+++ b/drivers/misc/lkdtm.c
@@ -335,7 +335,7 @@ static noinline void corrupt_stack(void)
 	memset((void *)data, 0, 64);
 }
 
-static void execute_location(void *dst)
+static void noinline execute_location(void *dst)
 {
 	void (*func)(void) = dst;
 
-- 
2.7.0

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

end of thread, other threads:[~2016-02-08 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-08 14:34 [PATCH] lkdtm: mark execute_location as noinline Arnd Bergmann
2016-02-08 14:34 ` Arnd Bergmann

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.