Skip to contentSkip to conversation

x86/arch: Fix access invalid member when disable CONFIG_UNWINDER_ORC

PATCH In review Koba Ko 2 participants 2 messages Sep 20, 2023

Subsystems (3)
lore
Share & tools
lore

Koba Ko

author
#0 lore raw

PATCH 1/1 x86/arch: Fix access invalid member when disable CONFIG_UNWINDER_ORC

CONFIG_UNWINDER_DRAME_POINTER doesn't have bp and sp members.
this leads the compilation error when only enable CONFIG_UNWINDER_DRAME_POINTER.

arch/x86/net/bpf_jit_comp.c:3022:72: error: 'struct unwind_state' has no member named 'sp'; did you mean 'bp'?
3022 | if (!addr || !consume_fn(cookie, (u64)addr, (u64)state.sp, (u64)state.bp))

Fixes f18b03fabaa9 ("bpf: Implement BPF exceptions")
---
 arch/x86/net/bpf_jit_comp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/net/bpf_jit_comp.c +1 -1
index 84005f2114e09..db2b09949d407 100644
@@ -3012,7 +3012,7 @@ bool bpf_jit_supports_exceptions(void)
 
 void arch_bpf_stack_walk(bool (*consume_fn)(void *cookie, u64 ip, u64 sp, u64 bp), void *cookie)
 {
-#if defined(CONFIG_UNWINDER_ORC) || defined(CONFIG_UNWINDER_FRAME_POINTER)
+#if defined(CONFIG_UNWINDER_ORC)
 	struct unwind_state state;
 	unsigned long addr;
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 11 lines · Koba Ko

CONFIG_UNWINDER_DRAME_POINTER doesn't have bp and sp members.
this leads the compilation error when only enable CONFIG_UNWINDER_DRAME_POINTER.

arch/x86/net/bpf_jit_comp.c:3022:72: error: 'struct unwind_state' has no member named 'sp'; did you mean 'bp'?
3022 | if (!addr || !consume_fn(cookie, (u64)addr, (u64)state.sp, (u64)state.bp))

Fixes f18b03fabaa9 ("bpf: Implement BPF exceptions")

---

Hi Koba,
Sincere apologies for the build breakage. This is fixed now in bpf-next, and I believe it will soon make its way into net-next and linux-next.
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=5bfdb4fbf348f9e1935a6e9c64e7f60cb913fb21

Quoted 19 lines
 arch/x86/net/bpf_jit_comp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/net/bpf_jit_comp.c +1 -2
index 84005f2114e09..db2b09949d407 100644
@@ -3012,7 +3012,7 @@ bool bpf_jit_supports_exceptions(void)
 
 void arch_bpf_stack_walk(bool (*consume_fn)(void *cookie, u64 ip, u64 sp, u64 bp), void *cookie)
 {
-#if defined(CONFIG_UNWINDER_ORC) || defined(CONFIG_UNWINDER_FRAME_POINTER)
+#if defined(CONFIG_UNWINDER_ORC)
        struct unwind_state state;
        unsigned long addr;
 
--

2.34.1