Skip to contentSkip to conversation

/tmp/ccIWiggX.s:22: Error: invalid literal constant: pool needs to be closer

PATCH In review kernel test robot 3 participants 8 messages Mar 14, 2022 – Mar 24, 2022 Arm (32-bit)

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   09688c0166e76ce2fb85e86b9d99be8b0084cdf9
commit: 7e9bf33b812471ee57a03ec7f9b544ca437cc706 ARM: kprobes: Make a frame pointer on __kretprobe_trampoline
date:   5 months ago
config: arm-randconfig-r002-20220313 (https://download.01.org/0day-ci/archive/20220315/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7e9bf33b812471ee57a03ec7f9b544ca437cc706
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 7e9bf33b812471ee57a03ec7f9b544ca437cc706
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

arch/arm/probes/kprobes/core.c:236:16: warning: no previous prototype for 'kprobe_handler' [-Wmissing-prototypes]
236 | void __kprobes kprobe_handler(struct pt_regs *regs)
| ^~~~~~~~~~~~~~
arch/arm/probes/kprobes/core.c: In function 'arch_init_kprobes':
arch/arm/probes/kprobes/core.c:465:12: warning: old-style function definition [-Wold-style-definition]

     465 | int __init arch_init_kprobes()
         |            ^~~~~~~~~~~~~~~~~
   /tmp/ccIWiggX.s: Assembler messages:
>> /tmp/ccIWiggX.s:22: Error: invalid literal constant: pool needs to be closer

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/[email protected]

#1 lore raw
Quoted 22 lines · On Tue, 15 Mar 2022 06:00:48 +0800 kernel test robot <[email protected]> wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   09688c0166e76ce2fb85e86b9d99be8b0084cdf9
commit: 7e9bf33b812471ee57a03ec7f9b544ca437cc706 ARM: kprobes: Make a frame pointer on __kretprobe_trampoline
date:   5 months ago
config: arm-randconfig-r002-20220313 (https://download.01.org/0day-ci/archive/20220315/202203150516.KTorSVVU-lkp(a)intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7e9bf33b812471ee57a03ec7f9b544ca437cc706
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 7e9bf33b812471ee57a03ec7f9b544ca437cc706
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

Quoted 9 lines

arch/arm/probes/kprobes/core.c:236:16: warning: no previous prototype for 'kprobe_handler' [-Wmissing-prototypes]
236 | void __kprobes kprobe_handler(struct pt_regs *regs)
| ^~~~~~~~~~~~~~
arch/arm/probes/kprobes/core.c: In function 'arch_init_kprobes':
arch/arm/probes/kprobes/core.c:465:12: warning: old-style function definition [-Wold-style-definition]

     465 | int __init arch_init_kprobes()
         |            ^~~~~~~~~~~~~~~~~

/tmp/ccIWiggX.s: Assembler messages:

Quoted 1 line
Quoted 1 line

/tmp/ccIWiggX.s:22: Error: invalid literal constant: pool needs to be closer

OK, I finally reproduced it and could make a fix.
It seems that I have to avoid accessing a C function address from the inline assembler in that function. This can be gcc-11's bug, but to avoid this issue, I decided not using inline asm in the function.

Thank you,

Signature · 1 line
Masami Hiramatsu <[email protected]>
#2 lore raw

PATCH 1/1 ARM: kprobes: Make __kretprobe_trampoline as a pure asm function

Make __kretprobe_trampoline() as a pure asm function same as the x86 code does. Anyway, it is safe to define the symbol in the asm code instead of accessing a C symbol from the inline asm.

Without this fix, building arm kernel with GCC-11 may cause below error.

/tmp/ccIWiggX.s: Assembler messages:

Quoted 1 line
Quoted 1 line

/tmp/ccIWiggX.s:22: Error: invalid literal constant: pool needs to be closer

This fixes the error reported by 0day build bot.

Fixes 7e9bf33b8124 ("ARM: kprobes: Make a frame pointer on __kretprobe_trampoline")
---
 arch/arm/probes/kprobes/core.c |   57 +++++++++++++++++++++-------------------
 1 file changed, 30 insertions(+), 27 deletions(-)
arch/arm/probes/kprobes/core.c +30 -27
index 4848404ba51b..51f1438456ae 100644
@@ -373,43 +373,46 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
  * should be enough for stacktrace from the return handler with or
  * without pt_regs.
  */
-void __naked __kprobes __kretprobe_trampoline(void)
-{
-	__asm__ __volatile__ (
+asm(
+	".text\n"
+	".global __kretprobe_trampoline\n"
+	".type __kretprobe_trampoline, %function\n"
+	"__kretprobe_trampoline:\n"
 #ifdef CONFIG_FRAME_POINTER
-		"ldr	lr, =__kretprobe_trampoline	\n\t"
+	"ldr	lr, =__kretprobe_trampoline	\n\t"
 	/* __kretprobe_trampoline makes a framepointer on pt_regs. */
 #ifdef CONFIG_CC_IS_CLANG
-		"stmdb	sp, {sp, lr, pc}	\n\t"
-		"sub	sp, sp, #12		\n\t"
-		/* In clang case, pt_regs->ip = lr. */
-		"stmdb	sp!, {r0 - r11, lr}	\n\t"
-		/* fp points regs->r11 (fp) */
-		"add	fp, sp,	#44		\n\t"
+	"stmdb	sp, {sp, lr, pc}	\n\t"
+	"sub	sp, sp, #12		\n\t"
+	/* In clang case, pt_regs->ip = lr. */
+	"stmdb	sp!, {r0 - r11, lr}	\n\t"
+	/* fp points regs->r11 (fp) */
+	"add	fp, sp,	#44		\n\t"
 #else /* !CONFIG_CC_IS_CLANG */
-		/* In gcc case, pt_regs->ip = fp. */
-		"stmdb	sp, {fp, sp, lr, pc}	\n\t"
-		"sub	sp, sp, #16		\n\t"
-		"stmdb	sp!, {r0 - r11}		\n\t"
-		/* fp points regs->r15 (pc) */
-		"add	fp, sp, #60		\n\t"
+	/* In gcc case, pt_regs->ip = fp. */
+	"stmdb	sp, {fp, sp, lr, pc}	\n\t"
+	"sub	sp, sp, #16		\n\t"
+	"stmdb	sp!, {r0 - r11}		\n\t"
+	/* fp points regs->r15 (pc) */
+	"add	fp, sp, #60		\n\t"
 #endif /* CONFIG_CC_IS_CLANG */
 #else /* !CONFIG_FRAME_POINTER */
-		"sub	sp, sp, #16		\n\t"
-		"stmdb	sp!, {r0 - r11}		\n\t"
+	"sub	sp, sp, #16		\n\t"
+	"stmdb	sp!, {r0 - r11}		\n\t"
 #endif /* CONFIG_FRAME_POINTER */
-		"mov	r0, sp			\n\t"
-		"bl	trampoline_handler	\n\t"
-		"mov	lr, r0			\n\t"
-		"ldmia	sp!, {r0 - r11}		\n\t"
-		"add	sp, sp, #16		\n\t"
+	"mov	r0, sp			\n\t"
+	"bl	trampoline_handler	\n\t"
+	"mov	lr, r0			\n\t"
+	"ldmia	sp!, {r0 - r11}		\n\t"
+	"add	sp, sp, #16		\n\t"
 #ifdef CONFIG_THUMB2_KERNEL
-		"bx	lr			\n\t"
+	"bx	lr			\n\t"
 #else
-		"mov	pc, lr			\n\t"
+	"mov	pc, lr			\n\t"
 #endif
-		: : : "memory");
-}
+	".size __kretprobe_trampoline, .-__kretprobe_trampoline\n"
+);
+NOKPROBE_SYMBOL(__kretprobe_trampoline);
 
 /* Called from __kretprobe_trampoline */
 static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
#3 lore raw

Re: [PATCH] ARM: kprobes: Make __kretprobe_trampoline as a pure asm function

Hi,

I found a better solution for this issue from Ard :-)

https://lore.kernel.org/all/20220203082204.1176734-6-ardb(a)kernel.org/T/#u

I should use mov_l instead of ldr for loading the symbol address.

Thank you,

Quoted 98 lines · On Tue, 15 Mar 2022 18:52:16 +0900 Masami Hiramatsu <[email protected]> wrote:

Make __kretprobe_trampoline() as a pure asm function same as the x86 code does. Anyway, it is safe to define the symbol in the asm code instead of accessing a C symbol from the inline asm.

Without this fix, building arm kernel with GCC-11 may cause below error.

/tmp/ccIWiggX.s: Assembler messages:

Quoted 1 line
Quoted 1 line

/tmp/ccIWiggX.s:22: Error: invalid literal constant: pool needs to be closer

This fixes the error reported by 0day build bot.

Fixes 7e9bf33b8124 ("ARM: kprobes: Make a frame pointer on __kretprobe_trampoline")
---
 arch/arm/probes/kprobes/core.c |   57 +++++++++++++++++++++-------------------
 1 file changed, 30 insertions(+), 27 deletions(-)
arch/arm/probes/kprobes/core.c +30 -27
index 4848404ba51b..51f1438456ae 100644
@@ -373,43 +373,46 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
  * should be enough for stacktrace from the return handler with or
  * without pt_regs.
  */
-void __naked __kprobes __kretprobe_trampoline(void)
-{
-	__asm__ __volatile__ (
+asm(
+	".text\n"
+	".global __kretprobe_trampoline\n"
+	".type __kretprobe_trampoline, %function\n"
+	"__kretprobe_trampoline:\n"
 #ifdef CONFIG_FRAME_POINTER
-		"ldr	lr, =__kretprobe_trampoline	\n\t"
+	"ldr	lr, =__kretprobe_trampoline	\n\t"
 	/* __kretprobe_trampoline makes a framepointer on pt_regs. */
 #ifdef CONFIG_CC_IS_CLANG
-		"stmdb	sp, {sp, lr, pc}	\n\t"
-		"sub	sp, sp, #12		\n\t"
-		/* In clang case, pt_regs->ip = lr. */
-		"stmdb	sp!, {r0 - r11, lr}	\n\t"
-		/* fp points regs->r11 (fp) */
-		"add	fp, sp,	#44		\n\t"
+	"stmdb	sp, {sp, lr, pc}	\n\t"
+	"sub	sp, sp, #12		\n\t"
+	/* In clang case, pt_regs->ip = lr. */
+	"stmdb	sp!, {r0 - r11, lr}	\n\t"
+	/* fp points regs->r11 (fp) */
+	"add	fp, sp,	#44		\n\t"
 #else /* !CONFIG_CC_IS_CLANG */
-		/* In gcc case, pt_regs->ip = fp. */
-		"stmdb	sp, {fp, sp, lr, pc}	\n\t"
-		"sub	sp, sp, #16		\n\t"
-		"stmdb	sp!, {r0 - r11}		\n\t"
-		/* fp points regs->r15 (pc) */
-		"add	fp, sp, #60		\n\t"
+	/* In gcc case, pt_regs->ip = fp. */
+	"stmdb	sp, {fp, sp, lr, pc}	\n\t"
+	"sub	sp, sp, #16		\n\t"
+	"stmdb	sp!, {r0 - r11}		\n\t"
+	/* fp points regs->r15 (pc) */
+	"add	fp, sp, #60		\n\t"
 #endif /* CONFIG_CC_IS_CLANG */
 #else /* !CONFIG_FRAME_POINTER */
-		"sub	sp, sp, #16		\n\t"
-		"stmdb	sp!, {r0 - r11}		\n\t"
+	"sub	sp, sp, #16		\n\t"
+	"stmdb	sp!, {r0 - r11}		\n\t"
 #endif /* CONFIG_FRAME_POINTER */
-		"mov	r0, sp			\n\t"
-		"bl	trampoline_handler	\n\t"
-		"mov	lr, r0			\n\t"
-		"ldmia	sp!, {r0 - r11}		\n\t"
-		"add	sp, sp, #16		\n\t"
+	"mov	r0, sp			\n\t"
+	"bl	trampoline_handler	\n\t"
+	"mov	lr, r0			\n\t"
+	"ldmia	sp!, {r0 - r11}		\n\t"
+	"add	sp, sp, #16		\n\t"
 #ifdef CONFIG_THUMB2_KERNEL
-		"bx	lr			\n\t"
+	"bx	lr			\n\t"
 #else
-		"mov	pc, lr			\n\t"
+	"mov	pc, lr			\n\t"
 #endif
-		: : : "memory");
-}
+	".size __kretprobe_trampoline, .-__kretprobe_trampoline\n"
+);
+NOKPROBE_SYMBOL(__kretprobe_trampoline);
 
 /* Called from __kretprobe_trampoline */
 static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
Signature · 1 line
Masami Hiramatsu <[email protected]>
#4 lore raw

Re: [PATCH] ARM: kprobes: Make __kretprobe_trampoline as a pure asm function

Quoted 7 lines · On Thu, 24 Mar 2022 15:21:08 +0900 Masami Hiramatsu <[email protected]> wrote:

Hi,

I found a better solution for this issue from Ard :-)

