Skip to content
Snippets Groups Projects
  1. Mar 14, 2019
  2. Mar 12, 2019
  3. Mar 11, 2019
    • Linus Torvalds's avatar
      tools: mark 'test_vmalloc.sh' executable · 6bc3fe8e
      Linus Torvalds authored
      
      Several of these scripts have come in as old-fashioned patches, and in
      the process lost the executable bit.  In most cases it doesn't matter,
      since the test infrastructure will explicitly execute them using the
      proper shell interpreter, but at least in the case of the new vmalloc
      test, the lack of execurable bit caused the test to fail with
      
          ./run_vmtests: line 217: ./test_vmalloc.sh: Permission denied
      
      because of the lacking exectuable permissions bit.
      
      This patch fixes that up.
      
      NOTE! A simple script to look for non-executable scripts in the kernel,
      something like
      
          git ls-files --stage -- '*.sh' |
              grep 100644 |
              cut -f2 |
              xargs grep -l '#!'
      
      will show that there's a lot of other files that _look_ like executable
      shell scripts, but don't have the executable bit set.  I considered just
      scripting them all to be executable, but since it looks like the common
      pattern is to not really require it, I'm just doing the minimal fix as
      pointed out by the kernel test robot.
      
      Fixes: a05ef00c ("selftests/vm: add script helper for CONFIG_TEST_VMALLOC_MODULE")
      Reported-by: default avatarkernel test robot <rong.a.chen@intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Uladzislau Rezki <urezki@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6bc3fe8e
  4. Mar 08, 2019
  5. Mar 07, 2019
    • Daniel Borkmann's avatar
      bpf: fix replace_map_fd_with_map_ptr's ldimm64 second imm field · 20182390
      Daniel Borkmann authored
      
      Non-zero imm value in the second part of the ldimm64 instruction for
      BPF_PSEUDO_MAP_FD is invalid, and thus must be rejected. The map fd
      only ever sits in the first instructions' imm field. None of the BPF
      loaders known to us are using it, so risk of regression is minimal.
      For clarity and consistency, the few insn->{src_reg,imm} occurrences
      are rewritten into insn[0].{src_reg,imm}. Add a test case to the BPF
      selftest suite as well.
      
      Fixes: 0246e64d ("bpf: handle pseudo BPF_LD_IMM64 insn")
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarSong Liu <songliubraving@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      20182390
    • Stanislav Fomichev's avatar
      selftests: bpf: test_progs: initialize duration in singal_pending test · 69b09175
      Stanislav Fomichev authored
      
      CHECK macro implicitly uses duration. We call CHECK() a couple of times
      before duration is initialized from bpf_prog_test_run().
      Explicitly set duration to 0 to avoid compiler warnings.
      
      Fixes: 740f8a65 ("selftests/bpf: make sure signal interrupts BPF_PROG_TEST_RUN")
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      69b09175
    • Stanislav Fomichev's avatar
      libbpf: force fixdep compilation at the start of the build · 8e268887
      Stanislav Fomichev authored
      
      libbpf targets don't explicitly depend on fixdep target, so when
      we do 'make -j$(nproc)', there is a high probability, that some
      objects will be built before fixdep binary is available.
      
      Fix this by running sub-make; this makes sure that fixdep dependency
      is properly accounted for.
      
      For the same issue in perf, see commit abb26210 ("perf tools: Force
      fixdep compilation at the start of the build").
      
      Before:
      
      $ rm -rf /tmp/bld; mkdir /tmp/bld; make -j$(nproc) O=/tmp/bld -C tools/lib/bpf/
      
      Auto-detecting system features:
      ...                        libelf: [ on  ]
      ...                           bpf: [ on  ]
      
        HOSTCC   /tmp/bld/fixdep.o
        CC       /tmp/bld/libbpf.o
        CC       /tmp/bld/bpf.o
        CC       /tmp/bld/btf.o
        CC       /tmp/bld/nlattr.o
        CC       /tmp/bld/libbpf_errno.o
        CC       /tmp/bld/str_error.o
        CC       /tmp/bld/netlink.o
        CC       /tmp/bld/bpf_prog_linfo.o
        CC       /tmp/bld/libbpf_probes.o
        CC       /tmp/bld/xsk.o
        HOSTLD   /tmp/bld/fixdep-in.o
        LINK     /tmp/bld/fixdep
        LD       /tmp/bld/libbpf-in.o
        LINK     /tmp/bld/libbpf.a
        LINK     /tmp/bld/libbpf.so
        LINK     /tmp/bld/test_libbpf
      
      $ head /tmp/bld/.libbpf.o.cmd
       # cannot find fixdep (/usr/local/google/home/sdf/src/linux/xxx//fixdep)
       # using basic dep data
      
      /tmp/bld/libbpf.o: libbpf.c /usr/include/stdc-predef.h \
       /usr/include/stdlib.h /usr/include/features.h \
       /usr/include/x86_64-linux-gnu/sys/cdefs.h \
       /usr/include/x86_64-linux-gnu/bits/wordsize.h \
       /usr/include/x86_64-linux-gnu/gnu/stubs.h \
       /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
       /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
      
      After:
      
      $ rm -rf /tmp/bld; mkdir /tmp/bld; make -j$(nproc) O=/tmp/bld -C tools/lib/bpf/
      
      Auto-detecting system features:
      ...                        libelf: [ on  ]
      ...                           bpf: [ on  ]
      
        HOSTCC   /tmp/bld/fixdep.o
        HOSTLD   /tmp/bld/fixdep-in.o
        LINK     /tmp/bld/fixdep
        CC       /tmp/bld/libbpf.o
        CC       /tmp/bld/bpf.o
        CC       /tmp/bld/nlattr.o
        CC       /tmp/bld/btf.o
        CC       /tmp/bld/libbpf_errno.o
        CC       /tmp/bld/str_error.o
        CC       /tmp/bld/netlink.o
        CC       /tmp/bld/bpf_prog_linfo.o
        CC       /tmp/bld/libbpf_probes.o
        CC       /tmp/bld/xsk.o
        LD       /tmp/bld/libbpf-in.o
        LINK     /tmp/bld/libbpf.a
        LINK     /tmp/bld/libbpf.so
        LINK     /tmp/bld/test_libbpf
      
      $ head /tmp/bld/.libbpf.o.cmd
      cmd_/tmp/bld/libbpf.o := gcc -Wp,-MD,/tmp/bld/.libbpf.o.d -Wp,-MT,/tmp/bld/libbpf.o -g -Wall -DHAVE_LIBELF_MMAP_SUPPORT -DCOMPAT_NEED_REALLOCARRAY -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wstrict-aliasing=3 -Werror -Wall -fPIC -I. -I/usr/local/google/home/sdf/src/linux/tools/include -I/usr/local/google/home/sdf/src/linux/tools/arch/x86/include/uapi -I/usr/local/google/home/sdf/src/linux/tools/include/uapi -fvisibility=hidden -D"BUILD_STR(s)=$(pound)s" -c -o /tmp/bld/libbpf.o libbpf.c
      
      source_/tmp/bld/libbpf.o := libbpf.c
      
      deps_/tmp/bld/libbpf.o := \
        /usr/include/stdc-predef.h \
        /usr/include/stdlib.h \
        /usr/include/features.h \
        /usr/include/x86_64-linux-gnu/sys/cdefs.h \
        /usr/include/x86_64-linux-gnu/bits/wordsize.h \
      
      Fixes: 7c422f55 ("tools build: Build fixdep helper from perf and basic libs")
      Reported-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      8e268887
    • Stanislav Fomichev's avatar
      selftests: bpf: fix compilation with out-of-tree $(OUTPUT) · e78e00bd
      Stanislav Fomichev authored
      
      A bunch of related changes lumped together:
      * Create prog_tests and verifier output directories; these don't exist with
        out-of-tree $(OUTPUT)
      * Add missing -I (via separate TEST_{PROGS,VERIFIER}_CFLAGS) for the main tree
        ($(PWD) != $(OUTPUT) for out-of-tree)
      * Add libbpf.a dependency for test_progs_32 (parallel make fails otherwise)
      * Add missing "; \" after "cd" when generating test.h headers
      
      Tested by:
      $ alias m="make -s -j$(nproc)"
      $ m -C tools/testing/selftests/bpf/ clean
      $ m -C tools/lib/bpf/ clean
      $ rm -rf xxx; mkdir xxx; m -C tools/testing/selftests/bpf/ OUTPUT=$PWD/xxx
      $ m -C tools/testing/selftests/bpf/
      
      Fixes: 3f306588 ("selftests: bpf: break up test_progs - preparations")
      Fixes: 2dfb4012 ("selftests: bpf: prepare for break up of verifier tests")
      Fixes: 3ef84346 ("selftests: bpf: makefile support sub-register code-gen test mode")
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      e78e00bd
    • Peter Oskolkov's avatar
      selftests/bpf: test that GSO works in lwt_ip_encap · 17a90a78
      Peter Oskolkov authored
      
      Add a test on egress that a large TCP packet successfully goes through
      the lwt+bpf encap tunnel.
      
      Although there is no direct evidence that GSO worked, as opposed to
      e.g. TCP segmentation or IP fragmentation (maybe a kernel stats counter
      should be added to track the number of failed GSO attempts?), without
      the previous patch in the patchset this test fails, and printk-debugging
      showed that software-based GSO succeeded here (veth is not compatible with
      SKB_GSO_DODGY, so GSO happens in the software stack).
      
      Also removed an unnecessary nodad and added a missed failed flag.
      
      Signed-off-by: default avatarPeter Oskolkov <posk@google.com>
      Acked-by: default avatarSong Liu <songliubraving@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      17a90a78
  6. Mar 06, 2019
Loading