1. 25 Feb, 2019 4 commits
    • Magnus Karlsson's avatar
      libbpf: add support for using AF_XDP sockets · 1cad0788
      Magnus Karlsson authored
      This commit adds AF_XDP support to libbpf. The main reason for this is
      to facilitate writing applications that use AF_XDP by offering
      higher-level APIs that hide many of the details of the AF_XDP
      uapi. This is in the same vein as libbpf facilitates XDP adoption by
      offering easy-to-use higher level interfaces of XDP
      functionality. Hopefully this will facilitate adoption of AF_XDP, make
      applications using it simpler and smaller, and finally also make it
      possible for applications to benefit from optimizations in the AF_XDP
      user space access code. Previously, people just copied and pasted the
      code from the sample application into their application, which is not
      desirable.
      
      The interface is composed of two parts:
      
      * Low-level access interface to the four rings and the packet
      * High-level control plane interface for creating and setting
        up umems and af_xdp sockets as well as a simple XDP program.
      Tested-by: default avatarBjörn Töpel <bjorn.topel@intel.com>
      Signed-off-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      1cad0788
    • Stanislav Fomichev's avatar
      selftests/bpf: make sure signal interrupts BPF_PROG_TEST_RUN · 740f8a65
      Stanislav Fomichev authored
      Simple test that I used to reproduce the issue in the previous commit:
      Do BPF_PROG_TEST_RUN with max iterations, each program is 4096 simple
      move instructions. File alarm in 0.1 second and check that
      bpf_prog_test_run is interrupted (i.e. test doesn't hang).
      
      Note: reposting this for bpf-next to avoid linux-next conflict. In this
      version I test both BPF_PROG_TYPE_SOCKET_FILTER (which uses generic
      bpf_test_run implementation) and BPF_PROG_TYPE_FLOW_DISSECTOR (which has
      it own loop with preempt handling in bpf_prog_test_run_flow_dissector).
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      740f8a65
    • Stanislav Fomichev's avatar
      bpf/test_run: fix unkillable BPF_PROG_TEST_RUN for flow dissector · a439184d
      Stanislav Fomichev authored
      Syzbot found out that running BPF_PROG_TEST_RUN with repeat=0xffffffff
      makes process unkillable. The problem is that when CONFIG_PREEMPT is
      enabled, we never see need_resched() return true. This is due to the
      fact that preempt_enable() (which we do in bpf_test_run_one on each
      iteration) now handles resched if it's needed.
      
      Let's disable preemption for the whole run, not per test. In this case
      we can properly see whether resched is needed.
      Let's also properly return -EINTR to the userspace in case of a signal
      interrupt.
      
      This is a follow up for a recently fixed issue in bpf_test_run, see
      commit df1a2cb7 ("bpf/test_run: fix unkillable
      BPF_PROG_TEST_RUN").
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      a439184d
    • Anders Roxell's avatar
      bpf: test_bpf: turn off preemption in function __run_once · fd92d664
      Anders Roxell authored
      When running BPF test suite the following splat occurs:
      
      [  415.930950] test_bpf: #0 TAX jited:0
      [  415.931067] BUG: assuming atomic context at lib/test_bpf.c:6674
      [  415.946169] in_atomic(): 0, irqs_disabled(): 0, pid: 11556, name: modprobe
      [  415.953176] INFO: lockdep is turned off.
      [  415.957207] CPU: 1 PID: 11556 Comm: modprobe Tainted: G        W         5.0.0-rc7-next-20190220 #1
      [  415.966328] Hardware name: HiKey Development Board (DT)
      [  415.971592] Call trace:
      [  415.974069]  dump_backtrace+0x0/0x160
      [  415.977761]  show_stack+0x24/0x30
      [  415.981104]  dump_stack+0xc8/0x114
      [  415.984534]  __cant_sleep+0xf0/0x108
      [  415.988145]  test_bpf_init+0x5e0/0x1000 [test_bpf]
      [  415.992971]  do_one_initcall+0x90/0x428
      [  415.996837]  do_init_module+0x60/0x1e4
      [  416.000614]  load_module+0x1de0/0x1f50
      [  416.004391]  __se_sys_finit_module+0xc8/0xe0
      [  416.008691]  __arm64_sys_finit_module+0x24/0x30
      [  416.013255]  el0_svc_common+0x78/0x130
      [  416.017031]  el0_svc_handler+0x38/0x78
      [  416.020806]  el0_svc+0x8/0xc
      
      Rework so that preemption is disabled when we loop over function
      'BPF_PROG_RUN(...)'.
      
      Fixes: 568f1967 ("bpf: check that BPF programs run with preemption disabled")
      Suggested-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAnders Roxell <anders.roxell@linaro.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      fd92d664
  2. 22 Feb, 2019 1 commit
  3. 21 Feb, 2019 1 commit
  4. 19 Feb, 2019 12 commits
  5. 18 Feb, 2019 3 commits
  6. 17 Feb, 2019 19 commits