https://lore.kernel.org/all/20220203082204.1176734-6-ardb(a)kernel.org/T/#u

I should use mov_l instead of ldr for loading the symbol address.

Hm, these macros are only for the pure assembly file (.S), so we have to split this in a asm file to use that.

Thanks,

Quoted 108 lines

Thank you,

Quoted 98 lines · On Tue, 15 Mar 2022 18:52:16 +0900 Masami Hiramatsu <[email protected]> wrote:

Make __kretprobe_trampoline() as a pure asm function same as the x86 code does. Anyway, it is safe to define the symbol in the asm code instead of accessing a C symbol from the inline asm.

Without this fix, building arm kernel with GCC-11 may cause below error.

/tmp/ccIWiggX.s: Assembler messages:

Quoted 1 line
Quoted 1 line

/tmp/ccIWiggX.s:22: Error: invalid literal constant: pool needs to be closer

This fixes the error reported by 0day build bot.

Fixes 7e9bf33b8124 ("ARM: kprobes: Make a frame pointer on __kretprobe_trampoline")
---
 arch/arm/probes/kprobes/core.c |   57 +++++++++++++++++++++-------------------
 1 file changed, 30 insertions(+), 27 deletions(-)
arch/arm/probes/kprobes/core.c +30 -27
index 4848404ba51b..51f1438456ae 100644
@@ -373,43 +373,46 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
  * should be enough for stacktrace from the return handler with or
  * without pt_regs.
  */
