Alexei Starovoitov says: ==================== pull-request: bpf-next 2021-12-30 The following pull-request contains BPF updates for your *net-next* tree. We've added 72 non-merge commits during the last 20 day(s) which contain a total of 223 files changed, 3510 insertions(+), 1591 deletions(-). The main changes are: 1) Automatic setrlimit in libbpf when bpf is memcg's in the kernel, from Andrii. 2) Beautify and de-verbose verifier logs, from Christy. 3) Composable verifier types, from Hao. 4) bpf_strncmp helper, from Hou. 5) bpf.h header dependency cleanup, from Jakub. 6) get_func_[arg|ret|arg_cnt] helpers, from Jiri. 7) Sleepable local storage, from KP. 8) Extend kfunc with PTR_TO_CTX, PTR_TO_MEM argument support, from Kumar. ====================
Showing the changes to net (39 of 221 files). Show all
Unified · Split
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | SOFTWARE IS DISCLAIMED. |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | +#include <linux/compat.h> | |
| 27 | 28 | #include <linux/export.h> |
| 28 | 29 | #include <linux/file.h> |
| 29 | 30 | |
| @@ -5,6 +5,8 @@ · 4 unmodified lines | ||
| 5 | 5 | * Copyright (C) 2021 Intel Corporation |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | +#include <asm/unaligned.h> | |
| 9 | + | |
| 8 | 10 | void eir_create(struct hci_dev *hdev, u8 *data); |
| 9 | 11 | |
| 10 | 12 | u8 eir_create_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr); |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | SOFTWARE IS DISCLAIMED. |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | +#include <linux/compat.h> | |
| 23 | 24 | #include <linux/export.h> |
| 24 | 25 | #include <linux/file.h> |
| 25 | 26 | |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | #include <linux/module.h> |
| 31 | 31 | #include <linux/export.h> |
| 32 | +#include <linux/filter.h> | |
| 32 | 33 | #include <linux/sched/signal.h> |
| 33 | 34 | |
| 34 | 35 | #include <net/bluetooth/bluetooth.h> |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | #include <linux/capability.h> |
| 11 | +#include <linux/compat.h> | |
| 11 | 12 | #include <linux/kernel.h> |
| 12 | 13 | #include <linux/if_bridge.h> |
| 13 | 14 | #include <linux/netdevice.h> |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 7 | #define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__ |
| 8 | 8 | |
| 9 | +#include <linux/filter.h> | |
| 9 | 10 | #include <linux/fs.h> |
| 10 | 11 | #include <linux/init.h> |
| 11 | 12 | #include <linux/module.h> |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <net/sock.h> |
| 14 | 14 | #include <uapi/linux/sock_diag.h> |
| 15 | 15 | #include <uapi/linux/btf.h> |
| 16 | +#include <linux/rcupdate_trace.h> | |
| 16 | 17 | |
| 17 | 18 | DEFINE_BPF_STORAGE_CACHE(sk_cache); |
| 18 | 19 | |
| @@ -22,7 +23,8 @@ bpf_sk_storage_lookup(struct sock *sk, struct bpf_map *map, bool cacheit_lockit) · 3 unmodified lines | ||
| 22 | 23 | struct bpf_local_storage *sk_storage; |
| 23 | 24 | struct bpf_local_storage_map *smap; |
| 24 | 25 | |
| 25 | − sk_storage = rcu_dereference(sk->sk_bpf_storage); | |
| 26 | + sk_storage = | |
| 27 | + rcu_dereference_check(sk->sk_bpf_storage, bpf_rcu_lock_held()); | |
| 26 | 28 | if (!sk_storage) |
| 27 | 29 | return NULL; |
| 28 | 30 | |
| @@ -258,6 +260,7 @@ BPF_CALL_4(bpf_sk_storage_get, struct bpf_map *, map, struct sock *, sk, · 229 unmodified lines | ||
| 258 | 260 | { |
| 259 | 261 | struct bpf_local_storage_data *sdata; |
| 260 | 262 | |
| 263 | + WARN_ON_ONCE(!bpf_rcu_lock_held()); | |
| 261 | 264 | if (!sk || !sk_fullsock(sk) || flags > BPF_SK_STORAGE_GET_F_CREATE) |
| 262 | 265 | return (unsigned long)NULL; |
| 263 | 266 | |
| @@ -288,6 +291,7 @@ BPF_CALL_4(bpf_sk_storage_get, struct bpf_map *, map, struct sock *, sk, · 24 unmodified lines | ||
| 288 | 291 | |
| 289 | 292 | BPF_CALL_2(bpf_sk_storage_delete, struct bpf_map *, map, struct sock *, sk) |
| 290 | 293 | { |
| 294 | + WARN_ON_ONCE(!bpf_rcu_lock_held()); | |
| 291 | 295 | if (!sk || !sk_fullsock(sk)) |
| 292 | 296 | return -EINVAL; |
| 293 | 297 | |
| @@ -416,6 +420,7 @@ static bool bpf_sk_storage_tracing_allowed(const struct bpf_prog *prog) · 122 unmodified lines | ||
| 416 | 420 | BPF_CALL_4(bpf_sk_storage_get_tracing, struct bpf_map *, map, struct sock *, sk, |
| 417 | 421 | void *, value, u64, flags) |
| 418 | 422 | { |
| 423 | + WARN_ON_ONCE(!bpf_rcu_lock_held()); | |
| 419 | 424 | if (in_hardirq() || in_nmi()) |
| 420 | 425 | return (unsigned long)NULL; |
| 421 | 426 | |
| @@ -425,6 +430,7 @@ BPF_CALL_4(bpf_sk_storage_get_tracing, struct bpf_map *, map, struct sock *, sk, · 3 unmodified lines | ||
| 425 | 430 | BPF_CALL_2(bpf_sk_storage_delete_tracing, struct bpf_map *, map, |
| 426 | 431 | struct sock *, sk) |
| 427 | 432 | { |
| 433 | + WARN_ON_ONCE(!bpf_rcu_lock_held()); | |
| 428 | 434 | if (in_hardirq() || in_nmi()) |
| 429 | 435 | return -EPERM; |
| 430 | 436 | |
| @@ -929,7 +935,7 @@ static struct bpf_iter_reg bpf_sk_storage_map_reg_info = { · 498 unmodified lines | ||
| 929 | 935 | { offsetof(struct bpf_iter__bpf_sk_storage_map, sk), |
| 930 | 936 | PTR_TO_BTF_ID_OR_NULL }, |
| 931 | 937 | { offsetof(struct bpf_iter__bpf_sk_storage_map, value), |
| 932 | − PTR_TO_RDWR_BUF_OR_NULL }, | |
| 938 | + PTR_TO_BUF | PTR_MAYBE_NULL }, | |
| 933 | 939 | }, |
| 934 | 940 | .seq_info = &iter_seq_info, |
| 935 | 941 | }; |
| @@ -4712,7 +4712,7 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb, · 4711 unmodified lines | ||
| 4712 | 4712 | case XDP_PASS: |
| 4713 | 4713 | break; |
| 4714 | 4714 | default: |
| 4715 | − bpf_warn_invalid_xdp_action(act); | |
| 4715 | + bpf_warn_invalid_xdp_action(skb->dev, xdp_prog, act); | |
| 4716 | 4716 | fallthrough; |
| 4717 | 4717 | case XDP_ABORTED: |
| 4718 | 4718 | trace_xdp_exception(skb->dev, xdp_prog, act); |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com> |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | +#include <linux/etherdevice.h> | |
| 10 | 11 | #include <linux/kernel.h> |
| 11 | 12 | #include <linux/module.h> |
| 12 | 13 | #include <linux/types.h> |
| @@ -1712,7 +1712,7 @@ static const struct bpf_func_proto bpf_skb_store_bytes_proto = { · 1711 unmodified lines | ||
| 1712 | 1712 | .ret_type = RET_INTEGER, |
| 1713 | 1713 | .arg1_type = ARG_PTR_TO_CTX, |
| 1714 | 1714 | .arg2_type = ARG_ANYTHING, |
| 1715 | − .arg3_type = ARG_PTR_TO_MEM, | |
| 1715 | + .arg3_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 1716 | 1716 | .arg4_type = ARG_CONST_SIZE, |
| 1717 | 1717 | .arg5_type = ARG_ANYTHING, |
| 1718 | 1718 | }; |
| @@ -2017,9 +2017,9 @@ static const struct bpf_func_proto bpf_csum_diff_proto = { · 298 unmodified lines | ||
| 2017 | 2017 | .gpl_only = false, |
| 2018 | 2018 | .pkt_access = true, |
| 2019 | 2019 | .ret_type = RET_INTEGER, |
| 2020 | − .arg1_type = ARG_PTR_TO_MEM_OR_NULL, | |
| 2020 | + .arg1_type = ARG_PTR_TO_MEM | PTR_MAYBE_NULL | MEM_RDONLY, | |
| 2021 | 2021 | .arg2_type = ARG_CONST_SIZE_OR_ZERO, |
| 2022 | − .arg3_type = ARG_PTR_TO_MEM_OR_NULL, | |
| 2022 | + .arg3_type = ARG_PTR_TO_MEM | PTR_MAYBE_NULL | MEM_RDONLY, | |
| 2023 | 2023 | .arg4_type = ARG_CONST_SIZE_OR_ZERO, |
| 2024 | 2024 | .arg5_type = ARG_ANYTHING, |
| 2025 | 2025 | }; |
| @@ -2540,7 +2540,7 @@ static const struct bpf_func_proto bpf_redirect_neigh_proto = { · 514 unmodified lines | ||
| 2540 | 2540 | .gpl_only = false, |
| 2541 | 2541 | .ret_type = RET_INTEGER, |
| 2542 | 2542 | .arg1_type = ARG_ANYTHING, |
| 2543 | − .arg2_type = ARG_PTR_TO_MEM_OR_NULL, | |
| 2543 | + .arg2_type = ARG_PTR_TO_MEM | PTR_MAYBE_NULL | MEM_RDONLY, | |
| 2544 | 2544 | .arg3_type = ARG_CONST_SIZE_OR_ZERO, |
| 2545 | 2545 | .arg4_type = ARG_ANYTHING, |
| 2546 | 2546 | }; |
| @@ -4173,7 +4173,7 @@ static const struct bpf_func_proto bpf_skb_event_output_proto = { · 1626 unmodified lines | ||
| 4173 | 4173 | .arg1_type = ARG_PTR_TO_CTX, |
| 4174 | 4174 | .arg2_type = ARG_CONST_MAP_PTR, |
| 4175 | 4175 | .arg3_type = ARG_ANYTHING, |
| 4176 | − .arg4_type = ARG_PTR_TO_MEM, | |
| 4176 | + .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 4177 | 4177 | .arg5_type = ARG_CONST_SIZE_OR_ZERO, |
| 4178 | 4178 | }; |
| 4179 | 4179 | |
| @@ -4187,7 +4187,7 @@ const struct bpf_func_proto bpf_skb_output_proto = { · 7 unmodified lines | ||
| 4187 | 4187 | .arg1_btf_id = &bpf_skb_output_btf_ids[0], |
| 4188 | 4188 | .arg2_type = ARG_CONST_MAP_PTR, |
| 4189 | 4189 | .arg3_type = ARG_ANYTHING, |
| 4190 | − .arg4_type = ARG_PTR_TO_MEM, | |
| 4190 | + .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 4191 | 4191 | .arg5_type = ARG_CONST_SIZE_OR_ZERO, |
| 4192 | 4192 | }; |
| 4193 | 4193 | |
| @@ -4370,7 +4370,7 @@ static const struct bpf_func_proto bpf_skb_set_tunnel_key_proto = { · 176 unmodified lines | ||
| 4370 | 4370 | .gpl_only = false, |
| 4371 | 4371 | .ret_type = RET_INTEGER, |
| 4372 | 4372 | .arg1_type = ARG_PTR_TO_CTX, |
| 4373 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 4373 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 4374 | 4374 | .arg3_type = ARG_CONST_SIZE, |
| 4375 | 4375 | .arg4_type = ARG_ANYTHING, |
| 4376 | 4376 | }; |
| @@ -4396,7 +4396,7 @@ static const struct bpf_func_proto bpf_skb_set_tunnel_opt_proto = { · 19 unmodified lines | ||
| 4396 | 4396 | .gpl_only = false, |
| 4397 | 4397 | .ret_type = RET_INTEGER, |
| 4398 | 4398 | .arg1_type = ARG_PTR_TO_CTX, |
| 4399 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 4399 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 4400 | 4400 | .arg3_type = ARG_CONST_SIZE, |
| 4401 | 4401 | }; |
| 4402 | 4402 | |
| @@ -4566,7 +4566,7 @@ static const struct bpf_func_proto bpf_xdp_event_output_proto = { · 163 unmodified lines | ||
| 4566 | 4566 | .arg1_type = ARG_PTR_TO_CTX, |
| 4567 | 4567 | .arg2_type = ARG_CONST_MAP_PTR, |
| 4568 | 4568 | .arg3_type = ARG_ANYTHING, |
| 4569 | − .arg4_type = ARG_PTR_TO_MEM, | |
| 4569 | + .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 4570 | 4570 | .arg5_type = ARG_CONST_SIZE_OR_ZERO, |
| 4571 | 4571 | }; |
| 4572 | 4572 | |
| @@ -4580,7 +4580,7 @@ const struct bpf_func_proto bpf_xdp_output_proto = { · 7 unmodified lines | ||
| 4580 | 4580 | .arg1_btf_id = &bpf_xdp_output_btf_ids[0], |
| 4581 | 4581 | .arg2_type = ARG_CONST_MAP_PTR, |
| 4582 | 4582 | .arg3_type = ARG_ANYTHING, |
| 4583 | − .arg4_type = ARG_PTR_TO_MEM, | |
| 4583 | + .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 4584 | 4584 | .arg5_type = ARG_CONST_SIZE_OR_ZERO, |
| 4585 | 4585 | }; |
| 4586 | 4586 | |
| @@ -5066,7 +5066,7 @@ const struct bpf_func_proto bpf_sk_setsockopt_proto = { · 479 unmodified lines | ||
| 5066 | 5066 | .arg1_type = ARG_PTR_TO_BTF_ID_SOCK_COMMON, |
| 5067 | 5067 | .arg2_type = ARG_ANYTHING, |
| 5068 | 5068 | .arg3_type = ARG_ANYTHING, |
| 5069 | − .arg4_type = ARG_PTR_TO_MEM, | |
| 5069 | + .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 5070 | 5070 | .arg5_type = ARG_CONST_SIZE, |
| 5071 | 5071 | }; |
| 5072 | 5072 | |
| @@ -5100,7 +5100,7 @@ static const struct bpf_func_proto bpf_sock_addr_setsockopt_proto = { · 27 unmodified lines | ||
| 5100 | 5100 | .arg1_type = ARG_PTR_TO_CTX, |
| 5101 | 5101 | .arg2_type = ARG_ANYTHING, |
| 5102 | 5102 | .arg3_type = ARG_ANYTHING, |
| 5103 | − .arg4_type = ARG_PTR_TO_MEM, | |
| 5103 | + .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 5104 | 5104 | .arg5_type = ARG_CONST_SIZE, |
| 5105 | 5105 | }; |
| 5106 | 5106 | |
| @@ -5134,7 +5134,7 @@ static const struct bpf_func_proto bpf_sock_ops_setsockopt_proto = { · 27 unmodified lines | ||
| 5134 | 5134 | .arg1_type = ARG_PTR_TO_CTX, |
| 5135 | 5135 | .arg2_type = ARG_ANYTHING, |
| 5136 | 5136 | .arg3_type = ARG_ANYTHING, |
| 5137 | − .arg4_type = ARG_PTR_TO_MEM, | |
| 5137 | + .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 5138 | 5138 | .arg5_type = ARG_CONST_SIZE, |
| 5139 | 5139 | }; |
| 5140 | 5140 | |
| @@ -5309,7 +5309,7 @@ static const struct bpf_func_proto bpf_bind_proto = { · 168 unmodified lines | ||
| 5309 | 5309 | .gpl_only = false, |
| 5310 | 5310 | .ret_type = RET_INTEGER, |
| 5311 | 5311 | .arg1_type = ARG_PTR_TO_CTX, |
| 5312 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 5312 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 5313 | 5313 | .arg3_type = ARG_CONST_SIZE, |
| 5314 | 5314 | }; |
| 5315 | 5315 | |
| @@ -5897,7 +5897,7 @@ static const struct bpf_func_proto bpf_lwt_in_push_encap_proto = { · 581 unmodified lines | ||
| 5897 | 5897 | .ret_type = RET_INTEGER, |
| 5898 | 5898 | .arg1_type = ARG_PTR_TO_CTX, |
| 5899 | 5899 | .arg2_type = ARG_ANYTHING, |
| 5900 | − .arg3_type = ARG_PTR_TO_MEM, | |
| 5900 | + .arg3_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 5901 | 5901 | .arg4_type = ARG_CONST_SIZE |
| 5902 | 5902 | }; |
| 5903 | 5903 | |
| @@ -5907,7 +5907,7 @@ static const struct bpf_func_proto bpf_lwt_xmit_push_encap_proto = { · 3 unmodified lines | ||
| 5907 | 5907 | .ret_type = RET_INTEGER, |
| 5908 | 5908 | .arg1_type = ARG_PTR_TO_CTX, |
| 5909 | 5909 | .arg2_type = ARG_ANYTHING, |
| 5910 | − .arg3_type = ARG_PTR_TO_MEM, | |
| 5910 | + .arg3_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 5911 | 5911 | .arg4_type = ARG_CONST_SIZE |
| 5912 | 5912 | }; |
| 5913 | 5913 | |
| @@ -5950,7 +5950,7 @@ static const struct bpf_func_proto bpf_lwt_seg6_store_bytes_proto = { · 36 unmodified lines | ||
| 5950 | 5950 | .ret_type = RET_INTEGER, |
| 5951 | 5951 | .arg1_type = ARG_PTR_TO_CTX, |
| 5952 | 5952 | .arg2_type = ARG_ANYTHING, |
| 5953 | − .arg3_type = ARG_PTR_TO_MEM, | |
| 5953 | + .arg3_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 5954 | 5954 | .arg4_type = ARG_CONST_SIZE |
| 5955 | 5955 | }; |
| 5956 | 5956 | |
| @@ -6038,7 +6038,7 @@ static const struct bpf_func_proto bpf_lwt_seg6_action_proto = { · 81 unmodified lines | ||
| 6038 | 6038 | .ret_type = RET_INTEGER, |
| 6039 | 6039 | .arg1_type = ARG_PTR_TO_CTX, |
| 6040 | 6040 | .arg2_type = ARG_ANYTHING, |
| 6041 | − .arg3_type = ARG_PTR_TO_MEM, | |
| 6041 | + .arg3_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6042 | 6042 | .arg4_type = ARG_CONST_SIZE |
| 6043 | 6043 | }; |
| 6044 | 6044 | |
| @@ -6263,7 +6263,7 @@ static const struct bpf_func_proto bpf_skc_lookup_tcp_proto = { · 218 unmodified lines | ||
| 6263 | 6263 | .pkt_access = true, |
| 6264 | 6264 | .ret_type = RET_PTR_TO_SOCK_COMMON_OR_NULL, |
| 6265 | 6265 | .arg1_type = ARG_PTR_TO_CTX, |
| 6266 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 6266 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6267 | 6267 | .arg3_type = ARG_CONST_SIZE, |
| 6268 | 6268 | .arg4_type = ARG_ANYTHING, |
| 6269 | 6269 | .arg5_type = ARG_ANYTHING, |
| @@ -6282,7 +6282,7 @@ static const struct bpf_func_proto bpf_sk_lookup_tcp_proto = { · 12 unmodified lines | ||
| 6282 | 6282 | .pkt_access = true, |
| 6283 | 6283 | .ret_type = RET_PTR_TO_SOCKET_OR_NULL, |
| 6284 | 6284 | .arg1_type = ARG_PTR_TO_CTX, |
| 6285 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 6285 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6286 | 6286 | .arg3_type = ARG_CONST_SIZE, |
| 6287 | 6287 | .arg4_type = ARG_ANYTHING, |
| 6288 | 6288 | .arg5_type = ARG_ANYTHING, |
| @@ -6301,7 +6301,7 @@ static const struct bpf_func_proto bpf_sk_lookup_udp_proto = { · 12 unmodified lines | ||
| 6301 | 6301 | .pkt_access = true, |
| 6302 | 6302 | .ret_type = RET_PTR_TO_SOCKET_OR_NULL, |
| 6303 | 6303 | .arg1_type = ARG_PTR_TO_CTX, |
| 6304 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 6304 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6305 | 6305 | .arg3_type = ARG_CONST_SIZE, |
| 6306 | 6306 | .arg4_type = ARG_ANYTHING, |
| 6307 | 6307 | .arg5_type = ARG_ANYTHING, |
| @@ -6338,7 +6338,7 @@ static const struct bpf_func_proto bpf_xdp_sk_lookup_udp_proto = { · 30 unmodified lines | ||
| 6338 | 6338 | .pkt_access = true, |
| 6339 | 6339 | .ret_type = RET_PTR_TO_SOCKET_OR_NULL, |
| 6340 | 6340 | .arg1_type = ARG_PTR_TO_CTX, |
| 6341 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 6341 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6342 | 6342 | .arg3_type = ARG_CONST_SIZE, |
| 6343 | 6343 | .arg4_type = ARG_ANYTHING, |
| 6344 | 6344 | .arg5_type = ARG_ANYTHING, |
| @@ -6361,7 +6361,7 @@ static const struct bpf_func_proto bpf_xdp_skc_lookup_tcp_proto = { · 16 unmodified lines | ||
| 6361 | 6361 | .pkt_access = true, |
| 6362 | 6362 | .ret_type = RET_PTR_TO_SOCK_COMMON_OR_NULL, |
| 6363 | 6363 | .arg1_type = ARG_PTR_TO_CTX, |
| 6364 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 6364 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6365 | 6365 | .arg3_type = ARG_CONST_SIZE, |
| 6366 | 6366 | .arg4_type = ARG_ANYTHING, |
| 6367 | 6367 | .arg5_type = ARG_ANYTHING, |
| @@ -6384,7 +6384,7 @@ static const struct bpf_func_proto bpf_xdp_sk_lookup_tcp_proto = { · 16 unmodified lines | ||
| 6384 | 6384 | .pkt_access = true, |
| 6385 | 6385 | .ret_type = RET_PTR_TO_SOCKET_OR_NULL, |
| 6386 | 6386 | .arg1_type = ARG_PTR_TO_CTX, |
| 6387 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 6387 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6388 | 6388 | .arg3_type = ARG_CONST_SIZE, |
| 6389 | 6389 | .arg4_type = ARG_ANYTHING, |
| 6390 | 6390 | .arg5_type = ARG_ANYTHING, |
| @@ -6403,7 +6403,7 @@ static const struct bpf_func_proto bpf_sock_addr_skc_lookup_tcp_proto = { · 12 unmodified lines | ||
| 6403 | 6403 | .gpl_only = false, |
| 6404 | 6404 | .ret_type = RET_PTR_TO_SOCK_COMMON_OR_NULL, |
| 6405 | 6405 | .arg1_type = ARG_PTR_TO_CTX, |
| 6406 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 6406 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6407 | 6407 | .arg3_type = ARG_CONST_SIZE, |
| 6408 | 6408 | .arg4_type = ARG_ANYTHING, |
| 6409 | 6409 | .arg5_type = ARG_ANYTHING, |
| @@ -6422,7 +6422,7 @@ static const struct bpf_func_proto bpf_sock_addr_sk_lookup_tcp_proto = { · 12 unmodified lines | ||
| 6422 | 6422 | .gpl_only = false, |
| 6423 | 6423 | .ret_type = RET_PTR_TO_SOCKET_OR_NULL, |
| 6424 | 6424 | .arg1_type = ARG_PTR_TO_CTX, |
| 6425 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 6425 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6426 | 6426 | .arg3_type = ARG_CONST_SIZE, |
| 6427 | 6427 | .arg4_type = ARG_ANYTHING, |
| 6428 | 6428 | .arg5_type = ARG_ANYTHING, |
| @@ -6441,7 +6441,7 @@ static const struct bpf_func_proto bpf_sock_addr_sk_lookup_udp_proto = { · 12 unmodified lines | ||
| 6441 | 6441 | .gpl_only = false, |
| 6442 | 6442 | .ret_type = RET_PTR_TO_SOCKET_OR_NULL, |
| 6443 | 6443 | .arg1_type = ARG_PTR_TO_CTX, |
| 6444 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 6444 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6445 | 6445 | .arg3_type = ARG_CONST_SIZE, |
| 6446 | 6446 | .arg4_type = ARG_ANYTHING, |
| 6447 | 6447 | .arg5_type = ARG_ANYTHING, |
| @@ -6754,9 +6754,9 @@ static const struct bpf_func_proto bpf_tcp_check_syncookie_proto = { · 306 unmodified lines | ||
| 6754 | 6754 | .pkt_access = true, |
| 6755 | 6755 | .ret_type = RET_INTEGER, |
| 6756 | 6756 | .arg1_type = ARG_PTR_TO_BTF_ID_SOCK_COMMON, |
| 6757 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 6757 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6758 | 6758 | .arg3_type = ARG_CONST_SIZE, |
| 6759 | − .arg4_type = ARG_PTR_TO_MEM, | |
| 6759 | + .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6760 | 6760 | .arg5_type = ARG_CONST_SIZE, |
| 6761 | 6761 | }; |
| 6762 | 6762 | |
| @@ -6823,9 +6823,9 @@ static const struct bpf_func_proto bpf_tcp_gen_syncookie_proto = { · 60 unmodified lines | ||
| 6823 | 6823 | .pkt_access = true, |
| 6824 | 6824 | .ret_type = RET_INTEGER, |
| 6825 | 6825 | .arg1_type = ARG_PTR_TO_BTF_ID_SOCK_COMMON, |
| 6826 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 6826 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6827 | 6827 | .arg3_type = ARG_CONST_SIZE, |
| 6828 | − .arg4_type = ARG_PTR_TO_MEM, | |
| 6828 | + .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 6829 | 6829 | .arg5_type = ARG_CONST_SIZE, |
| 6830 | 6830 | }; |
| 6831 | 6831 | |
| @@ -7054,7 +7054,7 @@ static const struct bpf_func_proto bpf_sock_ops_store_hdr_opt_proto = { · 222 unmodified lines | ||
| 7054 | 7054 | .gpl_only = false, |
| 7055 | 7055 | .ret_type = RET_INTEGER, |
| 7056 | 7056 | .arg1_type = ARG_PTR_TO_CTX, |
| 7057 | − .arg2_type = ARG_PTR_TO_MEM, | |
| 7057 | + .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY, | |
| 7058 | 7058 | .arg3_type = ARG_CONST_SIZE, |
| 7059 | 7059 | .arg4_type = ARG_ANYTHING, |
| 7060 | 7060 | }; |
| @@ -8180,13 +8180,13 @@ static bool xdp_is_valid_access(int off, int size, · 1119 unmodified lines | ||
| 8180 | 8180 | return __is_valid_xdp_access(off, size); |
| 8181 | 8181 | } |
| 8182 | 8182 | |
| 8183 | −void bpf_warn_invalid_xdp_action(u32 act) | |
| 8183 | +void bpf_warn_invalid_xdp_action(struct net_device *dev, struct bpf_prog *prog, u32 act) | |
| 8184 | 8184 | { |
| 8185 | 8185 | const u32 act_max = XDP_REDIRECT; |
| 8186 | 8186 | |
| 8187 | − WARN_ONCE(1, "%s XDP return value %u, expect packet loss!\n", | |
| 8188 | − act > act_max ? "Illegal" : "Driver unsupported", | |
| 8189 | − act); | |
| 8187 | + pr_warn_once("%s XDP return value %u on prog %s (id %d) dev %s, expect packet loss!\n", | |
| 8188 | + act > act_max ? "Illegal" : "Driver unsupported", | |
| 8189 | + act, prog->aux->name, prog->aux->id, dev ? dev->name : "N/A"); | |
| 8190 | 8190 | } |
| 8191 | 8191 | EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); |
| 8192 | 8192 | |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | #include <linux/ip.h> |
| 6 | 6 | #include <linux/ipv6.h> |
| 7 | 7 | #include <linux/if_vlan.h> |
| 8 | +#include <linux/filter.h> | |
| 8 | 9 | #include <net/dsa.h> |
| 9 | 10 | #include <net/dst_metadata.h> |
| 10 | 11 | #include <net/ip.h> |
| @@ -2,6 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | /* Copyright (c) 2016 Thomas Graf <tgraf@tgraf.ch> |
| 3 | 3 | */ |
| 4 | 4 | |
| 5 | +#include <linux/filter.h> | |
| 5 | 6 | #include <linux/kernel.h> |
| 6 | 7 | #include <linux/module.h> |
| 7 | 8 | #include <linux/skbuff.h> |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | /* License: GPL */ |
| 2 | 2 | |
| 3 | +#include <linux/filter.h> | |
| 3 | 4 | #include <linux/mutex.h> |
| 4 | 5 | #include <linux/socket.h> |
| 5 | 6 | #include <linux/skbuff.h> |
| @@ -1564,7 +1564,7 @@ static struct bpf_iter_reg sock_map_iter_reg = { · 1563 unmodified lines | ||
| 1564 | 1564 | .ctx_arg_info_size = 2, |
| 1565 | 1565 | .ctx_arg_info = { |
| 1566 | 1566 | { offsetof(struct bpf_iter__sockmap, key), |
| 1567 | − PTR_TO_RDONLY_BUF_OR_NULL }, | |
| 1567 | + PTR_TO_BUF | PTR_MAYBE_NULL | MEM_RDONLY }, | |
| 1568 | 1568 | { offsetof(struct bpf_iter__sockmap, sk), |
| 1569 | 1569 | PTR_TO_BTF_ID_OR_NULL }, |
| 1570 | 1570 | }, |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | * Added /proc/sys/net/core directory entry (empty =) ). [MS] |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | +#include <linux/filter.h> | |
| 9 | 10 | #include <linux/mm.h> |
| 10 | 11 | #include <linux/sysctl.h> |
| 11 | 12 | #include <linux/module.h> |
| @@ -38,6 +38,7 @@ · 37 unmodified lines | ||
| 38 | 38 | *******************************************************************************/ |
| 39 | 39 | |
| 40 | 40 | #include <linux/errno.h> |
| 41 | +#include <linux/filter.h> | |
| 41 | 42 | #include <linux/types.h> |
| 42 | 43 | #include <linux/socket.h> |
| 43 | 44 | #include <linux/in.h> |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #define __DSA_PRIV_H |
| 9 | 9 | |
| 10 | 10 | #include <linux/if_bridge.h> |
| 11 | +#include <linux/if_vlan.h> | |
| 11 | 12 | #include <linux/phy.h> |
| 12 | 13 | #include <linux/netdevice.h> |
| 13 | 14 | #include <linux/netpoll.h> |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | #include <linux/compat.h> |
| 11 | +#include <linux/etherdevice.h> | |
| 11 | 12 | #include <linux/module.h> |
| 12 | 13 | #include <linux/types.h> |
| 13 | 14 | #include <linux/capability.h> |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #include <linux/nexthop.h> |
| 9 | 9 | #include <linux/rtnetlink.h> |
| 10 | 10 | #include <linux/slab.h> |
| 11 | +#include <linux/vmalloc.h> | |
| 11 | 12 | #include <net/arp.h> |
| 12 | 13 | #include <net/ipv6_stubs.h> |
| 13 | 14 | #include <net/lwtunnel.h> |
| @@ -74,6 +74,7 @@ · 73 unmodified lines | ||
| 74 | 74 | |
| 75 | 75 | #define pr_fmt(fmt) "UDP: " fmt |
| 76 | 76 | |
| 77 | +#include <linux/bpf-cgroup.h> | |
| 77 | 78 | #include <linux/uaccess.h> |
| 78 | 79 | #include <asm/ioctls.h> |
| 79 | 80 | #include <linux/memblock.h> |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | #define pr_fmt(fmt) "IPv6: " fmt |
| 17 | 17 | |
| 18 | +#include <linux/bpf.h> | |
| 18 | 19 | #include <linux/errno.h> |
| 19 | 20 | #include <linux/types.h> |
| 20 | 21 | #include <linux/net.h> |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | * eBPF support: Mathieu Xhonneux <m.xhonneux@gmail.com> |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | +#include <linux/filter.h> | |
| 10 | 11 | #include <linux/types.h> |
| 11 | 12 | #include <linux/skbuff.h> |
| 12 | 13 | #include <linux/net.h> |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | * YOSHIFUJI Hideaki @USAGI: convert /proc/net/udp6 to seq_file. |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | +#include <linux/bpf-cgroup.h> | |
| 20 | 21 | #include <linux/errno.h> |
| 21 | 22 | #include <linux/types.h> |
| 22 | 23 | #include <linux/socket.h> |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #define KMSG_COMPONENT "af_iucv" |
| 14 | 14 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
| 15 | 15 | |
| 16 | +#include <linux/filter.h> | |
| 16 | 17 | #include <linux/module.h> |
| 17 | 18 | #include <linux/netdevice.h> |
| 18 | 19 | #include <linux/types.h> |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <linux/errno.h> |
| 10 | 10 | #include <linux/errqueue.h> |
| 11 | 11 | #include <linux/file.h> |
| 12 | +#include <linux/filter.h> | |
| 12 | 13 | #include <linux/in.h> |
| 13 | 14 | #include <linux/kernel.h> |
| 14 | 15 | #include <linux/module.h> |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | #include <linux/module.h> |
| 9 | +#include <linux/kallsyms.h> | |
| 9 | 10 | #include <linux/kernel.h> |
| 10 | 11 | #include <linux/types.h> |
| 11 | 12 | #include <linux/skbuff.h> |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | * Copyright (c) 2020 Jose M. Guisado <guigom@riseup.net> |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | +#include <linux/etherdevice.h> | |
| 7 | 8 | #include <linux/kernel.h> |
| 8 | 9 | #include <linux/init.h> |
| 9 | 10 | #include <linux/module.h> |
| @@ -20,8 +20,10 @@ · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | #include <linux/module.h> |
| 22 | 22 | |
| 23 | +#include <linux/bpf.h> | |
| 23 | 24 | #include <linux/capability.h> |
| 24 | 25 | #include <linux/kernel.h> |
| 26 | +#include <linux/filter.h> | |
| 25 | 27 | #include <linux/init.h> |
| 26 | 28 | #include <linux/signal.h> |
| 27 | 29 | #include <linux/sched.h> |
| @@ -49,6 +49,7 @@ · 48 unmodified lines | ||
| 49 | 49 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 50 | 50 | |
| 51 | 51 | #include <linux/ethtool.h> |
| 52 | +#include <linux/filter.h> | |
| 52 | 53 | #include <linux/types.h> |
| 53 | 54 | #include <linux/mm.h> |
| 54 | 55 | #include <linux/capability.h> |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | * diagrams as the code is not obvious and probably very easy to break. |
| 10 | 10 | */ |
| 11 | 11 | #include <linux/errno.h> |
| 12 | +#include <linux/filter.h> | |
| 12 | 13 | #include <linux/types.h> |
| 13 | 14 | #include <linux/socket.h> |
| 14 | 15 | #include <linux/in.h> |
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB |
| 2 | +#include <linux/if_vlan.h> | |
| 2 | 3 | #include <net/netlink.h> |
| 3 | 4 | #include <net/sch_generic.h> |
| 4 | 5 | #include <net/pkt_sched.h> |
| @@ -12,6 +12,8 @@ · 11 unmodified lines | ||
| 12 | 12 | * Author(s): Ursula Braun <ubraun@linux.vnet.ibm.com> |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | +#include <linux/etherdevice.h> | |
| 16 | +#include <linux/if_vlan.h> | |
| 15 | 17 | #include <linux/random.h> |
| 16 | 18 | #include <linux/workqueue.h> |
| 17 | 19 | #include <linux/scatterlist.h> |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | * Copyright IBM Corp. 2018 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | +#include <linux/if_vlan.h> | |
| 9 | 10 | #include <linux/spinlock.h> |
| 10 | 11 | #include <linux/mutex.h> |
| 11 | 12 | #include <linux/slab.h> |
| @@ -52,6 +52,7 @@ · 51 unmodified lines | ||
| 52 | 52 | * Based upon Swansea University Computer Society NET3.039 |
| 53 | 53 | */ |
| 54 | 54 | |
| 55 | +#include <linux/bpf-cgroup.h> | |
| 55 | 56 | #include <linux/ethtool.h> |
| 56 | 57 | #include <linux/mm.h> |
| 57 | 58 | #include <linux/socket.h> |
| @@ -89,6 +89,7 @@ · 88 unmodified lines | ||
| 89 | 89 | #include <linux/socket.h> |
| 90 | 90 | #include <linux/un.h> |
| 91 | 91 | #include <linux/fcntl.h> |
| 92 | +#include <linux/filter.h> | |
| 92 | 93 | #include <linux/termios.h> |
| 93 | 94 | #include <linux/sockios.h> |
| 94 | 95 | #include <linux/net.h> |
| @@ -85,6 +85,7 @@ · 84 unmodified lines | ||
| 85 | 85 | * TCP_LISTEN - listening |
| 86 | 86 | */ |
| 87 | 87 | |
| 88 | +#include <linux/compat.h> | |
| 88 | 89 | #include <linux/types.h> |
| 89 | 90 | #include <linux/bitops.h> |
| 90 | 91 | #include <linux/cred.h> |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | #include <linux/bpf.h> |
| 7 | +#include <linux/filter.h> | |
| 7 | 8 | #include <linux/capability.h> |
| 8 | 9 | #include <net/xdp_sock.h> |
| 9 | 10 | #include <linux/slab.h> |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | ||
| 14 | 14 | * |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | +#include <linux/compat.h> | |
| 17 | 18 | #include <linux/workqueue.h> |
| 18 | 19 | #include <net/xfrm.h> |
| 19 | 20 | #include <linux/pfkeyv2.h> |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | +#include <linux/compat.h> | |
| 14 | 15 | #include <linux/crypto.h> |
| 15 | 16 | #include <linux/module.h> |
| 16 | 17 | #include <linux/kernel.h> |