All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] libbpf: fix AF_XDP helper program to support kernels without the JMP32 eBPF instruction class
@ 2019-12-19 20:16 Alex Forster
  2019-12-19 22:07 ` Alexei Starovoitov
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Forster @ 2019-12-19 20:16 UTC (permalink / raw)
  To: netdev; +Cc: Alex Forster, Alexei Starovoitov, Björn Töpel

Kernel 5.1 introduced support for the JMP32 eBPF instruction class, and commit d7d962a modified the libbpf AF_XDP helper program to use the BPF_JMP32_IMM instruction. For those on earlier kernels, attempting to load the helper program now results in the verifier failing with "unknown opcode 66". This change replaces the usage of BPF_JMP32_IMM with BPF_JMP_IMM for compatibility with pre-5.1 kernels.

Signed-off-by: Alex Forster <aforster@cloudflare.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Björn Töpel <bjorn.topel@intel.com>
---
 tools/lib/bpf/xsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index 8e0ffa800a71..761f8485b80e 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -366,7 +366,7 @@ static int xsk_load_xdp_prog(struct xsk_socket *xsk)
 		/* call bpf_redirect_map */
 		BPF_EMIT_CALL(BPF_FUNC_redirect_map),
 		/* if w0 != 0 goto pc+13 */
-		BPF_JMP32_IMM(BPF_JSGT, BPF_REG_0, 0, 13),
+		BPF_JMP_IMM(BPF_JSGT, BPF_REG_0, 0, 13),
 		/* r2 = r10 */
 		BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
 		/* r2 += -4 */
-- 
2.23.0


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

end of thread, other threads:[~2019-12-20 20:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-19 20:16 [PATCH bpf-next] libbpf: fix AF_XDP helper program to support kernels without the JMP32 eBPF instruction class Alex Forster
2019-12-19 22:07 ` Alexei Starovoitov
2019-12-19 22:29   ` Alex Forster
2019-12-20  7:20     ` Björn Töpel
2019-12-20 20:22       ` Daniel Borkmann

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.