-void __naked __kprobes __kretprobe_trampoline(void)
-{
-	__asm__ __volatile__ (
+asm(
+	".text\n"
+	".global __kretprobe_trampoline\n"
+	".type __kretprobe_trampoline, %function\n"
+	"__kretprobe_trampoline:\n"
 #ifdef CONFIG_FRAME_POINTER
-		"ldr	lr, =__kretprobe_trampoline	\n\t"
+	"ldr	lr, =__kretprobe_trampoline	\n\t"
 	/* __kretprobe_trampoline makes a framepointer on pt_regs. */
 #ifdef CONFIG_CC_IS_CLANG
-		"stmdb	sp, {sp, lr, pc}	\n\t"
-		"sub	sp, sp, #12		\n\t"
-		/* In clang case, pt_regs->ip = lr. */
-		"stmdb	sp!, {r0 - r11, lr}	\n\t"
-		/* fp points regs->r11 (fp) */
-		"add	fp, sp,	#44		\n\t"
+	"stmdb	sp, {sp, lr, pc}	\n\t"
+	"sub	sp, sp, #12		\n\t"
+	/* In clang case, pt_regs->ip = lr. */
+	"stmdb	sp!, {r0 - r11, lr}	\n\t"
+	/* fp points regs->r11 (fp) */
+	"add	fp, sp,	#44		\n\t"
 #else /* !CONFIG_CC_IS_CLANG */
-		/* In gcc case, pt_regs->ip = fp. */
-		"stmdb	sp, {fp, sp, lr, pc}	\n\t"
-		"sub	sp, sp, #16		\n\t"
-		"stmdb	sp!, {r0 - r11}		\n\t"
-		/* fp points regs->r15 (pc) */
-		"add	fp, sp, #60		\n\t"
+	/* In gcc case, pt_regs->ip = fp. */
+	"stmdb	sp, {fp, sp, lr, pc}	\n\t"
+	"sub	sp, sp, #16		\n\t"
+	"stmdb	sp!, {r0 - r11}		\n\t"
+	/* fp points regs->r15 (pc) */
+	"add	fp, sp, #60		\n\t"
 #endif /* CONFIG_CC_IS_CLANG */
 #else /* !CONFIG_FRAME_POINTER */
-		"sub	sp, sp, #16		\n\t"
-		"stmdb	sp!, {r0 - r11}		\n\t"
+	"sub	sp, sp, #16		\n\t"
+	"stmdb	sp!, {r0 - r11}		\n\t"
 #endif /* CONFIG_FRAME_POINTER */
-		"mov	r0, sp			\n\t"
-		"bl	trampoline_handler	\n\t"
-		"mov	lr, r0			\n\t"
-		"ldmia	sp!, {r0 - r11}		\n\t"
-		"add	sp, sp, #16		\n\t"
+	"mov	r0, sp			\n\t"
+	"bl	trampoline_handler	\n\t"
+	"mov	lr, r0			\n\t"
+	"ldmia	sp!, {r0 - r11}		\n\t"
+	"add	sp, sp, #16		\n\t"
 #ifdef CONFIG_THUMB2_KERNEL
-		"bx	lr			\n\t"
+	"bx	lr			\n\t"
 #else
-		"mov	pc, lr			\n\t"
+	"mov	pc, lr			\n\t"
 #endif
-		: : : "memory");
-}
+	".size __kretprobe_trampoline, .-__kretprobe_trampoline\n"
+);
+NOKPROBE_SYMBOL(__kretprobe_trampoline);
 
 /* Called from __kretprobe_trampoline */
 static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
