History

Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

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 ... ====================

Jakub Kicinski committed 4 years ago

Commit 0db86402 parents 4a0cb83 7f0059b143 files · +7123 −1092Browse files

Showing the changes to include/uapi (1 of 143 files). Show all

Unified · Split

include/uapi/linux/bpf.h+55−25
@@ -997,6 +997,7 @@ enum bpf_attach_type { · 996 unmodified lines
997 BPF_SK_REUSEPORT_SELECT,997 BPF_SK_REUSEPORT_SELECT,
998 BPF_SK_REUSEPORT_SELECT_OR_MIGRATE,998 BPF_SK_REUSEPORT_SELECT_OR_MIGRATE,
999 BPF_PERF_EVENT,999 BPF_PERF_EVENT,
1000 BPF_TRACE_KPROBE_MULTI,
1000 __MAX_BPF_ATTACH_TYPE1001 __MAX_BPF_ATTACH_TYPE
1001};1002};
1002 1003
@@ -1011,6 +1012,7 @@ enum bpf_link_type { · 8 unmodified lines
1011 BPF_LINK_TYPE_NETNS = 5,1012 BPF_LINK_TYPE_NETNS = 5,
1012 BPF_LINK_TYPE_XDP = 6,1013 BPF_LINK_TYPE_XDP = 6,
1013 BPF_LINK_TYPE_PERF_EVENT = 7,1014 BPF_LINK_TYPE_PERF_EVENT = 7,
1015 BPF_LINK_TYPE_KPROBE_MULTI = 8,
1014 1016
1015 MAX_BPF_LINK_TYPE,1017 MAX_BPF_LINK_TYPE,
1016};1018};
@@ -1118,6 +1120,11 @@ enum bpf_link_type { · 101 unmodified lines
1118 */1120 */
1119#define BPF_F_XDP_HAS_FRAGS (1U << 5)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/* When BPF ldimm64's insn[0].src_reg != 0 then this can have1128/* When BPF ldimm64's insn[0].src_reg != 0 then this can have
1122 * the following extensions:1129 * the following extensions:
1123 *1130 *
@@ -1232,6 +1239,8 @@ enum { · 108 unmodified lines
1232 1239
1233/* If set, run the test on the cpu specified by bpf_attr.test.cpu */1240/* If set, run the test on the cpu specified by bpf_attr.test.cpu */
1234#define BPF_F_TEST_RUN_ON_CPU (1U << 0)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/* type for BPF_ENABLE_STATS */1245/* type for BPF_ENABLE_STATS */
1237enum bpf_stats_type {1246enum bpf_stats_type {
@@ -1393,6 +1402,7 @@ union bpf_attr { · 155 unmodified lines
1393 __aligned_u64 ctx_out;1402 __aligned_u64 ctx_out;
1394 __u32 flags;1403 __u32 flags;
1395 __u32 cpu;1404 __u32 cpu;
1405 __u32 batch_size;
1396 } test;1406 } test;
1397 1407
1398 struct { /* anonymous struct used by BPF_*_GET_*_ID */1408 struct { /* anonymous struct used by BPF_*_GET_*_ID */
@@ -1472,6 +1482,13 @@ union bpf_attr { · 73 unmodified lines
1472 */1482 */
1473 __u64 bpf_cookie;1483 __u64 bpf_cookie;
1474 } perf_event;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 } link_create;1493 } link_create;
1477 1494
@@ -2299,8 +2316,8 @@ union bpf_attr { · 821 unmodified lines
2299 * Return2316 * Return
2300 * The return value depends on the result of the test, and can be: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.2319 * * 1, if current task belongs to the cgroup2.
2303 * * 1, if current task does not belong to the cgroup2.2320 * * 0, if current task does not belong to the cgroup2.
2304 * * A negative error code, if an error occurred.2321 * * A negative error code, if an error occurred.
2305 *2322 *
2306 * long bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags)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 * # sysctl kernel.perf_event_max_stack=<new value>3010 * # sysctl kernel.perf_event_max_stack=<new value>
2994 * Return3011 * Return
2995 * A non-negative value equal to or less than *size* on success,3012 * The non-negative copied *buf* length equal to or less than
2996 * or a negative error in case of failure.3013 * *size* on success, or a negative error in case of failure.
2997 *3014 *
2998 * long bpf_skb_load_bytes_relative(const void *skb, u32 offset, void *to, u32 len, u32 start_header)3015 * long bpf_skb_load_bytes_relative(const void *skb, u32 offset, void *to, u32 len, u32 start_header)
2999 * Description3016 * Description
@@ -4299,8 +4316,8 @@ union bpf_attr { · 1299 unmodified lines
4299 *4316 *
4300 * # sysctl kernel.perf_event_max_stack=<new value>4317 * # sysctl kernel.perf_event_max_stack=<new value>
4301 * Return4318 * Return
4302 * A non-negative value equal to or less than *size* on success,4319 * The non-negative copied *buf* length equal to or less than
4303 * or a negative error in case of failure.4320 * *size* on success, or a negative error in case of failure.
4304 *4321 *
4305 * long bpf_load_hdr_opt(struct bpf_sock_ops *skops, void *searchby_res, u32 len, u64 flags)4322 * long bpf_load_hdr_opt(struct bpf_sock_ops *skops, void *searchby_res, u32 len, u64 flags)
4306 * Description4323 * Description
@@ -5087,23 +5104,22 @@ union bpf_attr { · 780 unmodified lines
5087 * 0 on success, or a negative error in case of failure. On error5104 * 0 on success, or a negative error in case of failure. On error
5088 * *dst* buffer is zeroed out.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 * Description5108 * Description
5092 * Set a *dtime* (delivery time) to the __sk_buff->tstamp and also5109 * Change the __sk_buff->tstamp_type to *tstamp_type*
5093 * change the __sk_buff->delivery_time_type to *dtime_type*.5110 * and set *tstamp* to the __sk_buff->tstamp together.
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_*().
5099 *5111 *
5100 * If there is no need to change the __sk_buff->delivery_time_type,5112 * If there is no need to change the __sk_buff->tstamp_type,
5101 * the delivery time can be directly written to __sk_buff->tstamp5113 * the tstamp value can be directly written to __sk_buff->tstamp
5102 * instead.5114 * instead.
5103 *5115 *
5104 * *dtime* 0 and *dtime_type* BPF_SKB_DELIVERY_TIME_NONE5116 * BPF_SKB_TSTAMP_DELIVERY_MONO is the only tstamp that
5105 * can be used to clear any delivery time stored in5117 * will be kept during bpf_redirect_*(). A non zero
5106 * __sk_buff->tstamp.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 * Only IPv4 and IPv6 skb->protocol are supported.5124 * Only IPv4 and IPv6 skb->protocol are supported.
5109 *5125 *
@@ -5116,7 +5132,17 @@ union bpf_attr { · 6 unmodified lines
5116 * Return5132 * Return
5117 * 0 on success.5133 * 0 on success.
5118 * **-EINVAL** for invalid input5134 * **-EINVAL** for invalid input
5119 * **-EOPNOTSUPP** for unsupported delivery_time_type and protocol5135 * **-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#define __BPF_FUNC_MAPPER(FN) \5147#define __BPF_FUNC_MAPPER(FN) \
5122 FN(unspec), \5148 FN(unspec), \
@@ -5311,7 +5337,8 @@ union bpf_attr { · 188 unmodified lines
5311 FN(xdp_load_bytes), \5337 FN(xdp_load_bytes), \
5312 FN(xdp_store_bytes), \5338 FN(xdp_store_bytes), \
5313 FN(copy_from_user_task), \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/* integer value in 'imm' field of BPF_CALL instruction selects which helper5344/* integer value in 'imm' field of BPF_CALL instruction selects which helper
@@ -5502,9 +5529,12 @@ union { \ · 184 unmodified lines
5502} __attribute__((aligned(8)))5529} __attribute__((aligned(8)))
5503 5530
5504enum {5531enum {
5505 BPF_SKB_DELIVERY_TIME_NONE,5532 BPF_SKB_TSTAMP_UNSPEC,
5506 BPF_SKB_DELIVERY_TIME_UNSPEC,5533 BPF_SKB_TSTAMP_DELIVERY_MONO, /* tstamp has mono delivery time */
5507 BPF_SKB_DELIVERY_TIME_MONO,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/* user accessible mirror of in-kernel sk_buff.5540/* user accessible mirror of in-kernel sk_buff.
@@ -5547,7 +5577,7 @@ struct __sk_buff { · 36 unmodified lines
5547 __u32 gso_segs;5577 __u32 gso_segs;
5548 __bpf_md_ptr(struct bpf_sock *, sk);5578 __bpf_md_ptr(struct bpf_sock *, sk);
5549 __u32 gso_size;5579 __u32 gso_size;
5550 __u8 delivery_time_type;5580 __u8 tstamp_type;
5551 __u32 :24; /* Padding, future use. */5581 __u32 :24; /* Padding, future use. */
5552 __u64 hwtstamp;5582 __u64 hwtstamp;
5553};5583};