Skip to contentSkip to conversation

bpf, arm64: Mark dummy_tramp as global

PATCH Applied Nathan Chancellor 3 participants 3 messages Jul 13, 2022 – Jul 14, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf, arm64: Mark dummy_tramp as global

When building with clang + CONFIG_CFI_CLANG=y, the following error occurs at link time:

ld.lld: error: undefined symbol: dummy_tramp

dummy_tramp is declared globally in C but its definition in inline assembly does not use .global, which prevents clang from properly resolving the references to it when creating the CFI jump tables.

Mark dummy_tramp as global so that the reference can be properly resolved.

Fixes b2ad54e1533e ("bpf, arm64: Implement bpf_arch_text_poke() for arm64")
---
 arch/arm64/net/bpf_jit_comp.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/net/bpf_jit_comp.c +1 -0
index fd1cb0d2aaa6..dcc572b7d4da 100644
@@ -604,6 +604,7 @@ void dummy_tramp(void);
 
 asm (
 "	.pushsection .text, \"ax\", @progbits\n"
+"	.global dummy_tramp\n"
 "	.type dummy_tramp, %function\n"
 "dummy_tramp:"
 #if IS_ENABLED(CONFIG_ARM64_BTI_KERNEL)

base-commit: ace2bee839e08df324cb320763258dfd72e6120e

Signature · 1 line
2.37.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Nathan Chancellor

When building with clang + CONFIG_CFI_CLANG=y, the following error occurs at link time:

ld.lld: error: undefined symbol: dummy_tramp

dummy_tramp is declared globally in C but its definition in inline assembly does not use .global, which prevents clang from properly resolving the references to it when creating the CFI jump tables.

Quoted 7 lines

Mark dummy_tramp as global so that the reference can be properly resolved.

Fixes b2ad54e1533e ("bpf, arm64: Implement bpf_arch_text_poke() for arm64")
Quoted 21 lines
---
 arch/arm64/net/bpf_jit_comp.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/net/bpf_jit_comp.c +1 -0
index fd1cb0d2aaa6..dcc572b7d4da 100644
@@ -604,6 +604,7 @@ void dummy_tramp(void);
 
 asm (
 "      .pushsection .text, \"ax\", @progbits\n"
+"      .global dummy_tramp\n"
 "      .type dummy_tramp, %function\n"
 "dummy_tramp:"
 #if IS_ENABLED(CONFIG_ARM64_BTI_KERNEL)

base-commit: ace2bee839e08df324cb320763258dfd72e6120e --
2.37.1

#2 lore raw
In reply to Nathan Chancellor
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Quoted 10 lines · On Wed, 13 Jul 2022 10:35:03 -0700 you wrote:

When building with clang + CONFIG_CFI_CLANG=y, the following error occurs at link time:

ld.lld: error: undefined symbol: dummy_tramp

dummy_tramp is declared globally in C but its definition in inline assembly does not use .global, which prevents clang from properly resolving the references to it when creating the CFI jump tables.

[...]

Here is the summary with links:
- bpf, arm64: Mark dummy_tramp as global

    https://git.kernel.org/bpf/bpf-next/c/33f32e5072b6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html