Signature · 1 line
Masami Hiramatsu <[email protected]>
Signature · 1 line
Masami Hiramatsu <[email protected]>
#5 lore raw

Re: [PATCH] ARM: kprobes: Make __kretprobe_trampoline as a pure asm function

arch/arm/probes/kprobes/core.c +6 -1
@@ -377,7 +377,7 @@ void __naked __kprobes __kretprobe_trampoline(void)
 {
        __asm__ __volatile__ (
 #ifdef CONFIG_FRAME_POINTER
-               "ldr    lr, =__kretprobe_trampoline     \n\t"
+               "ldr    lr, .L__kretprobe_trampoline    \n\t"
        /* __kretprobe_trampoline makes a framepointer on pt_regs. */
 #ifdef CONFIG_CC_IS_CLANG
                "stmdb  sp, {sp, lr, pc}        \n\t"
@@ -407,6 +407,11 @@ void __naked __kprobes __kretprobe_trampoline(void)
                "bx     lr                      \n\t"
 #else
                "mov    pc, lr                  \n\t"
+#endif
+#ifdef CONFIG_FRAME_POINTER
+               ".align 2                       \n\t"
+       ".L__kretprobe_trampoline:              \n\t"
+               ".long  __kretprobe_trampoline  \n\t"
 #endif
                : : : "memory");
 }
