Skip to contentSkip to conversation

riscv, bpf: fix patch_text implicit declaration

PATCH In review Randy Dunlap 3 participants 3 messages Feb 27, 2023

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

PATCH v2 1/1 riscv, bpf: fix patch_text implicit declaration

bpf_jit_comp64.c uses patch_text(), so add <asm/patch.h> to it to prevent the build error:

../arch/riscv/net/bpf_jit_comp64.c: In function 'bpf_arch_text_poke':
../arch/riscv/net/bpf_jit_comp64.c:691:23: error: implicit declaration of function 'patch_text'; did you mean 'path_get'? [-Werror=implicit-function-declaration]

  691 |                 ret = patch_text(ip, new_insns, ninsns);
      |                       ^~~~~~~~~~
Fixes 596f2e6f9cf4 ("riscv, bpf: Add bpf_arch_text_poke support for RV64")
Cc Pu Lehui <[email protected]>
Cc Luke Nelson <[email protected]>
Cc Xi Wang <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Daniel Borkmann <[email protected]>
Cc John Fastabend <[email protected]>
Cc Andrii Nakryiko <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Albert Ou <[email protected]>
Cc "Björn Töpel" <[email protected]>

---
v2: add header file directly to bpf_jit_comp64.c (Pu Lehui)
change patch target to bpf (for fixes)

 arch/riscv/net/bpf_jit_comp64.c |    1 +
 1 file changed, 1 insertion(+)
arch/riscv/net/bpf_jit_comp64.c +1 -0
diff -- a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c
@@ -10,6 +10,7 @@
 #include <linux/filter.h>
 #include <linux/memory.h>
 #include <linux/stop_machine.h>
+#include <asm/patch.h>
 #include "bpf_jit.h"
 
 #define RV_REG_TCC RV_REG_A6
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 36 lines · Randy Dunlap

bpf_jit_comp64.c uses patch_text(), so add <asm/patch.h> to it to prevent the build error:

../arch/riscv/net/bpf_jit_comp64.c: In function 'bpf_arch_text_poke':
../arch/riscv/net/bpf_jit_comp64.c:691:23: error: implicit declaration of function 'patch_text'; did you mean 'path_get'? [-Werror=implicit-function-declaration]

   691 |                 ret = patch_text(ip, new_insns, ninsns);
       |                       ^~~~~~~~~~
Fixes 596f2e6f9cf4 ("riscv, bpf: Add bpf_arch_text_poke support for RV64")
Cc Pu Lehui <[email protected]>
Cc Luke Nelson <[email protected]>
Cc Xi Wang <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Daniel Borkmann <[email protected]>
Cc John Fastabend <[email protected]>
Cc Andrii Nakryiko <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Albert Ou <[email protected]>
Cc "Björn Töpel" <[email protected]>

---
v2: add header file directly to bpf_jit_comp64.c (Pu Lehui)
change patch target to bpf (for fixes)

  arch/riscv/net/bpf_jit_comp64.c |    1 +
  1 file changed, 1 insertion(+)

diff -- a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c

arch/riscv/net/bpf_jit_comp64.c line 16

Quoted 7 lines
arch/riscv/net/bpf_jit_comp64.c +1 -0
@@ -10,6 +10,7 @@
  #include <linux/filter.h>
  #include <linux/memory.h>
  #include <linux/stop_machine.h>
+#include <asm/patch.h>
  #include "bpf_jit.h"
 
  #define RV_REG_TCC RV_REG_A6
maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Randy Dunlap
Quoted 25 lines · Randy Dunlap

bpf_jit_comp64.c uses patch_text(), so add <asm/patch.h> to it to prevent the build error:

../arch/riscv/net/bpf_jit_comp64.c: In function 'bpf_arch_text_poke':
../arch/riscv/net/bpf_jit_comp64.c:691:23: error: implicit declaration of function 'patch_text'; did you mean 'path_get'? [-Werror=implicit-function-declaration]

  691 |                 ret = patch_text(ip, new_insns, ninsns);
      |                       ^~~~~~~~~~
Fixes 596f2e6f9cf4 ("riscv, bpf: Add bpf_arch_text_poke support for RV64")
Cc Pu Lehui <[email protected]>
Cc Luke Nelson <[email protected]>
Cc Xi Wang <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Daniel Borkmann <[email protected]>
Cc John Fastabend <[email protected]>
Cc Andrii Nakryiko <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Albert Ou <[email protected]>
Cc "Björn Töpel" <[email protected]>
Quoted 3 lines

---
v2: add header file directly to bpf_jit_comp64.c (Pu Lehui)
change patch target to bpf (for fixes)

Thanks, Randy!

For the curious; The asm/patch.h file was picked via UPROBES (via PERF_EVENTS=y). For PERF_EVENTS=n, you get the build error.