Alexei Starovoitov says: ==================== pull-request: bpf 2019-07-25 The following pull-request contains BPF updates for your *net* tree. The main changes are: 1) fix segfault in libbpf, from Andrii. 2) fix gso_segs access, from Eric. 3) tls/sockmap fixes, from Jakub and John. ====================
Showing the changes to include/linux (2 of 18 files). Show all
Unified · Split
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | #include <net/sch_generic.h> |
| 26 | 26 | |
| 27 | +#include <asm/byteorder.h> | |
| 27 | 28 | #include <uapi/linux/filter.h> |
| 28 | 29 | #include <uapi/linux/bpf.h> |
| 29 | 30 | |
| @@ -747,6 +748,18 @@ bpf_ctx_narrow_access_ok(u32 off, u32 size, u32 size_default) · 717 unmodified lines | ||
| 747 | 748 | return size <= size_default && (size & (size - 1)) == 0; |
| 748 | 749 | } |
| 749 | 750 | |
| 751 | +static inline u8 | |
| 752 | +bpf_ctx_narrow_load_shift(u32 off, u32 size, u32 size_default) | |
| 753 | +{ | |
| 754 | + u8 load_off = off & (size_default - 1); | |
| 755 | + | |
| 756 | +#ifdef __LITTLE_ENDIAN | |
| 757 | + return load_off * 8; | |
| 758 | +#else | |
| 759 | + return (size_default - (load_off + size)) * 8; | |
| 760 | +#endif | |
| 761 | +} | |
| 762 | + | |
| 750 | 763 | #define bpf_ctx_wide_access_ok(off, size, type, field) \ |
| 751 | 764 | (size == sizeof(__u64) && \ |
| 752 | 765 | off >= offsetof(type, field) && \ |
| @@ -354,7 +354,13 @@ static inline void sk_psock_restore_proto(struct sock *sk, · 353 unmodified lines | ||
| 354 | 354 | sk->sk_write_space = psock->saved_write_space; |
| 355 | 355 | |
| 356 | 356 | if (psock->sk_proto) { |
| 357 | − sk->sk_prot = psock->sk_proto; | |
| 357 | + struct inet_connection_sock *icsk = inet_csk(sk); | |
| 358 | + bool has_ulp = !!icsk->icsk_ulp_data; | |
| 359 | + | |
| 360 | + if (has_ulp) | |
| 361 | + tcp_update_ulp(sk, psock->sk_proto); | |
| 362 | + else | |
| 363 | + sk->sk_prot = psock->sk_proto; | |
| 358 | 364 | psock->sk_proto = NULL; |
| 359 | 365 | } |
| 360 | 366 | } |