Quoted 6 lines · Masami Hiramatsu
Quoted 2 lines · On Thu, 24 Mar 2022 15:21:08 +0900 Masami Hiramatsu <[email protected]> wrote:

Hi,

Quoted 9 lines
Quoted 5 lines

I found a better solution for this issue from Ard :-)

https://lore.kernel.org/all/20220203082204.1176734-6-ardb(a)kernel.org/T/#u

I should use mov_l instead of ldr for loading the symbol address.

Hm, these macros are only for the pure assembly file (.S), so we have to split this in a asm file to use that.

What about the below?

#6 lore raw

Re: [PATCH] ARM: kprobes: Make __kretprobe_trampoline as a pure asm function

Quoted 16 lines · Ard Biesheuvel
arch/arm/probes/kprobes/core.c +1 -1
@@ -377,7 +377,7 @@ void __naked __kprobes __kretprobe_trampoline(void)
 {
        __asm__ __volatile__ (
 #ifdef CONFIG_FRAME_POINTER
-               "ldr    lr, =__kretprobe_trampoline     \n\t"
+               "ldr    lr, .L__kretprobe_trampoline    \n\t"
        /* __kretprobe_trampoline makes a framepointer on pt_regs. */
 #ifdef CONFIG_CC_IS_CLANG
                "stmdb  sp, {sp, lr, pc}        \n\t"
@@ -407,6 +407,11 @@ void __naked __kprobes __kretprobe_trampoline(void)
                "bx     lr                      \n\t"

arch/arm/probes/kprobes/core.c void __naked __kprobes __kretprobe_trampoline(void) · line 417

Quoted 10 lines
arch/arm/probes/kprobes/core.c +5 -0
 #else
                "mov    pc, lr                  \n\t"
+#endif
+#ifdef CONFIG_FRAME_POINTER
+               ".align 2                       \n\t"
+       ".L__kretprobe_trampoline:              \n\t"
+               ".long  __kretprobe_trampoline  \n\t"
 #endif
                : : : "memory");
 }

