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
997997 BPF_SK_REUSEPORT_SELECT,
998998 BPF_SK_REUSEPORT_SELECT_OR_MIGRATE,
999999 BPF_PERF_EVENT,
1000+ BPF_TRACE_KPROBE_MULTI,
10001001 __MAX_BPF_ATTACH_TYPE
10011002 };
10021003
@@ -1011,6 +1012,7 @@ enum bpf_link_type { · 8 unmodified lines
10111012 BPF_LINK_TYPE_NETNS = 5,
10121013 BPF_LINK_TYPE_XDP = 6,
10131014 BPF_LINK_TYPE_PERF_EVENT = 7,
1015+ BPF_LINK_TYPE_KPROBE_MULTI = 8,
10141016
10151017 MAX_BPF_LINK_TYPE,
10161018 };
@@ -1118,6 +1120,11 @@ enum bpf_link_type { · 101 unmodified lines
11181120 */
11191121 #define BPF_F_XDP_HAS_FRAGS (1U << 5)
11201122
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+
11211128 /* When BPF ldimm64's insn[0].src_reg != 0 then this can have
11221129 * the following extensions:
11231130 *
@@ -1232,6 +1239,8 @@ enum { · 108 unmodified lines
12321239
12331240 /* If set, run the test on the cpu specified by bpf_attr.test.cpu */
12341241 #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)
12351244
12361245 /* type for BPF_ENABLE_STATS */
12371246 enum bpf_stats_type {
@@ -1393,6 +1402,7 @@ union bpf_attr { · 155 unmodified lines
13931402 __aligned_u64 ctx_out;
13941403 __u32 flags;
13951404 __u32 cpu;
1405+ __u32 batch_size;
13961406 } test;
13971407
13981408 struct { /* anonymous struct used by BPF_*_GET_*_ID */
@@ -1472,6 +1482,13 @@ union bpf_attr { · 73 unmodified lines
14721482 */
14731483 __u64 bpf_cookie;
14741484 } 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;
14751492 };
14761493 } link_create;
14771494
@@ -2299,8 +2316,8 @@ union bpf_attr { · 821 unmodified lines
22992316 * Return
23002317 * The return value depends on the result of the test, and can be:
23012318 *
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.
23042321 * * A negative error code, if an error occurred.
23052322 *
23062323 * long bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags)
@@ -2992,8 +3009,8 @@ union bpf_attr { · 685 unmodified lines
29923009 *
29933010 * # sysctl kernel.perf_event_max_stack=<new value>
29943011 * 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.
29973014 *
29983015 * long bpf_skb_load_bytes_relative(const void *skb, u32 offset, void *to, u32 len, u32 start_header)
29993016 * Description
@@ -4299,8 +4316,8 @@ union bpf_attr { · 1299 unmodified lines
42994316 *
43004317 * # sysctl kernel.perf_event_max_stack=<new value>
43014318 * 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.
43044321 *
43054322 * long bpf_load_hdr_opt(struct bpf_sock_ops *skops, void *searchby_res, u32 len, u64 flags)
43064323 * Description
@@ -5087,23 +5104,22 @@ union bpf_attr { · 780 unmodified lines
50875104 * 0 on success, or a negative error in case of failure. On error
50885105 * *dst* buffer is zeroed out.
50895106 *
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)
50915108 * 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.
50995111 *
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
51025114 * instead.
51035115 *
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*.
51075123 *
51085124 * Only IPv4 and IPv6 skb->protocol are supported.
51095125 *
@@ -5116,7 +5132,17 @@ union bpf_attr { · 6 unmodified lines
51165132 * Return
51175133 * 0 on success.
51185134 * **-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.
51205146 */
51215147 #define __BPF_FUNC_MAPPER(FN) \
51225148 FN(unspec), \
@@ -5311,7 +5337,8 @@ union bpf_attr { · 188 unmodified lines
53115337 FN(xdp_load_bytes), \
53125338 FN(xdp_store_bytes), \
53135339 FN(copy_from_user_task), \
5314− FN(skb_set_delivery_time), \
5340+ FN(skb_set_tstamp), \
5341+ FN(ima_file_hash), \
53155342 /* */
53165343
53175344 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
@@ -5502,9 +5529,12 @@ union { \ · 184 unmodified lines
55025529 } __attribute__((aligned(8)))
55035530
55045531 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+ */
55085538 };
55095539
55105540 /* user accessible mirror of in-kernel sk_buff.
@@ -5547,7 +5577,7 @@ struct __sk_buff { · 36 unmodified lines
55475577 __u32 gso_segs;
55485578 __bpf_md_ptr(struct bpf_sock *, sk);
55495579 __u32 gso_size;
5550− __u8 delivery_time_type;
5580+ __u8 tstamp_type;
55515581 __u32 :24; /* Padding, future use. */
55525582 __u64 hwtstamp;
55535583 };