1. 13 8月, 2018 1 次提交
    • A
      selftests/bpf: Selftest for bpf_skb_ancestor_cgroup_id · 5ecd8c22
      Andrey Ignatov 提交于
      Add selftests for bpf_skb_ancestor_cgroup_id helper.
      
      test_skb_cgroup_id.sh prepares testing interface and adds tc qdisc and
      filter for it using BPF object compiled from test_skb_cgroup_id_kern.c
      program.
      
      BPF program in test_skb_cgroup_id_kern.c gets ancestor cgroup id using
      the new helper at different levels of cgroup hierarchy that skb belongs
      to, including root level and non-existing level, and saves it to the map
      where the key is the level of corresponding cgroup and the value is its
      id.
      
      To trigger BPF program, user space program test_skb_cgroup_id_user is
      run. It adds itself into testing cgroup and sends UDP datagram to
      link-local multicast address of testing interface. Then it reads cgroup
      ids saved in kernel for different levels from the BPF map and compares
      them with those in user space. They must be equal for every level of
      ancestry.
      
      Example of run:
        # ./test_skb_cgroup_id.sh
        Wait for testing link-local IP to become available ... OK
        Note: 8 bytes struct bpf_elf_map fixup performed due to size mismatch!
        [PASS]
      Signed-off-by: NAndrey Ignatov <rdna@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      5ecd8c22
  2. 11 8月, 2018 1 次提交
  3. 03 8月, 2018 1 次提交
    • R
      selftests/bpf: add a cgroup storage test · 68cfa3ac
      Roman Gushchin 提交于
      Implement a test to cover the cgroup storage functionality.
      The test implements a bpf program which drops every second packet
      by using the cgroup storage as a persistent storage.
      
      The test also use the userspace API to check the data
      in the cgroup storage, alter it, and check that the loaded
      and attached bpf program sees the update.
      
      Expected output:
        $ ./test_cgroup_storage
        test_cgroup_storage:PASS
      Signed-off-by: NRoman Gushchin <guro@fb.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Acked-by: NMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      68cfa3ac
  4. 31 7月, 2018 1 次提交
    • A
      selftests/bpf: Test for get_socket_cookie · 194db0d9
      Andrey Ignatov 提交于
      Add test to use get_socket_cookie() from BPF programs of types
      BPF_PROG_TYPE_SOCK_OPS and BPF_PROG_TYPE_CGROUP_SOCK_ADDR.
      
      The test attaches two programs to cgroup, runs TCP server and client in
      the cgroup and checks that two operations are done properly on client
      socket when user calls connect(2):
      
      1. In BPF_CGROUP_INET6_CONNECT socket cookie is used as the key to write
         new value in a map for client socket.
      
      2. In BPF_CGROUP_SOCK_OPS (BPF_SOCK_OPS_TCP_CONNECT_CB callback) the
         value written in "1." is found by socket cookie, since it's the same
         socket, and updated.
      
      Finally the test verifies the value in the map.
      Signed-off-by: NAndrey Ignatov <rdna@fb.com>
      Acked-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      194db0d9
  5. 20 7月, 2018 1 次提交
  6. 15 7月, 2018 1 次提交
  7. 11 6月, 2018 1 次提交
    • A
      selftests: bpf: fix urandom_read build issue · 1c9ca7e9
      Anders Roxell 提交于
      gcc complains that urandom_read gets built twice.
      
      gcc -o tools/testing/selftests/bpf/urandom_read
      -static urandom_read.c -Wl,--build-id
      gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../lib/bpf
      -I../../../../include/generated  -I../../../include    urandom_read.c
      urandom_read -lcap -lelf -lrt -lpthread -o
      tools/testing/selftests/bpf/urandom_read
      gcc: fatal error: input file
      ‘tools/testing/selftests/bpf/urandom_read’ is the
      same as output file
      compilation terminated.
      ../lib.mk:110: recipe for target
      'tools/testing/selftests/bpf/urandom_read' failed
      To fix this issue remove the urandom_read target and so target
      TEST_CUSTOM_PROGS gets used.
      
      Fixes: 81f77fd0 ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID")
      Signed-off-by: NAnders Roxell <anders.roxell@linaro.org>
      Acked-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      1c9ca7e9
  8. 04 6月, 2018 1 次提交
  9. 30 5月, 2018 1 次提交
  10. 28 5月, 2018 1 次提交
    • A
      selftests/bpf: Selftest for sys_sendmsg hooks · 04b6ab73
      Andrey Ignatov 提交于
      Add selftest for BPF_CGROUP_UDP4_SENDMSG and BPF_CGROUP_UDP6_SENDMSG
      attach types.
      
      Try to sendmsg(2) to specific IP:port and test that:
      * source IP is overridden as expected.
      * remote IP:port pair is overridden as expected;
      
      Both UDPv4 and UDPv6 are tested.
      
      Output:
        # test_sock_addr.sh 2>/dev/null
        Wait for testing IPv4/IPv6 to become available ... OK
        ... pre-existing test-cases skipped ...
        Test case: sendmsg4: load prog with wrong expected attach type .. [PASS]
        Test case: sendmsg4: attach prog with wrong attach type .. [PASS]
        Test case: sendmsg4: rewrite IP & port (asm) .. [PASS]
        Test case: sendmsg4: rewrite IP & port (C) .. [PASS]
        Test case: sendmsg4: deny call .. [PASS]
        Test case: sendmsg6: load prog with wrong expected attach type .. [PASS]
        Test case: sendmsg6: attach prog with wrong attach type .. [PASS]
        Test case: sendmsg6: rewrite IP & port (asm) .. [PASS]
        Test case: sendmsg6: rewrite IP & port (C) .. [PASS]
        Test case: sendmsg6: IPv4-mapped IPv6 .. [PASS]
        Test case: sendmsg6: deny call .. [PASS]
        Summary: 27 PASSED, 0 FAILED
      Signed-off-by: NAndrey Ignatov <rdna@fb.com>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      04b6ab73
  11. 24 5月, 2018 1 次提交
    • M
      selftests/bpf: test for seg6local End.BPF action · c99a84ea
      Mathieu Xhonneux 提交于
      Add a new test for the seg6local End.BPF action. The following helpers
      are also tested:
      
      - bpf_lwt_push_encap within the LWT BPF IN hook
      - bpf_lwt_seg6_action
      - bpf_lwt_seg6_adjust_srh
      - bpf_lwt_seg6_store_bytes
      
      A chain of End.BPF actions is built. The SRH is injected through a LWT
      BPF IN hook before entering this chain. Each End.BPF action validates
      the previous one, otherwise the packet is dropped. The test succeeds
      if the last node in the chain receives the packet and the UDP datagram
      contained can be retrieved from userspace.
      Signed-off-by: NMathieu Xhonneux <m.xhonneux@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      c99a84ea
  12. 23 5月, 2018 1 次提交
    • S
      selftests/bpf: Makefile fix "missing" headers on build with -idirafter · 167381f3
      Sirio Balmelli 提交于
      Selftests fail to build on several distros/architectures because of
      	missing headers files.
      
      On a Ubuntu/x86_64 some missing headers are:
      	asm/byteorder.h, asm/socket.h, asm/sockios.h
      
      On a Debian/arm32 build already fails at sys/cdefs.h
      
      In both cases, these already exist in /usr/include/<arch-specific-dir>,
      but Clang does not include these when using '-target bpf' flag,
      since it is no longer compiling against the host architecture.
      
      The solution is to:
      
      - run Clang without '-target bpf' and extract the include chain for the
      current system
      
      - add these to the bpf build with '-idirafter'
      
      The choice of -idirafter is to catch this error without injecting
      unexpected include behavior: if an arch-specific tree is built
      for bpf in the future, this will be correctly found by Clang.
      Signed-off-by: NSirio Balmelli <sirio@b-ad.ch>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      167381f3
  13. 17 5月, 2018 1 次提交
  14. 15 5月, 2018 1 次提交
  15. 11 5月, 2018 2 次提交
  16. 29 4月, 2018 1 次提交
    • Y
      tools/bpf: add a test for bpf_get_stack with raw tracepoint prog · 173965fb
      Yonghong Song 提交于
      The test attached a raw_tracepoint program to raw_syscalls/sys_enter.
      It tested to get stack for user space, kernel space and user
      space with build_id request. It also tested to get user
      and kernel stack into the same buffer with back-to-back
      bpf_get_stack helper calls.
      
      If jit is not enabled, the user space application will check
      to ensure that the kernel function for raw_tracepoint
      ___bpf_prog_run is part of the stack.
      
      If jit is enabled, we did not have a reliable way to
      verify the kernel stack, so just assume the kernel stack
      is good when the kernel stack size is greater than 0.
      Signed-off-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      173965fb
  17. 27 4月, 2018 1 次提交
    • W
      selftests/bpf: bpf tunnel test. · 933a741e
      William Tu 提交于
      The patch migrates the original tests at samples/bpf/tcbpf2_kern.c
      and samples/bpf/test_tunnel_bpf.sh to selftests.  There are a couple
      changes from the original:
          1) add ipv6 vxlan, ipv6 geneve, ipv6 ipip tests
          2) simplify the original ipip tests (remove iperf tests)
          3) improve documentation
          4) use bpf_ntoh* and bpf_hton* api
      
      In summary, 'test_tunnel_kern.o' contains the following bpf program:
        GRE: gre_set_tunnel, gre_get_tunnel
        IP6GRE: ip6gretap_set_tunnel, ip6gretap_get_tunnel
        ERSPAN: erspan_set_tunnel, erspan_get_tunnel
        IP6ERSPAN: ip4ip6erspan_set_tunnel, ip4ip6erspan_get_tunnel
        VXLAN: vxlan_set_tunnel, vxlan_get_tunnel
        IP6VXLAN: ip6vxlan_set_tunnel, ip6vxlan_get_tunnel
        GENEVE: geneve_set_tunnel, geneve_get_tunnel
        IP6GENEVE: ip6geneve_set_tunnel, ip6geneve_get_tunnel
        IPIP: ipip_set_tunnel, ipip_get_tunnel
        IP6IP: ipip6_set_tunnel, ipip6_get_tunnel,
               ip6ip6_set_tunnel, ip6ip6_get_tunnel
        XFRM: xfrm_get_state
      Signed-off-by: NWilliam Tu <u9012063@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      933a741e
  18. 25 4月, 2018 2 次提交
    • J
      bpf: sockmap, add selftests · 16962b24
      John Fastabend 提交于
      This adds a new test program test_sockmap which is the old sample
      sockmap program. By moving the sample program here we can now run it
      as part of the self tests suite. To support this a populate_progs()
      routine is added to load programs and maps which was previously done
      with load_bpf_file(). This is needed because self test libs do not
      provide a similar routine. Also we now use the cgroup_helpers
      routines to manage cgroup use instead of manually creating one and
      supplying it to the CLI.
      
      Notice we keep the CLI around though because it is useful for dbg
      and specialized testing.
      
      To run use ./test_sockmap and the result should be,
      
      Summary 660 PASSED, 0 SKIPPED, 0 FAILED
      Signed-off-by: NJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      16962b24
    • Y
      tools/bpf: remove test_sock_addr from TEST_GEN_PROGS · 6595c742
      Yonghong Song 提交于
      Since test_sock_addr is not supposed to run by itself,
      remove it from TEST_GEN_PROGS and add it to
      TEST_GEN_PROGS_EXTENDED. This way, run_tests will
      not run test_sock_addr. The corresponding test to run
      is test_sock_addr.sh.
      Signed-off-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      6595c742
  19. 20 4月, 2018 1 次提交
    • M
      bpf: btf: Add BTF tests · c0fa1b6c
      Martin KaFai Lau 提交于
      This patch tests the BTF loading, map_create with BTF
      and the changes in libbpf.
      
      -r: Raw tests that test raw crafted BTF data
      -f: Test LLVM compiled bpf prog with BTF data
      -g: Test BPF_OBJ_GET_INFO_BY_FD for btf_fd
      -p: Test pretty print
      
      The tools/testing/selftests/bpf/Makefile will probe
      for BTF support in llc and pahole before generating
      debug info (-g) and convert them to BTF.  You can supply
      the BTF supported binary through the following make variables:
      LLC, BTF_PAHOLE and LLVM_OBJCOPY.
      
      LLC: The lastest llc with -mattr=dwarfris support for the bpf target.
           It is only in the master of the llvm repo for now.
      BTF_PAHOLE: The modified pahole with BTF support:
      	    https://github.com/iamkafai/pahole/tree/btf
      	    To add a BTF section: "pahole -J bpf_prog.o"
      LLVM_OBJCOPY: Any llvm-objcopy should do
      Signed-off-by: NMartin KaFai Lau <kafai@fb.com>
      Acked-by: NAlexei Starovoitov <ast@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      c0fa1b6c
  20. 19 4月, 2018 1 次提交
  21. 31 3月, 2018 3 次提交
    • A
      selftests/bpf: Selftest for sys_bind post-hooks. · 1d436885
      Andrey Ignatov 提交于
      Add selftest for attach types `BPF_CGROUP_INET4_POST_BIND` and
      `BPF_CGROUP_INET6_POST_BIND`.
      
      The main things tested are:
      * prog load behaves as expected (valid/invalid accesses in prog);
      * prog attach behaves as expected (load- vs attach-time attach types);
      * `BPF_CGROUP_INET_SOCK_CREATE` can be attached in a backward compatible
        way;
      * post-hooks return expected result and errno.
      
      Example:
        # ./test_sock
        Test case: bind4 load with invalid access: src_ip6 .. [PASS]
        Test case: bind4 load with invalid access: mark .. [PASS]
        Test case: bind6 load with invalid access: src_ip4 .. [PASS]
        Test case: sock_create load with invalid access: src_port .. [PASS]
        Test case: sock_create load w/o expected_attach_type (compat mode) ..
        [PASS]
        Test case: sock_create load w/ expected_attach_type .. [PASS]
        Test case: attach type mismatch bind4 vs bind6 .. [PASS]
        Test case: attach type mismatch bind6 vs bind4 .. [PASS]
        Test case: attach type mismatch default vs bind4 .. [PASS]
        Test case: attach type mismatch bind6 vs sock_create .. [PASS]
        Test case: bind4 reject all .. [PASS]
        Test case: bind6 reject all .. [PASS]
        Test case: bind6 deny specific IP & port .. [PASS]
        Test case: bind4 allow specific IP & port .. [PASS]
        Test case: bind4 allow all .. [PASS]
        Test case: bind6 allow all .. [PASS]
        Summary: 16 PASSED, 0 FAILED
      Signed-off-by: NAndrey Ignatov <rdna@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      1d436885
    • A
      selftests/bpf: Selftest for sys_connect hooks · 622adafb
      Andrey Ignatov 提交于
      Add selftest for BPF_CGROUP_INET4_CONNECT and BPF_CGROUP_INET6_CONNECT
      attach types.
      
      Try to connect(2) to specified IP:port and test that:
      * remote IP:port pair is overridden;
      * local end of connection is bound to specified IP.
      
      All combinations of IPv4/IPv6 and TCP/UDP are tested.
      
      Example:
        # tcpdump -pn -i lo -w connect.pcap 2>/dev/null &
        [1] 478
        # strace -qqf -e connect -o connect.trace ./test_sock_addr.sh
        Wait for testing IPv4/IPv6 to become available ... OK
        Load bind4 with invalid type (can pollute stderr) ... REJECTED
        Load bind4 with valid type ... OK
        Attach bind4 with invalid type ... REJECTED
        Attach bind4 with valid type ... OK
        Load connect4 with invalid type (can pollute stderr) libbpf: load bpf \
          program failed: Permission denied
        libbpf: -- BEGIN DUMP LOG ---
        libbpf:
        0: (b7) r2 = 23569
        1: (63) *(u32 *)(r1 +24) = r2
        2: (b7) r2 = 16777343
        3: (63) *(u32 *)(r1 +4) = r2
        invalid bpf_context access off=4 size=4
        [ 1518.404609] random: crng init done
      
        libbpf: -- END LOG --
        libbpf: failed to load program 'cgroup/connect4'
        libbpf: failed to load object './connect4_prog.o'
        ... REJECTED
        Load connect4 with valid type ... OK
        Attach connect4 with invalid type ... REJECTED
        Attach connect4 with valid type ... OK
        Test case #1 (IPv4/TCP):
                Requested: bind(192.168.1.254, 4040) ..
                   Actual: bind(127.0.0.1, 4444)
                Requested: connect(192.168.1.254, 4040) from (*, *) ..
                   Actual: connect(127.0.0.1, 4444) from (127.0.0.4, 56068)
        Test case #2 (IPv4/UDP):
                Requested: bind(192.168.1.254, 4040) ..
                   Actual: bind(127.0.0.1, 4444)
                Requested: connect(192.168.1.254, 4040) from (*, *) ..
                   Actual: connect(127.0.0.1, 4444) from (127.0.0.4, 56447)
        Load bind6 with invalid type (can pollute stderr) ... REJECTED
        Load bind6 with valid type ... OK
        Attach bind6 with invalid type ... REJECTED
        Attach bind6 with valid type ... OK
        Load connect6 with invalid type (can pollute stderr) libbpf: load bpf \
          program failed: Permission denied
        libbpf: -- BEGIN DUMP LOG ---
        libbpf:
        0: (b7) r6 = 0
        1: (63) *(u32 *)(r1 +12) = r6
        invalid bpf_context access off=12 size=4
      
        libbpf: -- END LOG --
        libbpf: failed to load program 'cgroup/connect6'
        libbpf: failed to load object './connect6_prog.o'
        ... REJECTED
        Load connect6 with valid type ... OK
        Attach connect6 with invalid type ... REJECTED
        Attach connect6 with valid type ... OK
        Test case #3 (IPv6/TCP):
                Requested: bind(face:b00c:1234:5678::abcd, 6060) ..
                   Actual: bind(::1, 6666)
                Requested: connect(face:b00c:1234:5678::abcd, 6060) from (*, *)
                   Actual: connect(::1, 6666) from (::6, 37458)
        Test case #4 (IPv6/UDP):
                Requested: bind(face:b00c:1234:5678::abcd, 6060) ..
                   Actual: bind(::1, 6666)
                Requested: connect(face:b00c:1234:5678::abcd, 6060) from (*, *)
                   Actual: connect(::1, 6666) from (::6, 39315)
        ### SUCCESS
        # egrep 'connect\(.*AF_INET' connect.trace | \
        > egrep -vw 'htons\(1025\)' | fold -b -s -w 72
        502   connect(7, {sa_family=AF_INET, sin_port=htons(4040),
        sin_addr=inet_addr("192.168.1.254")}, 128) = 0
        502   connect(8, {sa_family=AF_INET, sin_port=htons(4040),
        sin_addr=inet_addr("192.168.1.254")}, 128) = 0
        502   connect(9, {sa_family=AF_INET6, sin6_port=htons(6060),
        inet_pton(AF_INET6, "face:b00c:1234:5678::abcd", &sin6_addr),
        sin6_flowinfo=0, sin6_scope_id=0}, 128) = 0
        502   connect(10, {sa_family=AF_INET6, sin6_port=htons(6060),
        inet_pton(AF_INET6, "face:b00c:1234:5678::abcd", &sin6_addr),
        sin6_flowinfo=0, sin6_scope_id=0}, 128) = 0
        # fg
        tcpdump -pn -i lo -w connect.pcap 2> /dev/null
        # tcpdump -r connect.pcap -n tcp | cut -c 1-72
        reading from file connect.pcap, link-type EN10MB (Ethernet)
        17:57:40.383533 IP 127.0.0.4.56068 > 127.0.0.1.4444: Flags [S], seq 1333
        17:57:40.383566 IP 127.0.0.1.4444 > 127.0.0.4.56068: Flags [S.], seq 112
        17:57:40.383589 IP 127.0.0.4.56068 > 127.0.0.1.4444: Flags [.], ack 1, w
        17:57:40.384578 IP 127.0.0.1.4444 > 127.0.0.4.56068: Flags [R.], seq 1,
        17:57:40.403327 IP6 ::6.37458 > ::1.6666: Flags [S], seq 406513443, win
        17:57:40.403357 IP6 ::1.6666 > ::6.37458: Flags [S.], seq 2448389240, ac
        17:57:40.403376 IP6 ::6.37458 > ::1.6666: Flags [.], ack 1, win 342, opt
        17:57:40.404263 IP6 ::1.6666 > ::6.37458: Flags [R.], seq 1, ack 1, win
      Signed-off-by: NAndrey Ignatov <rdna@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      622adafb
    • A
      selftests/bpf: Selftest for sys_bind hooks · e50b0a6f
      Andrey Ignatov 提交于
      Add selftest to work with bpf_sock_addr context from
      `BPF_PROG_TYPE_CGROUP_SOCK_ADDR` programs.
      
      Try to bind(2) on IP:port and apply:
      * loads to make sure context can be read correctly, including narrow
        loads (byte, half) for IP and full-size loads (word) for all fields;
      * stores to those fields allowed by verifier.
      
      All combination from IPv4/IPv6 and TCP/UDP are tested.
      
      Both scenarios are tested:
      * valid programs can be loaded and attached;
      * invalid programs can be neither loaded nor attached.
      
      Test passes when expected data can be read from context in the
      BPF-program, and after the call to bind(2) socket is bound to IP:port
      pair that was written by BPF-program to the context.
      
      Example:
        # ./test_sock_addr
        Attached bind4 program.
        Test case #1 (IPv4/TCP):
                Requested: bind(192.168.1.254, 4040) ..
                   Actual: bind(127.0.0.1, 4444)
        Test case #2 (IPv4/UDP):
                Requested: bind(192.168.1.254, 4040) ..
                   Actual: bind(127.0.0.1, 4444)
        Attached bind6 program.
        Test case #3 (IPv6/TCP):
                Requested: bind(face:b00c:1234:5678::abcd, 6060) ..
                   Actual: bind(::1, 6666)
        Test case #4 (IPv6/UDP):
                Requested: bind(face:b00c:1234:5678::abcd, 6060) ..
                   Actual: bind(::1, 6666)
        ### SUCCESS
      Signed-off-by: NAndrey Ignatov <rdna@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      e50b0a6f
  22. 20 3月, 2018 1 次提交
  23. 15 3月, 2018 1 次提交
  24. 14 2月, 2018 1 次提交
    • J
      selftests/bpf: fix Makefile for cgroup_helpers.c · 41757dcb
      Jesper Dangaard Brouer 提交于
      The current selftests Makefile construct result in cgroup_helpers.c
      gets compiled together with all the TEST_GEN_PROGS. And it also result
      in invoking the libbpf Makefile two times (tools/lib/bpf).
      
      These issues were introduced in commit 9d1f1594 ("bpf: move
      cgroup_helpers from samples/bpf/ to tools/testing/selftesting/bpf/").
      
      The only test program that requires the cgroup helpers is 'test_dev_cgroup'.
      
      Thus, create a make target $(OUTPUT)/test_dev_cgroup that extend[1]
      the 'prerequisite' for the 'stem' %-style pattern in ../lib.mk,
      for this particular test program.
      
      Reviewers notice the make-rules in tools/testing/selftests/lib.mk
      differ from the normal kernel kbuild rules, and it is practical
      to use 'make -p' to follow how these 'Implicit/static pattern stem'
      gets expanded.
      
      [1] https://www.gnu.org/software/make/manual/html_node/Static-Usage.html
      
      Fixes: 9d1f1594 ("bpf: move cgroup_helpers from samples/bpf/ to tools/testing/selftesting/bpf/")
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      41757dcb
  25. 09 2月, 2018 2 次提交
  26. 01 2月, 2018 1 次提交
  27. 27 1月, 2018 1 次提交
  28. 26 1月, 2018 1 次提交
  29. 19 1月, 2018 1 次提交
  30. 07 1月, 2018 1 次提交
  31. 22 12月, 2017 1 次提交
  32. 20 12月, 2017 1 次提交
  33. 18 12月, 2017 2 次提交
  34. 13 12月, 2017 1 次提交
    • D
      bpf: fix broken BPF selftest build · 720f228e
      Daniel Borkmann 提交于
      At least on x86_64, the kernel's BPF selftests seemed to have stopped
      to build due to 618e165b ("selftests/bpf: sync kernel headers and
      introduce arch support in Makefile"):
      
        [...]
        In file included from test_verifier.c:29:0:
        ../../../include/uapi/linux/bpf_perf_event.h:11:32:
           fatal error: asm/bpf_perf_event.h: No such file or directory
         #include <asm/bpf_perf_event.h>
                                      ^
        compilation terminated.
        [...]
      
      While pulling in tools/arch/*/include/uapi/asm/bpf_perf_event.h seems
      to work fine, there's no automated fall-back logic right now that would
      do the same out of tools/include/uapi/asm-generic/bpf_perf_event.h. The
      usual convention today is to add a include/[uapi/]asm/ equivalent that
      would pull in the correct arch header or generic one as fall-back, all
      ifdef'ed based on compiler target definition. It's similarly done also
      in other cases such as tools/include/asm/barrier.h, thus adapt the same
      here.
      
      Fixes: 618e165b ("selftests/bpf: sync kernel headers and introduce arch support in Makefile")
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      720f228e