Alexei Starovoitov says: ==================== pull-request: bpf-next 2022-03-21 v2 We've added 137 non-merge commits during the last 17 day(s) which contain a total of 143 files changed, 7123 insertions(+), 1092 deletions(-). The main changes are: 1) Custom SEC() handling in libbpf, from Andrii. 2) subskeleton support, from Delyan. 3) Use btf_tag to recognize __percpu pointers in the verifier, from Hao. 4) Fix net.core.bpf_jit_harden race, from Hou. 5) Fix bpf_sk_lookup remote_port on big-endian, from Jakub. 6) Introduce fprobe (multi kprobe) _without_ arch bits, from Masami. The arch specific bits will come later. 7) Introduce multi_kprobe bpf programs on top of fprobe, from Jiri. 8) Enable non-atomic allocations in local storage, from Joanne. 9) Various var_off ptr_to_btf_id fixed, from Kumar. 10) bpf_ima_file_hash helper, from Roberto. 11) Add "live packet" mode for XDP in BPF_PROG_RUN, from Toke. * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (137 commits) selftests/bpf: Fix kprobe_multi test. Revert "rethook: x86: Add rethook x86 implementation" Revert "arm64: rethook: Add arm64 rethook implementation" Revert "powerpc: Add rethook support" Revert "ARM: rethook: Add rethook arm implementation" bpftool: Fix a bug in subskeleton code generation bpf: Fix bpf_prog_pack when PMU_SIZE is not defined bpf: Fix bpf_prog_pack for multi-node setup bpf: Fix warning for cast from restricted gfp_t in verifier bpf, arm: Fix various typos in comments libbpf: Close fd in bpf_object__reuse_map bpftool: Fix print error when show bpf map bpf: Fix kprobe_multi return probe backtrace Revert "bpf: Add support to inline bpf_get_func_ip helper on x86" bpf: Simplify check in btf_parse_hdr() selftests/bpf/test_lirc_mode2.sh: Exit with proper code bpf: Check for NULL return from bpf_get_btf_vmlinux selftests/bpf: Test skipping stacktrace bpf: Adjust BPF stack helper functions to accommodate skip > 0 bpf: Select proper size for bpf_prog_pack ... ====================
Showing the changes to include/uapi (1 of 143 files). Show all
Unified · Split
| @@ -997,6 +997,7 @@ enum bpf_attach_type { · 996 unmodified lines | ||
| 997 | 997 | BPF_SK_REUSEPORT_SELECT, |
| 998 | 998 | BPF_SK_REUSEPORT_SELECT_OR_MIGRATE, |
| 999 | 999 | BPF_PERF_EVENT, |
| 1000 | + BPF_TRACE_KPROBE_MULTI, | |
| 1000 | 1001 | __MAX_BPF_ATTACH_TYPE |
| 1001 | 1002 | }; |
| 1002 | 1003 | |
| @@ -1011,6 +1012,7 @@ enum bpf_link_type { · 8 unmodified lines | ||
| 1011 | 1012 | BPF_LINK_TYPE_NETNS = 5, |
| 1012 | 1013 | BPF_LINK_TYPE_XDP = 6, |
| 1013 | 1014 | BPF_LINK_TYPE_PERF_EVENT = 7, |
| 1015 | + BPF_LINK_TYPE_KPROBE_MULTI = 8, | |
| 1014 | 1016 | |
| 1015 | 1017 | MAX_BPF_LINK_TYPE, |
| 1016 | 1018 | }; |
| @@ -1118,6 +1120,11 @@ enum bpf_link_type { · 101 unmodified lines | ||
| 1118 | 1120 | */ |
| 1119 | 1121 | #define BPF_F_XDP_HAS_FRAGS (1U << 5) |
| 1120 | 1122 | |
| 1123 | +/* link_create.kprobe_multi.flags used in LINK_CREATE command for | |
| 1124 | + * BPF_TRACE_KPROBE_MULTI attach type to create return probe. | |
| 1125 | + */ | |
| 1126 | +#define BPF_F_KPROBE_MULTI_RETURN (1U << 0) | |
| 1127 | + | |
| 1121 | 1128 | /* When BPF ldimm64's insn[0].src_reg != 0 then this can have |
| 1122 | 1129 | * the following extensions: |
| 1123 | 1130 | * |
| @@ -1232,6 +1239,8 @@ enum { · 108 unmodified lines | ||
| 1232 | 1239 | |
| 1233 | 1240 | /* If set, run the test on the cpu specified by bpf_attr.test.cpu */ |
| 1234 | 1241 | #define BPF_F_TEST_RUN_ON_CPU (1U << 0) |
| 1242 | +/* If set, XDP frames will be transmitted after processing */ | |
| 1243 | +#define BPF_F_TEST_XDP_LIVE_FRAMES (1U << 1) | |
| 1235 | 1244 | |
| 1236 | 1245 | /* type for BPF_ENABLE_STATS */ |
| 1237 | 1246 | enum bpf_stats_type { |
| @@ -1393,6 +1402,7 @@ union bpf_attr { · 155 unmodified lines | ||
| 1393 | 1402 | __aligned_u64 ctx_out; |
| 1394 | 1403 | __u32 flags; |
| 1395 | 1404 | __u32 cpu; |
| 1405 | + __u32 batch_size; | |
| 1396 | 1406 | } test; |
| 1397 | 1407 | |
| 1398 | 1408 | struct { /* anonymous struct used by BPF_*_GET_*_ID */ |
| @@ -1472,6 +1482,13 @@ union bpf_attr { · 73 unmodified lines | ||
| 1472 | 1482 | */ |
| 1473 | 1483 | __u64 bpf_cookie; |
| 1474 | 1484 | } perf_event; |
| 1485 | + struct { | |
| 1486 | + __u32 flags; | |
| 1487 | + __u32 cnt; | |
| 1488 | + __aligned_u64 syms; | |
| 1489 | + __aligned_u64 addrs; | |
| 1490 | + __aligned_u64 cookies; | |
| 1491 | + } kprobe_multi; | |
| 1475 | 1492 | }; |
| 1476 | 1493 | } link_create; |
| 1477 | 1494 | |
| @@ -2299,8 +2316,8 @@ union bpf_attr { · 821 unmodified lines | ||
| 2299 | 2316 | * Return |
| 2300 | 2317 | * The return value depends on the result of the test, and can be: |
| 2301 | 2318 | * |
| 2302 | − * * 0, if current task belongs to the cgroup2. | |
| 2303 | − * * 1, if current task does not belong to the cgroup2. | |
| 2319 | + * * 1, if current task belongs to the cgroup2. | |
| 2320 | + * * 0, if current task does not belong to the cgroup2. | |
| 2304 | 2321 | * * A negative error code, if an error occurred. |
| 2305 | 2322 | * |
| 2306 | 2323 | * long bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags) |
| @@ -2992,8 +3009,8 @@ union bpf_attr { · 685 unmodified lines | ||
| 2992 | 3009 | * |
| 2993 | 3010 | * # sysctl kernel.perf_event_max_stack=<new value> |
| 2994 | 3011 | * Return |
| 2995 | − * A non-negative value equal to or less than *size* on success, | |
| 2996 | − * or a negative error in case of failure. | |
| 3012 | + * The non-negative copied *buf* length equal to or less than | |
| 3013 | + * *size* on success, or a negative error in case of failure. | |
| 2997 | 3014 | * |
| 2998 | 3015 | * long bpf_skb_load_bytes_relative(const void *skb, u32 offset, void *to, u32 len, u32 start_header) |
| 2999 | 3016 | * Description |
| @@ -4299,8 +4316,8 @@ union bpf_attr { · 1299 unmodified lines | ||
| 4299 | 4316 | * |
| 4300 | 4317 | * # sysctl kernel.perf_event_max_stack=<new value> |
| 4301 | 4318 | * Return |
| 4302 | − * A non-negative value equal to or less than *size* on success, | |
| 4303 | − * or a negative error in case of failure. | |
| 4319 | + * The non-negative copied *buf* length equal to or less than | |
| 4320 | + * *size* on success, or a negative error in case of failure. | |
| 4304 | 4321 | * |
| 4305 | 4322 | * long bpf_load_hdr_opt(struct bpf_sock_ops *skops, void *searchby_res, u32 len, u64 flags) |
| 4306 | 4323 | * Description |
| @@ -5087,23 +5104,22 @@ union bpf_attr { · 780 unmodified lines | ||
| 5087 | 5104 | * 0 on success, or a negative error in case of failure. On error |
| 5088 | 5105 | * *dst* buffer is zeroed out. |
| 5089 | 5106 | * |
| 5090 | − * long bpf_skb_set_delivery_time(struct sk_buff *skb, u64 dtime, u32 dtime_type) | |
| 5107 | + * long bpf_skb_set_tstamp(struct sk_buff *skb, u64 tstamp, u32 tstamp_type) | |
| 5091 | 5108 | * Description |
| 5092 | − * Set a *dtime* (delivery time) to the __sk_buff->tstamp and also | |
| 5093 | − * change the __sk_buff->delivery_time_type to *dtime_type*. | |
| 5094 | − * | |
| 5095 | − * When setting a delivery time (non zero *dtime*) to | |
| 5096 | − * __sk_buff->tstamp, only BPF_SKB_DELIVERY_TIME_MONO *dtime_type* | |
| 5097 | − * is supported. It is the only delivery_time_type that will be | |
| 5098 | − * kept after bpf_redirect_*(). | |
| 5109 | + * Change the __sk_buff->tstamp_type to *tstamp_type* | |
| 5110 | + * and set *tstamp* to the __sk_buff->tstamp together. | |
| 5099 | 5111 | * |
| 5100 | − * If there is no need to change the __sk_buff->delivery_time_type, | |
| 5101 | − * the delivery time can be directly written to __sk_buff->tstamp | |
| 5112 | + * If there is no need to change the __sk_buff->tstamp_type, | |
| 5113 | + * the tstamp value can be directly written to __sk_buff->tstamp | |
| 5102 | 5114 | * instead. |
| 5103 | 5115 | * |
| 5104 | − * *dtime* 0 and *dtime_type* BPF_SKB_DELIVERY_TIME_NONE | |
| 5105 | − * can be used to clear any delivery time stored in | |
| 5106 | − * __sk_buff->tstamp. | |
| 5116 | + * BPF_SKB_TSTAMP_DELIVERY_MONO is the only tstamp that | |
| 5117 | + * will be kept during bpf_redirect_*(). A non zero | |
| 5118 | + * *tstamp* must be used with the BPF_SKB_TSTAMP_DELIVERY_MONO | |
| 5119 | + * *tstamp_type*. | |
| 5120 | + * | |
| 5121 | + * A BPF_SKB_TSTAMP_UNSPEC *tstamp_type* can only be used | |
| 5122 | + * with a zero *tstamp*. | |
| 5107 | 5123 | * |
| 5108 | 5124 | * Only IPv4 and IPv6 skb->protocol are supported. |
| 5109 | 5125 | * |
| @@ -5116,7 +5132,17 @@ union bpf_attr { · 6 unmodified lines | ||
| 5116 | 5132 | * Return |
| 5117 | 5133 | * 0 on success. |
| 5118 | 5134 | * **-EINVAL** for invalid input |
| 5119 | − * **-EOPNOTSUPP** for unsupported delivery_time_type and protocol | |
| 5135 | + * **-EOPNOTSUPP** for unsupported protocol | |
| 5136 | + * | |
| 5137 | + * long bpf_ima_file_hash(struct file *file, void *dst, u32 size) | |
| 5138 | + * Description | |
| 5139 | + * Returns a calculated IMA hash of the *file*. | |
| 5140 | + * If the hash is larger than *size*, then only *size* | |
| 5141 | + * bytes will be copied to *dst* | |
| 5142 | + * Return | |
| 5143 | + * The **hash_algo** is returned on success, | |
| 5144 | + * **-EOPNOTSUP** if the hash calculation failed or **-EINVAL** if | |
| 5145 | + * invalid arguments are passed. | |
| 5120 | 5146 | */ |
| 5121 | 5147 | #define __BPF_FUNC_MAPPER(FN) \ |
| 5122 | 5148 | FN(unspec), \ |
| @@ -5311,7 +5337,8 @@ union bpf_attr { · 188 unmodified lines | ||
| 5311 | 5337 | FN(xdp_load_bytes), \ |
| 5312 | 5338 | FN(xdp_store_bytes), \ |
| 5313 | 5339 | FN(copy_from_user_task), \ |
| 5314 | − FN(skb_set_delivery_time), \ | |
| 5340 | + FN(skb_set_tstamp), \ | |
| 5341 | + FN(ima_file_hash), \ | |
| 5315 | 5342 | /* */ |
| 5316 | 5343 | |
| 5317 | 5344 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |
| @@ -5502,9 +5529,12 @@ union { \ · 184 unmodified lines | ||
| 5502 | 5529 | } __attribute__((aligned(8))) |
| 5503 | 5530 | |
| 5504 | 5531 | enum { |
| 5505 | − BPF_SKB_DELIVERY_TIME_NONE, | |
| 5506 | − BPF_SKB_DELIVERY_TIME_UNSPEC, | |
| 5507 | − BPF_SKB_DELIVERY_TIME_MONO, | |
| 5532 | + BPF_SKB_TSTAMP_UNSPEC, | |
| 5533 | + BPF_SKB_TSTAMP_DELIVERY_MONO, /* tstamp has mono delivery time */ | |
| 5534 | + /* For any BPF_SKB_TSTAMP_* that the bpf prog cannot handle, | |
| 5535 | + * the bpf prog should handle it like BPF_SKB_TSTAMP_UNSPEC | |
| 5536 | + * and try to deduce it by ingress, egress or skb->sk->sk_clockid. | |
| 5537 | + */ | |
| 5508 | 5538 | }; |
| 5509 | 5539 | |
| 5510 | 5540 | /* user accessible mirror of in-kernel sk_buff. |
| @@ -5547,7 +5577,7 @@ struct __sk_buff { · 36 unmodified lines | ||
| 5547 | 5577 | __u32 gso_segs; |
| 5548 | 5578 | __bpf_md_ptr(struct bpf_sock *, sk); |
| 5549 | 5579 | __u32 gso_size; |
| 5550 | − __u8 delivery_time_type; | |
| 5580 | + __u8 tstamp_type; | |
| 5551 | 5581 | __u32 :24; /* Padding, future use. */ |
| 5552 | 5582 | __u64 hwtstamp; |
| 5553 | 5583 | }; |