Pull bpf updates from Alexei Starovoitov: "Major changes: - Recover from BPF arena page faults using a scratch page and add ptep_try_set() for lockless empty-slot installs on x86 and arm64. This allows BPF kfuncs to access arena pointers directly. The 'arena_direct_access' stable branch was created for this work and was pulled into sched-ext and bpf-next trees (Tejun Heo, Kumar Kartikeya Dwivedi) - Lift old restriction and support 6+ arguments in BPF programs and kfuncs on x86 and arm64 (Yonghong Song, Puranjay Mohan) Other features and fixes: - Add 24-bit BTF vlen and reclaim unused bits in the BTF UAPI to ease addition of new BTF kinds (Alan Maguire) - Raise the maximum BPF call chain depth from 8 to 16 frames (Alexei Starovoitov) - Refactor object relationship tracking in the verifier and fix a dynptr use-after-free bug (Amery Hung) - Harden the signed program loader and reject exclusive maps as inner maps (Daniel Borkmann) - Replace the verifier min/max bounds fields with a circular number (cnum) representation and improve 32->64 bit range refinements (Eduard Zingerman) - Introduce the arena library and runtime (libarena) with a buddy allocator, rbtree and SPMC queue data structures, ASAN support and a parallel test harness. Allow subprograms to return arena pointers and switch to a BTF type-tag based __arena annotation (Emil Tsalapatis) - Cache build IDs in the sleepable stackmap path and avoid faultable build ID reads under mm locks (Ihor Solodrai) - Introduce the tracing_multi link to attach a single BPF program to many kernel functions at once. Allow specifying the uprobe_multi target via FD (Jiri Olsa) - Extend the bpf_list family of kfuncs with bpf_list_add/del(), and bpf_list_is_first/is_last/empty() (Kaitao Cheng) - Extend the BPF syscall with common attributes support for prog_load, btf_load and map_create (Leon Hwang) - Wrap rhashtable as BPF map (Mykyta Yatsenko, Herbert Xu) - Add sleepable support for tracepoint programs and fix deadlocks in LRU map due to NMI reentry (Mykyta Yatsenko) - Fix OOB access in bpf_flow_keys, fix nullness analysis of inner arrays, enforce write checks for global subprograms (Nuoqi Gui) - Report the maximum combined stack depth and print a breakdown of instructions processed per subprogram (Paul Chaignon) - Add an XDP load-balancer benchmark and arm64 JIT support for stack arguments (Puranjay Mohan) - Add kfuncs to traverse over wakeup_sources (Samuel Wu) - Allow sleepable BPF programs to use LPM trie maps directly (Vlad Poenaru) - Many more fixes and cleanups across the verifier, BTF, sockmap, devmap, bpffs, security hooks, s390/riscv/loongarch JITs, rqspinlock, libbpf, bpftool, selftests" * tag 'bpf-next-7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (336 commits) selftests/bpf: Work around llvm stack overflow in crypto progs selftests/bpf: add test for bpf_msg_pop_data() overflow bpf, sockmap: fix integer overflow in bpf_msg_pop_data() bounds check sockmap: Fix use-after-free in udp_bpf_recvmsg() bpf, sockmap: keep sk_msg copy state in sync bpf, sockmap: Fix wrong rsge offset in bpf_msg_push_data() bpf, sockmap: reject overflowing copy + len in bpf_msg_push_data() selftsets/bpf: Retry map update on helper_fill_hashmap() selftests/bpf: Add test for sleepable lsm_cgroup rejection selftests/bpf: Add test to verify the fix for bpf_setsockopt() helper bpf: Fix bpf_get/setsockopt to tos for ipv4-mapped ipv6 socket selftests/bpf: Avoid static LLVM linking for cross builds selftests/bpf: Use common CFLAGS for urandom_read selftests/bpf: Initialize operation name before use tools/bpf: build: Append extra cflags libbpf: Initialize CFLAGS before including Makefile.include bpftool: Append extra host flags bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS bpftool: Pass host flags to bootstrap libbpf selftests/bpf: correct CONFIG_PPC64 macro name in comment ...
Showing the changes to include/uapi/linux (2 of 349 files). Show all
Unified · Split
| @@ -994,6 +994,7 @@ enum bpf_cmd { · 993 unmodified lines | ||
| 994 | 994 | BPF_PROG_STREAM_READ_BY_FD, |
| 995 | 995 | BPF_PROG_ASSOC_STRUCT_OPS, |
| 996 | 996 | __MAX_BPF_CMD, |
| 997 | + BPF_COMMON_ATTRS = 1 << 16, /* Indicate carrying syscall common attrs. */ | |
| 997 | 998 | }; |
| 998 | 999 | |
| 999 | 1000 | enum bpf_map_type { |
| @@ -1046,6 +1047,7 @@ enum bpf_map_type { · 46 unmodified lines | ||
| 1046 | 1047 | BPF_MAP_TYPE_CGRP_STORAGE, |
| 1047 | 1048 | BPF_MAP_TYPE_ARENA, |
| 1048 | 1049 | BPF_MAP_TYPE_INSN_ARRAY, |
| 1050 | + BPF_MAP_TYPE_RHASH, | |
| 1049 | 1051 | __MAX_BPF_MAP_TYPE |
| 1050 | 1052 | }; |
| 1051 | 1053 | |
| @@ -1154,6 +1156,9 @@ enum bpf_attach_type { · 102 unmodified lines | ||
| 1154 | 1156 | BPF_TRACE_KPROBE_SESSION, |
| 1155 | 1157 | BPF_TRACE_UPROBE_SESSION, |
| 1156 | 1158 | BPF_TRACE_FSESSION, |
| 1159 | + BPF_TRACE_FENTRY_MULTI, | |
| 1160 | + BPF_TRACE_FEXIT_MULTI, | |
| 1161 | + BPF_TRACE_FSESSION_MULTI, | |
| 1157 | 1162 | __MAX_BPF_ATTACH_TYPE |
| 1158 | 1163 | }; |
| 1159 | 1164 | |
| @@ -1178,6 +1183,7 @@ enum bpf_link_type { · 18 unmodified lines | ||
| 1178 | 1183 | BPF_LINK_TYPE_UPROBE_MULTI = 12, |
| 1179 | 1184 | BPF_LINK_TYPE_NETKIT = 13, |
| 1180 | 1185 | BPF_LINK_TYPE_SOCKMAP = 14, |
| 1186 | + BPF_LINK_TYPE_TRACING_MULTI = 15, | |
| 1181 | 1187 | __MAX_BPF_LINK_TYPE, |
| 1182 | 1188 | }; |
| 1183 | 1189 | |
| @@ -1321,7 +1327,11 @@ enum { · 137 unmodified lines | ||
| 1321 | 1327 | * BPF_TRACE_UPROBE_MULTI attach type to create return probe. |
| 1322 | 1328 | */ |
| 1323 | 1329 | enum { |
| 1324 | − BPF_F_UPROBE_MULTI_RETURN = (1U << 0) | |
| 1330 | + /* Get return uprobe. */ | |
| 1331 | + BPF_F_UPROBE_MULTI_RETURN = (1U << 0), | |
| 1332 | + | |
| 1333 | + /* Get path from provided path_fd. */ | |
| 1334 | + BPF_F_UPROBE_MULTI_PATH_FD = (1U << 1), | |
| 1325 | 1335 | }; |
| 1326 | 1336 | |
| 1327 | 1337 | /* link_create.netfilter.flags used in LINK_CREATE command for |
| @@ -1500,6 +1510,13 @@ struct bpf_stack_build_id { · 172 unmodified lines | ||
| 1500 | 1510 | }; |
| 1501 | 1511 | }; |
| 1502 | 1512 | |
| 1513 | +struct bpf_common_attr { | |
| 1514 | + __aligned_u64 log_buf; | |
| 1515 | + __u32 log_size; | |
| 1516 | + __u32 log_level; | |
| 1517 | + __u32 log_true_size; | |
| 1518 | +}; | |
| 1519 | + | |
| 1503 | 1520 | #define BPF_OBJ_NAME_LEN 16U |
| 1504 | 1521 | |
| 1505 | 1522 | enum { |
| @@ -1537,6 +1554,11 @@ union bpf_attr { · 31 unmodified lines | ||
| 1537 | 1554 | * |
| 1538 | 1555 | * BPF_MAP_TYPE_ARENA - contains the address where user space |
| 1539 | 1556 | * is going to mmap() the arena. It has to be page aligned. |
| 1557 | + * | |
| 1558 | + * BPF_MAP_TYPE_RHASH - initial table size hint | |
| 1559 | + * (nelem_hint). 0 = use rhashtable default. Must be | |
| 1560 | + * <= min(max_entries, U16_MAX). Upper 32 bits reserved, | |
| 1561 | + * must be zero. | |
| 1540 | 1562 | */ |
| 1541 | 1563 | __u64 map_extra; |
| 1542 | 1564 | |
| @@ -1846,6 +1868,7 @@ union bpf_attr { · 303 unmodified lines | ||
| 1846 | 1868 | __u32 cnt; |
| 1847 | 1869 | __u32 flags; |
| 1848 | 1870 | __u32 pid; |
| 1871 | + __u32 path_fd; | |
| 1849 | 1872 | } uprobe_multi; |
| 1850 | 1873 | struct { |
| 1851 | 1874 | union { |
| @@ -1861,6 +1884,11 @@ union bpf_attr { · 9 unmodified lines | ||
| 1861 | 1884 | }; |
| 1862 | 1885 | __u64 expected_revision; |
| 1863 | 1886 | } cgroup; |
| 1887 | + struct { | |
| 1888 | + __aligned_u64 ids; | |
| 1889 | + __aligned_u64 cookies; | |
| 1890 | + __u32 cnt; | |
| 1891 | + } tracing_multi; | |
| 1864 | 1892 | }; |
| 1865 | 1893 | } link_create; |
| 1866 | 1894 | |
| @@ -6698,6 +6726,7 @@ struct bpf_prog_info { · 4831 unmodified lines | ||
| 6698 | 6726 | __u32 verified_insns; |
| 6699 | 6727 | __u32 attach_btf_obj_id; |
| 6700 | 6728 | __u32 attach_btf_id; |
| 6729 | + __u32 :32; | |
| 6701 | 6730 | } __attribute__((aligned(8))); |
| 6702 | 6731 | |
| 6703 | 6732 | struct bpf_map_info { |
| @@ -6719,6 +6748,7 @@ struct bpf_map_info { · 15 unmodified lines | ||
| 6719 | 6748 | __u64 map_extra; |
| 6720 | 6749 | __aligned_u64 hash; |
| 6721 | 6750 | __u32 hash_size; |
| 6751 | + __u32 :32; | |
| 6722 | 6752 | } __attribute__((aligned(8))); |
| 6723 | 6753 | |
| 6724 | 6754 | struct bpf_btf_info { |
| @@ -33,20 +33,22 @@ struct btf_header { · 32 unmodified lines | ||
| 33 | 33 | __u32 layout_len; /* length of layout section */ |
| 34 | 34 | }; |
| 35 | 35 | |
| 36 | −/* Max # of type identifier */ | |
| 37 | −#define BTF_MAX_TYPE 0x000fffff | |
| 38 | −/* Max offset into the string section */ | |
| 39 | −#define BTF_MAX_NAME_OFFSET 0x00ffffff | |
| 40 | −/* Max # of struct/union/enum members or func args */ | |
| 41 | −#define BTF_MAX_VLEN 0xffff | |
| 36 | +enum btf_max { | |
| 37 | + /* Max possible kind */ | |
| 38 | + BTF_MAX_KIND = 0x0000007f, | |
| 39 | + /* Max # of type identifier */ | |
| 40 | + BTF_MAX_TYPE = 0x000fffff, | |
| 41 | + /* Max offset into the string section */ | |
| 42 | + BTF_MAX_NAME_OFFSET = 0x00ffffff, | |
| 43 | + /* Max # of struct/union/enum members or func args */ | |
| 44 | + BTF_MAX_VLEN = 0x00ffffff, | |
| 45 | +}; | |
| 42 | 46 | |
| 43 | 47 | struct btf_type { |
| 44 | 48 | __u32 name_off; |
| 45 | 49 | /* "info" bits arrangement |
| 46 | − * bits 0-15: vlen (e.g. # of struct's members) | |
| 47 | − * bits 16-23: unused | |
| 48 | − * bits 24-28: kind (e.g. int, ptr, array...etc) | |
| 49 | − * bits 29-30: unused | |
| 50 | + * bits 0-23: vlen (e.g. # of struct's members) | |
| 51 | + * bits 24-30: kind (e.g. int, ptr, array...etc) | |
| 50 | 52 | * bit 31: kind_flag, currently used by |
| 51 | 53 | * struct, union, enum, fwd, enum64, |
| 52 | 54 | * decl_tag and type_tag |
| @@ -65,8 +67,8 @@ struct btf_type { · 12 unmodified lines | ||
| 65 | 67 | }; |
| 66 | 68 | }; |
| 67 | 69 | |
| 68 | −#define BTF_INFO_KIND(info) (((info) >> 24) & 0x1f) | |
| 69 | −#define BTF_INFO_VLEN(info) ((info) & 0xffff) | |
| 70 | +#define BTF_INFO_KIND(info) (((info) >> 24) & 0x7f) | |
| 71 | +#define BTF_INFO_VLEN(info) ((info) & 0xffffff) | |
| 70 | 72 | #define BTF_INFO_KFLAG(info) ((info) >> 31) |
| 71 | 73 | |
| 72 | 74 | enum { |