History

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

Daniel Borkmann says: ==================== pull-request: bpf-next 2020-11-14 1) Add BTF generation for kernel modules and extend BTF infra in kernel e.g. support for split BTF loading and validation, from Andrii Nakryiko. 2) Support for pointers beyond pkt_end to recognize LLVM generated patterns on inlined branch conditions, from Alexei Starovoitov. 3) Implements bpf_local_storage for task_struct for BPF LSM, from KP Singh. 4) Enable FENTRY/FEXIT/RAW_TP tracing program to use the bpf_sk_storage infra, from Martin KaFai Lau. 5) Add XDP bulk APIs that introduce a defer/flush mechanism to optimize the XDP_REDIRECT path, from Lorenzo Bianconi. 6) Fix a potential (although rather theoretical) deadlock of hashtab in NMI context, from Song Liu. 7) Fixes for cross and out-of-tree build of bpftool and runqslower allowing build for different target archs on same source tree, from Jean-Philippe Brucker. 8) Fix error path in htab_map_alloc() triggered from syzbot, from Eric Dumazet. 9) Move functionality from test_tcpbpf_user into the test_progs framework so it can run in BPF CI, from Alexander Duyck. 10) Lift hashtab key_size limit to be larger than MAX_BPF_STACK, from Florian Lehner. Note that for the fix from Song we have seen a sparse report on context imbalance which requires changes in sparse itself for proper annotation detection where this is currently being discussed on linux-sparse among developers [0]. Once we have more clarification/guidance after their fix, Song will follow-up. [0] https://lore.kernel.org/linux-sparse/CAHk-=wh4bx8A8dHnX612MsDO13st6uzAz1mJ1PaHHVevJx_ZCw@mail.gmail.com/T/ https://lore.kernel.org/linux-sparse/20201109221345.uklbp3lzgq6g42zb@ltop.local/T/ * git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (66 commits) net: mlx5: Add xdp tx return bulking support net: mvpp2: Add xdp tx return bulking support net: mvneta: Add xdp tx return bulking support net: page_pool: Add bulk support for ptr_ring net: xdp: Introduce bulking for xdp tx return path bpf: Expose bpf_d_path helper to sleepable LSM hooks bpf: Augment the set of sleepable LSM hooks bpf: selftest: Use bpf_sk_storage in FENTRY/FEXIT/RAW_TP bpf: Allow using bpf_sk_storage in FENTRY/FEXIT/RAW_TP bpf: Rename some functions in bpf_sk_storage bpf: Folding omem_charge() into sk_storage_charge() selftests/bpf: Add asm tests for pkt vs pkt_end comparison. selftests/bpf: Add skb_pkt_end test bpf: Support for pointers beyond pkt_end. tools/bpf: Always run the *-clean recipes tools/bpf: Add bootstrap/ to .gitignore bpf: Fix NULL dereference in bpf_task_storage tools/bpftool: Fix build slowdown tools/runqslower: Build bpftool using HOSTCC tools/runqslower: Enable out-of-tree build ... ====================

Jakub Kicinski committed 5 years ago

Commit 07cbce22 parents 774626f c14d61f83 files · +3907 −1271Browse files

Showing the changes to tools/include/uapi/linux (1 of 83 files). Show all

Unified · Split

tools/include/uapi/linux/bpf.h+51−0
@@ -157,6 +157,7 @@ enum bpf_map_type { · 156 unmodified lines
157157 BPF_MAP_TYPE_STRUCT_OPS,
158158 BPF_MAP_TYPE_RINGBUF,
159159 BPF_MAP_TYPE_INODE_STORAGE,
160+ BPF_MAP_TYPE_TASK_STORAGE,
160161 };
161162
162163 /* Note that tracing related programs such as
@@ -3742,6 +3743,50 @@ union bpf_attr { · 3579 unmodified lines
37423743 * Return
37433744 * The helper returns **TC_ACT_REDIRECT** on success or
37443745 * **TC_ACT_SHOT** on error.
3746+ *
3747+ * void *bpf_task_storage_get(struct bpf_map *map, struct task_struct *task, void *value, u64 flags)
3748+ * Description
3749+ * Get a bpf_local_storage from the *task*.
3750+ *
3751+ * Logically, it could be thought of as getting the value from
3752+ * a *map* with *task* as the **key**. From this
3753+ * perspective, the usage is not much different from
3754+ * **bpf_map_lookup_elem**\ (*map*, **&**\ *task*) except this
3755+ * helper enforces the key must be an task_struct and the map must also
3756+ * be a **BPF_MAP_TYPE_TASK_STORAGE**.
3757+ *
3758+ * Underneath, the value is stored locally at *task* instead of
3759+ * the *map*. The *map* is used as the bpf-local-storage
3760+ * "type". The bpf-local-storage "type" (i.e. the *map*) is
3761+ * searched against all bpf_local_storage residing at *task*.
3762+ *
3763+ * An optional *flags* (**BPF_LOCAL_STORAGE_GET_F_CREATE**) can be
3764+ * used such that a new bpf_local_storage will be
3765+ * created if one does not exist. *value* can be used
3766+ * together with **BPF_LOCAL_STORAGE_GET_F_CREATE** to specify
3767+ * the initial value of a bpf_local_storage. If *value* is
3768+ * **NULL**, the new bpf_local_storage will be zero initialized.
3769+ * Return
3770+ * A bpf_local_storage pointer is returned on success.
3771+ *
3772+ * **NULL** if not found or there was an error in adding
3773+ * a new bpf_local_storage.
3774+ *
3775+ * long bpf_task_storage_delete(struct bpf_map *map, struct task_struct *task)
3776+ * Description
3777+ * Delete a bpf_local_storage from a *task*.
3778+ * Return
3779+ * 0 on success.
3780+ *
3781+ * **-ENOENT** if the bpf_local_storage cannot be found.
3782+ *
3783+ * struct task_struct *bpf_get_current_task_btf(void)
3784+ * Description
3785+ * Return a BTF pointer to the "current" task.
3786+ * This pointer can also be used in helpers that accept an
3787+ * *ARG_PTR_TO_BTF_ID* of type *task_struct*.
3788+ * Return
3789+ * Pointer to the current task.
37453790 */
37463791 #define __BPF_FUNC_MAPPER(FN) \
37473792 FN(unspec), \
@@ -3900,6 +3945,9 @@ union bpf_attr { · 152 unmodified lines
39003945 FN(bpf_per_cpu_ptr), \
39013946 FN(bpf_this_cpu_ptr), \
39023947 FN(redirect_peer), \
3948+ FN(task_storage_get), \
3949+ FN(task_storage_delete), \
3950+ FN(get_current_task_btf), \
39033951 /* */
39043952
39053953 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
@@ -4418,6 +4466,9 @@ struct bpf_btf_info { · 512 unmodified lines
44184466 __aligned_u64 btf;
44194467 __u32 btf_size;
44204468 __u32 id;
4469+ __aligned_u64 name;
4470+ __u32 name_len;
4471+ __u32 kernel_btf;
44214472 } __attribute__((aligned(8)));
44224473
44234474 struct bpf_link_info {