From 18760ed77c0da6e2bcb29109739ccc108653db22 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Sun, 22 Oct 2023 19:18:56 +0200 Subject: sys/linux: support new BPF opcode BPF_MEMSX Commit [1] upstream added support for new sign-extended load instructions. Those instructions rely on a new mode, BPF_MEMSX, for the opcode. This commit adds that mode to the BPF description. Note that several other instructions were defined at the same type, but our BPF instruction descriptions are currently generic enough that no other changes are needed. In the future, we may want to make those descriptions more specific to avoid wasting fuzzing time on unsupported instruction formats. 1 - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1f9a1ea821ff Signed-off-by: Paul Chaignon --- sys/linux/bpf.txt | 3 ++- sys/linux/bpf.txt.const | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'sys/linux') diff --git a/sys/linux/bpf.txt b/sys/linux/bpf.txt index f4b018ada..169d5aef0 100644 --- a/sys/linux/bpf.txt +++ b/sys/linux/bpf.txt @@ -412,7 +412,7 @@ type bpf_insn_st64_reg[SRC, DST, OFF] bpf_insn_ldst_t[const, BPF_STX, const, BPF bpf_ldst_insn = BPF_LD, BPF_LDX, BPF_ST, BPF_STX bpf_ldst_size = BPF_W0, BPF_H0, BPF_B0, BPF_DW0 -bpf_ldst_mode = BPF_IMM0, BPF_ABS0, BPF_IND0, BPF_MEM0, BPF_XADD0 +bpf_ldst_mode = BPF_IMM0, BPF_ABS0, BPF_IND0, BPF_MEM0, BPF_XADD0, BPF_MEMSX0 define BPF_W0 BPF_W >> 3 define BPF_H0 BPF_H >> 3 @@ -424,6 +424,7 @@ define BPF_ABS0 BPF_ABS >> 5 define BPF_IND0 BPF_IND >> 5 define BPF_MEM0 BPF_MEM >> 5 define BPF_XADD0 BPF_XADD >> 5 +define BPF_MEMSX0 BPF_MEMSX >> 5 type bpf_insn_alu_t[CLASS_TYPE, CLASS, SOURCE_TYPE, SOURCE, OP_TYPE, OP, DST, SRC, OFF, IMM] { code_class CLASS_TYPE[CLASS, int8:3] diff --git a/sys/linux/bpf.txt.const b/sys/linux/bpf.txt.const index 07c73dece..d2c3c5722 100644 --- a/sys/linux/bpf.txt.const +++ b/sys/linux/bpf.txt.const @@ -174,6 +174,7 @@ BPF_MAP_TYPE_XSKMAP = 17 BPF_MAP_UPDATE_BATCH = 26 BPF_MAP_UPDATE_ELEM = 2 BPF_MEM0 = 3 +BPF_MEMSX0 = 4 BPF_MOD0 = 9 BPF_MODIFY_RETURN = 26 BPF_MOV0 = 11 @@ -269,12 +270,12 @@ BPF_TRACE_KPROBE_MULTI = 42 BPF_TRACE_RAW_TP = 23 BPF_TRACE_UPROBE_MULTI = 48 BPF_W0 = 0 +BPF_X0 = 1 BPF_XADD0 = 6 BPF_XDP = 37 BPF_XDP_CPUMAP = 35 BPF_XDP_DEVMAP = 33 BPF_XOR0 = 10 -BPF_X0 = 1 BTF_INT_BOOL = 4 BTF_INT_CHAR = 2 BTF_INT_SIGNED = 1 -- cgit mrf-deployment