Hi David, The following pull-request contains BPF updates for your *net-next* tree.
The main changes are: 1) A number of extensions to tcp-bpf, from Lawrence. - direct R or R/W access to many tcp_sock fields via bpf_sock_ops - passing up to 3 arguments to bpf_sock_ops functions - tcp_sock field bpf_sock_ops_cb_flags for controlling callbacks - optionally calling bpf_sock_ops program when RTO fires - optionally calling bpf_sock_ops program when packet is retransmitted - optionally calling bpf_sock_ops program when TCP state changes - access to tclass and sk_txhash - new selftest 2) div/mod exception handling, from Daniel. One of the ugly leftovers from the early eBPF days is that div/mod operations based on registers have a hard-coded src_reg == 0 test in the interpreter as well as in JIT code generators that would return from the BPF program with exit code 0. This was basically adopted from cBPF interpreter for historical reasons. There are multiple reasons why this is very suboptimal and prone to bugs. To name one: the return code mapping for such abnormal program exit of 0 does not always match with a suitable program type's exit code mapping. For example, '0' in tc means action 'ok' where the packet gets passed further up the stack, which is just undesirable for such cases (e.g. when implementing policy) and also does not match with other program types. After considering _four_ different ways to address the problem, we adapt the same behavior as on some major archs like ARMv8: X div 0 results in 0, and X mod 0 results in X. aarch64 and aarch32 ISA do not generate any traps or otherwise aborts of program execution for unsigned divides. Given the options, it seems the most suitable from all of them, also since major archs have similar schemes in place. Given this is all in the realm of undefined behavior, we still have the option to adapt if deemed necessary. 3) sockmap sample refactoring, from John. 4) lpm map get_next_key fixes, from Yonghong. 5) test cleanups, from Alexei and Prashant. Please consider pulling these changes from: git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git There should be no merge conflicts. Thanks a lot! ---------------------------------------------------------------- The following changes since commit e8a22b5f079449f1803d37ce2b5d09acaa68368d: net: aquantia: make symbol hw_atl_boards static (2018-01-23 10:59:42 -0500) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git for you to fetch changes up to 8223967fe0b8eb2448cca5cfe3c64a0838e6f60d: Merge branch 'fix-lpm-map' (2018-01-26 17:06:24 -0800) ---------------------------------------------------------------- Alexei Starovoitov (6): selftests/bpf: speedup test_maps selftests/bpf: fix test_dev_cgroup selftests/bpf: make 'dubious pointer arithmetic' test useful Merge branch 'bpf-more-sock_ops-callbacks' Merge branch 'bpf-improvements-and-fixes' Merge branch 'fix-lpm-map' Daniel Borkmann (14): Merge branch 'bpf-samples-sockmap-improvements' bpf: xor of a/x in cbpf can be done in 32 bit alu bpf: improve dead code sanitizing bpf: make unknown opcode handling more robust bpf: fix subprog verifier bypass by div/mod by 0 exception bpf, x86_64: remove obsolete exception handling from div/mod bpf, arm64: remove obsolete exception handling from div/mod bpf, s390x: remove obsolete exception handling from div/mod bpf, ppc64: remove obsolete exception handling from div/mod bpf, sparc64: remove obsolete exception handling from div/mod bpf, mips64: remove obsolete exception handling from div/mod bpf, mips64: remove unneeded zero check from div/mod with k bpf, arm: remove obsolete exception handling from div/mod bpf: add further test cases around div/mod and others John Fastabend (7): bpf: refactor sockmap sample program update for arg parsing bpf: add sendmsg option for testing BPF programs bpf: sockmap sample, use fork() for send and recv bpf: sockmap sample, report bytes/sec bpf: sockmap sample add base test without any BPF for comparison bpf: sockmap put client sockets in blocking mode bpf: sockmap set rlimit Lawrence Brakmo (13): bpf: Only reply field should be writeable bpf: Make SOCK_OPS_GET_TCP size independent bpf: Make SOCK_OPS_GET_TCP struct independent bpf: Add write access to tcp_sock and sock fields bpf: Support passing args to sock_ops bpf function bpf: Adds field bpf_sock_ops_cb_flags to tcp_sock bpf: Add sock_ops RTO callback bpf: Add support for reading sk_state and more bpf: Add sock_ops R/W access to tclass bpf: Add BPF_SOCK_OPS_RETRANS_CB bpf: Add BPF_SOCK_OPS_STATE_CB bpf: add selftest for tcpbpf bpf: clean up from test_tcpbpf_kern.c Mickael Salaun (2): bpf: Use the IS_FD_ARRAY() macro in map_update_elem() samples/bpf: Partially fixes the bpf.o build Prashant Bhole (1): bpf: test_maps: cleanup sockmaps when test ends Wang YanQing (1): bpf, doc: Correct one wrong value in "Register value tracking" Yonghong Song (4): bpf: fix incorrect kmalloc usage in lpm_trie MAP_GET_NEXT_KEY rcu region tools/bpf: fix a test failure in selftests prog test_verifier bpf: fix kernel page fault in lpm map trie_get_next_key tools/bpf: add a multithreaded stress test in bpf selftests test_lpm_map Documentation/networking/filter.txt | 2 +- arch/arm/net/bpf_jit_32.c | 8 - arch/arm64/net/bpf_jit_comp.c | 13 - arch/mips/net/ebpf_jit.c | 29 +- arch/powerpc/net/bpf_jit_comp64.c | 8 - arch/s390/net/bpf_jit_comp.c | 10 - arch/sparc/net/bpf_jit_comp_64.c | 18 -- arch/x86/net/bpf_jit_comp.c | 20 -- include/linux/filter.h | 12 + include/linux/tcp.h | 11 + include/net/tcp.h | 42 ++- include/uapi/linux/bpf.h | 84 +++++- kernel/bpf/core.c | 258 +++++++++------- kernel/bpf/lpm_trie.c | 28 +- kernel/bpf/syscall.c | 5 +- kernel/bpf/verifier.c | 62 +++- lib/test_bpf.c | 8 +- net/core/filter.c | 303 +++++++++++++++++-- net/ipv4/tcp.c | 26 +- net/ipv4/tcp_nv.c | 2 +- net/ipv4/tcp_output.c | 6 +- net/ipv4/tcp_timer.c | 7 + samples/bpf/Makefile | 5 +- samples/sockmap/sockmap_user.c | 392 +++++++++++++++++++++---- tools/include/uapi/linux/bpf.h | 86 +++++- tools/testing/selftests/bpf/Makefile | 6 +- tools/testing/selftests/bpf/bpf_helpers.h | 2 + tools/testing/selftests/bpf/tcp_client.py | 51 ++++ tools/testing/selftests/bpf/tcp_server.py | 83 ++++++ tools/testing/selftests/bpf/test_align.c | 30 +- tools/testing/selftests/bpf/test_dev_cgroup.c | 2 +- tools/testing/selftests/bpf/test_lpm_map.c | 95 ++++++ tools/testing/selftests/bpf/test_maps.c | 32 +- tools/testing/selftests/bpf/test_tcpbpf.h | 16 + tools/testing/selftests/bpf/test_tcpbpf_kern.c | 115 ++++++++ tools/testing/selftests/bpf/test_tcpbpf_user.c | 126 ++++++++ tools/testing/selftests/bpf/test_verifier.c | 344 +++++++++++++++++++++- 37 files changed, 1969 insertions(+), 378 deletions(-) create mode 100755 tools/testing/selftests/bpf/tcp_client.py create mode 100755 tools/testing/selftests/bpf/tcp_server.py create mode 100644 tools/testing/selftests/bpf/test_tcpbpf.h create mode 100644 tools/testing/selftests/bpf/test_tcpbpf_kern.c create mode 100644 tools/testing/selftests/bpf/test_tcpbpf_user.c