Pardon the copy/paste error.

Quoted 1 line

What about the below?

was meant to refer to the diff above.

Quoted 19 lines · Masami Hiramatsu
Quoted 6 lines
Quoted 2 lines · On Thu, 24 Mar 2022 15:21:08 +0900 Masami Hiramatsu <[email protected]> wrote:

Hi,

Quoted 9 lines
Quoted 5 lines

I found a better solution for this issue from Ard :-)

https://lore.kernel.org/all/20220203082204.1176734-6-ardb(a)kernel.org/T/#u

I should use mov_l instead of ldr for loading the symbol address.

Hm, these macros are only for the pure assembly file (.S), so we have to split this in a asm file to use that.

What about the below?

#7 lore raw

Re: [PATCH] ARM: kprobes: Make __kretprobe_trampoline as a pure asm function

In reply to Ard Biesheuvel

Hi Ard,

Quoted 13 lines · On Thu, 24 Mar 2022 14:34:46 +0100 Ard Biesheuvel <[email protected]> wrote:
arch/arm/probes/kprobes/core.c +1 -1
@@ -377,7 +377,7 @@ void __naked __kprobes __kretprobe_trampoline(void)
 {
        __asm__ __volatile__ (
 #ifdef CONFIG_FRAME_POINTER
-               "ldr    lr, =__kretprobe_trampoline     \n\t"
+               "ldr    lr, .L__kretprobe_trampoline    \n\t"
        /* __kretprobe_trampoline makes a framepointer on pt_regs. */
 #ifdef CONFIG_CC_IS_CLANG
                "stmdb  sp, {sp, lr, pc}        \n\t"
@@ -407,6 +407,11 @@ void __naked __kprobes __kretprobe_trampoline(void)
                "bx     lr                      \n\t"

arch/arm/probes/kprobes/core.c void __naked __kprobes __kretprobe_trampoline(void) · line 417

Quoted 10 lines
arch/arm/probes/kprobes/core.c +5 -0
 #else
                "mov    pc, lr                  \n\t"
+#endif
+#ifdef CONFIG_FRAME_POINTER
+               ".align 2                       \n\t"
+       ".L__kretprobe_trampoline:              \n\t"
+               ".long  __kretprobe_trampoline  \n\t"
 #endif
                : : : "memory");
 }

Yes, I confirmed this works too :-)

Can you send the patch with my Tested-by ?

Thank you!

Quoted 21 lines · Masami Hiramatsu
Quoted 6 lines
Quoted 2 lines · On Thu, 24 Mar 2022 15:21:08 +0900 Masami Hiramatsu <[email protected]> wrote:

Hi,

Quoted 9 lines
Quoted 5 lines

I found a better solution for this issue from Ard :-)

https://lore.kernel.org/all/20220203082204.1176734-6-ardb(a)kernel.org/T/#u

I should use mov_l instead of ldr for loading the symbol address.

Hm, these macros are only for the pure assembly file (.S), so we have to split this in a asm file to use that.

What about the below?

Signature · 1 line
Masami Hiramatsu <[email protected]>