Daniel Borkmann says: ==================== pull-request: bpf 2020-06-30 The following pull-request contains BPF updates for your *net* tree. We've added 28 non-merge commits during the last 9 day(s) which contain a total of 35 files changed, 486 insertions(+), 232 deletions(-). The main changes are: 1) Fix an incorrect verifier branch elimination for PTR_TO_BTF_ID pointer types, from Yonghong Song. 2) Fix UAPI for sockmap and flow_dissector progs that were ignoring various arguments passed to BPF_PROG_{ATTACH,DETACH}, from Lorenz Bauer & Jakub Sitnicki. 3) Fix broken AF_XDP DMA hacks that are poking into dma-direct and swiotlb internals and integrate it properly into DMA core, from Christoph Hellwig. 4) Fix RCU splat from recent changes to avoid skipping ingress policy when kTLS is enabled, from John Fastabend. 5) Fix BPF ringbuf map to enforce size to be the power of 2 in order for its position masking to work, from Andrii Nakryiko. 6) Fix regression from CAP_BPF work to re-allow CAP_SYS_ADMIN for loading of network programs, from Maciej Żenczykowski. 7) Fix libbpf section name prefix for devmap progs, from Jesper Dangaard Brouer. 8) Fix formatting in UAPI documentation for BPF helpers, from Quentin Monnet. ====================
Showing the changes to include/linux (6 of 35 files). Show all
Unified · Split
| @@ -33,7 +33,7 @@ int netns_bpf_prog_query(const union bpf_attr *attr, · 32 unmodified lines | |||
| 33 | union bpf_attr __user *uattr); | 33 | union bpf_attr __user *uattr); |
| 34 | int netns_bpf_prog_attach(const union bpf_attr *attr, | 34 | int netns_bpf_prog_attach(const union bpf_attr *attr, |
| 35 | struct bpf_prog *prog); | 35 | struct bpf_prog *prog); |
| 36 | int netns_bpf_prog_detach(const union bpf_attr *attr); | 36 | int netns_bpf_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype); |
| 37 | int netns_bpf_link_create(const union bpf_attr *attr, | 37 | int netns_bpf_link_create(const union bpf_attr *attr, |
| 38 | struct bpf_prog *prog); | 38 | struct bpf_prog *prog); |
| 39 | #else | 39 | #else |
| @@ -49,7 +49,8 @@ static inline int netns_bpf_prog_attach(const union bpf_attr *attr, · 9 unmodified lines | |||
| 49 | return -EOPNOTSUPP; | 49 | return -EOPNOTSUPP; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | static inline int netns_bpf_prog_detach(const union bpf_attr *attr) | 52 | static inline int netns_bpf_prog_detach(const union bpf_attr *attr, |
| 53 | enum bpf_prog_type ptype) | ||
| 53 | { | 54 | { |
| 54 | return -EOPNOTSUPP; | 55 | return -EOPNOTSUPP; |
| 55 | } | 56 | } |
| @@ -1543,13 +1543,16 @@ static inline void bpf_map_offload_map_free(struct bpf_map *map) · 1542 unmodified lines | |||
| 1543 | #endif /* CONFIG_NET && CONFIG_BPF_SYSCALL */ | 1543 | #endif /* CONFIG_NET && CONFIG_BPF_SYSCALL */ |
| 1544 | 1544 | ||
| 1545 | #if defined(CONFIG_BPF_STREAM_PARSER) | 1545 | #if defined(CONFIG_BPF_STREAM_PARSER) |
| 1546 | int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog, u32 which); | 1546 | int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog, |
| 1547 | struct bpf_prog *old, u32 which); | ||
| 1547 | int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog); | 1548 | int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog); |
| 1549 | int sock_map_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype); | ||
| 1548 | void sock_map_unhash(struct sock *sk); | 1550 | void sock_map_unhash(struct sock *sk); |
| 1549 | void sock_map_close(struct sock *sk, long timeout); | 1551 | void sock_map_close(struct sock *sk, long timeout); |
| 1550 | #else | 1552 | #else |
| 1551 | static inline int sock_map_prog_update(struct bpf_map *map, | 1553 | static inline int sock_map_prog_update(struct bpf_map *map, |
| 1552 | struct bpf_prog *prog, u32 which) | 1554 | struct bpf_prog *prog, |
| 1555 | struct bpf_prog *old, u32 which) | ||
| 1553 | { | 1556 | { |
| 1554 | return -EOPNOTSUPP; | 1557 | return -EOPNOTSUPP; |
| 1555 | } | 1558 | } |
| @@ -1559,6 +1562,12 @@ static inline int sock_map_get_from_fd(const union bpf_attr *attr, · 3 unmodified lines | |||
| 1559 | { | 1562 | { |
| 1560 | return -EINVAL; | 1563 | return -EINVAL; |
| 1561 | } | 1564 | } |
| 1565 | |||
| 1566 | static inline int sock_map_prog_detach(const union bpf_attr *attr, | ||
| 1567 | enum bpf_prog_type ptype) | ||
| 1568 | { | ||
| 1569 | return -EOPNOTSUPP; | ||
| 1570 | } | ||
| 1562 | #endif /* CONFIG_BPF_STREAM_PARSER */ | 1571 | #endif /* CONFIG_BPF_STREAM_PARSER */ |
| 1563 | 1572 | ||
| 1564 | #if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL) | 1573 | #if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL) |
| @@ -82,6 +82,11 @@ static inline bool btf_type_is_int(const struct btf_type *t) · 81 unmodified lines | |||
| 82 | return BTF_INFO_KIND(t->info) == BTF_KIND_INT; | 82 | return BTF_INFO_KIND(t->info) == BTF_KIND_INT; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | static inline bool btf_type_is_small_int(const struct btf_type *t) | ||
| 86 | { | ||
| 87 | return btf_type_is_int(t) && t->size <= sizeof(u64); | ||
| 88 | } | ||
| 89 | |||
| 85 | static inline bool btf_type_is_enum(const struct btf_type *t) | 90 | static inline bool btf_type_is_enum(const struct btf_type *t) |
| 86 | { | 91 | { |
| 87 | return BTF_INFO_KIND(t->info) == BTF_KIND_ENUM; | 92 | return BTF_INFO_KIND(t->info) == BTF_KIND_ENUM; |
| @@ -87,4 +87,5 @@ int dma_direct_mmap(struct device *dev, struct vm_area_struct *vma, · 86 unmodified lines | |||
| 87 | void *cpu_addr, dma_addr_t dma_addr, size_t size, | 87 | void *cpu_addr, dma_addr_t dma_addr, size_t size, |
| 88 | unsigned long attrs); | 88 | unsigned long attrs); |
| 89 | int dma_direct_supported(struct device *dev, u64 mask); | 89 | int dma_direct_supported(struct device *dev, u64 mask); |
| 90 | bool dma_direct_need_sync(struct device *dev, dma_addr_t dma_addr); | ||
| 90 | #endif /* _LINUX_DMA_DIRECT_H */ | 91 | #endif /* _LINUX_DMA_DIRECT_H */ |
| @@ -461,6 +461,7 @@ int dma_set_mask(struct device *dev, u64 mask); · 460 unmodified lines | |||
| 461 | int dma_set_coherent_mask(struct device *dev, u64 mask); | 461 | int dma_set_coherent_mask(struct device *dev, u64 mask); |
| 462 | u64 dma_get_required_mask(struct device *dev); | 462 | u64 dma_get_required_mask(struct device *dev); |
| 463 | size_t dma_max_mapping_size(struct device *dev); | 463 | size_t dma_max_mapping_size(struct device *dev); |
| 464 | bool dma_need_sync(struct device *dev, dma_addr_t dma_addr); | ||
| 464 | unsigned long dma_get_merge_boundary(struct device *dev); | 465 | unsigned long dma_get_merge_boundary(struct device *dev); |
| 465 | #else /* CONFIG_HAS_DMA */ | 466 | #else /* CONFIG_HAS_DMA */ |
| 466 | static inline dma_addr_t dma_map_page_attrs(struct device *dev, | 467 | static inline dma_addr_t dma_map_page_attrs(struct device *dev, |
| @@ -571,6 +572,10 @@ static inline size_t dma_max_mapping_size(struct device *dev) · 104 unmodified lines | |||
| 571 | { | 572 | { |
| 572 | return 0; | 573 | return 0; |
| 573 | } | 574 | } |
| 575 | static inline bool dma_need_sync(struct device *dev, dma_addr_t dma_addr) | ||
| 576 | { | ||
| 577 | return false; | ||
| 578 | } | ||
| 574 | static inline unsigned long dma_get_merge_boundary(struct device *dev) | 579 | static inline unsigned long dma_get_merge_boundary(struct device *dev) |
| 575 | { | 580 | { |
| 576 | return 0; | 581 | return 0; |
| @@ -430,6 +430,19 @@ static inline void psock_set_prog(struct bpf_prog **pprog, · 429 unmodified lines | |||
| 430 | bpf_prog_put(prog); | 430 | bpf_prog_put(prog); |
| 431 | } | 431 | } |
| 432 | 432 | ||
| 433 | static inline int psock_replace_prog(struct bpf_prog **pprog, | ||
| 434 | struct bpf_prog *prog, | ||
| 435 | struct bpf_prog *old) | ||
| 436 | { | ||
| 437 | if (cmpxchg(pprog, old, prog) != old) | ||
| 438 | return -ENOENT; | ||
| 439 | |||
| 440 | if (old) | ||
| 441 | bpf_prog_put(old); | ||
| 442 | |||
| 443 | return 0; | ||
| 444 | } | ||
| 445 | |||
| 433 | static inline void psock_progs_drop(struct sk_psock_progs *progs) | 446 | static inline void psock_progs_drop(struct sk_psock_progs *progs) |
| 434 | { | 447 | { |
| 435 | psock_set_prog(&progs->msg_parser, NULL); | 448 | psock_set_prog(&progs->msg_parser, NULL); |