From 709979145c8aad814397b9314d5bd44d9e2ccc1d Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Mon, 9 Sep 2024 19:39:22 +0200 Subject: sys/linux: improve precision of BPF attach targets How the attach target field is interpreted depends on the program type [1], which itself depends on the attach type [2] (defined in attach_type_to_prog_type upstream). This commit encodes the same in syzkaller to make the attach target field more precise. Because attach_type_to_prog_type is a simple n to 1 mapping, we can encode it as defines. We can then use those defines in conditional fields for the different types of attach targets. 1 - https://elixir.bootlin.com/linux/v6.10.9/source/kernel/bpf/syscall.c#L4098 2 - https://elixir.bootlin.com/linux/v6.10.9/source/kernel/bpf/syscall.c#L3913 Signed-off-by: Paul Chaignon --- sys/linux/bpf.txt.const | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sys/linux/bpf.txt.const') diff --git a/sys/linux/bpf.txt.const b/sys/linux/bpf.txt.const index c95f44494..7b2885431 100644 --- a/sys/linux/bpf.txt.const +++ b/sys/linux/bpf.txt.const @@ -242,6 +242,24 @@ BTF_KIND_VAR = 14 BTF_KIND_VOLATILE = 9 BTF_MAGIC = 60319 BTF_VERSION = 1 +EXP_CGROUP = 63 +EXP_MAP = 39 +EXP_TYPE_CGROUP_DEVICE = 6 +EXP_TYPE_CGROUP_SKB = 1 +EXP_TYPE_CGROUP_SOCK = 47 +EXP_TYPE_CGROUP_SOCKOPT = 23 +EXP_TYPE_CGROUP_SOCK_ADDR = 63 +EXP_TYPE_CGROUP_SYSCTL = 18 +EXP_TYPE_FLOW_DISSECTOR = 17 +EXP_TYPE_LIRC_MODE2 = 16 +EXP_TYPE_LSM = 59 +EXP_TYPE_SCHED_CLS = 63 +EXP_TYPE_SK_LOOKUP = 36 +EXP_TYPE_SK_MSG = 7 +EXP_TYPE_SK_SKB = 39 +EXP_TYPE_SOCK_OPS = 3 +EXP_TYPE_TRACING = 31 +EXP_TYPE_XDP = 37 MAX_FUNCINFO_REC_SIZE = 252 MIN_BPF_FUNCINFO_SIZE = 8 NF_NETDEV_EGRESS = 1 -- cgit mrf-deployment