1. 17 Jan, 2019 4 commits
  2. 16 Jan, 2019 8 commits
    • Davide Caratti's avatar
      selftests: tc-testing: fix parsing of ife type · 91fa038d
      Davide Caratti authored
      In iproute2 commit 90c5c969f0b9 ("fix print_0xhex on 32 bit"), the format
      specifier for the ife type changed from 0x%X to %#llX, causing systematic
      failures in the following TDC test cases:
      
       7682 - Create valid ife encode action with mark and pass control
       ef47 - Create valid ife encode action with mark and pipe control
       df43 - Create valid ife encode action with mark and continue control
       e4cf - Create valid ife encode action with mark and drop control
       ccba - Create valid ife encode action with mark and reclassify control
       a1cf - Create valid ife encode action with mark and jump control
       cb3d - Create valid ife encode action with mark value at 32-bit maximum
       95ed - Create valid ife encode action with prio and pass control
       aa17 - Create valid ife encode action with prio and pipe control
       74c7 - Create valid ife encode action with prio and continue control
       7a97 - Create valid ife encode action with prio and drop control
       f66b - Create valid ife encode action with prio and reclassify control
       3056 - Create valid ife encode action with prio and jump control
       7dd3 - Create valid ife encode action with prio value at 32-bit maximum
       05bb - Create valid ife encode action with tcindex and pass control
       ce65 - Create valid ife encode action with tcindex and pipe control
       09cd - Create valid ife encode action with tcindex and continue control
       8eb5 - Create valid ife encode action with tcindex and continue control
       451a - Create valid ife encode action with tcindex and drop control
       d76c - Create valid ife encode action with tcindex and reclassify control
       e731 - Create valid ife encode action with tcindex and jump control
       b7b8 - Create valid ife encode action with tcindex value at 16-bit maximum
       2a9c - Create valid ife encode action with mac src parameter
       cf5c - Create valid ife encode action with mac dst parameter
       2353 - Create valid ife encode action with mac src and mac dst parameters
       552c - Create valid ife encode action with mark and type parameters
       0421 - Create valid ife encode action with prio and type parameters
       4017 - Create valid ife encode action with tcindex and type parameters
       fac3 - Create valid ife encode action with index at 32-bit maximnum
       7c25 - Create valid ife decode action with pass control
       dccb - Create valid ife decode action with pipe control
       7bb9 - Create valid ife decode action with continue control
       d9ad - Create valid ife decode action with drop control
       219f - Create valid ife decode action with reclassify control
       8f44 - Create valid ife decode action with jump control
       b330 - Create ife encode action with cookie
      
      Change 'matchPattern' values, allowing '0' and '0x0' if ife type is equal
      to 0, and accepting both '0x' and '0X' otherwise, to let these tests pass
      both with old and new tc binaries.
      While at it, fix a small typo in test case fac3 ('maximnum'->'maximum').
      Signed-off-by: 's avatarDavide Caratti <dcaratti@redhat.com>
      Acked-by: 's avatarStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
      91fa038d
    • Geert Uytterhoeven's avatar
      selftests: gpio-mockup-chardev: Check asprintf() for error · 508cacd7
      Geert Uytterhoeven authored
      With gcc 7.3.0:
      
          gpio-mockup-chardev.c: In function ‘get_debugfs’:
          gpio-mockup-chardev.c:62:3: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
             asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Handle asprintf() failures to fix this.
      Signed-off-by: 's avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: 's avatarShuah Khan <shuah@kernel.org>
      508cacd7
    • Yonghong Song's avatar
      tools/bpf: add bpffs pretty print test for int128 · 4df3a1d0
      Yonghong Song authored
      The bpffs pretty print test is extended to cover int128 types.
      Tested on an x64 machine.
        $ test_btf -p
        ......
        BTF pretty print array(#3)......OK
        PASS:9 SKIP:0 FAIL:0
      Acked-by: 's avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: 's avatarYonghong Song <yhs@fb.com>
      Signed-off-by: 's avatarDaniel Borkmann <daniel@iogearbox.net>
      4df3a1d0
    • Yonghong Song's avatar
      tools/bpf: refactor test_btf pretty printing for multiple map value formats · ce6ec47a
      Yonghong Song authored
      The test_btf pretty print is refactored in order to easily
      support multiple map value formats. The next patch will
      add __int128 type tests which needs macro guard __SIZEOF_INT128__.
      There is no functionality change with this patch.
      Acked-by: 's avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: 's avatarYonghong Song <yhs@fb.com>
      Signed-off-by: 's avatarDaniel Borkmann <daniel@iogearbox.net>
      ce6ec47a
    • Yonghong Song's avatar
      tools/bpf: add int128 raw test in test_btf · a80eba20
      Yonghong Song authored
      Several int128 raw type tests are added to test_btf.
      Currently these tests are enabled only for x64 and arm64
      for which kernel has CONFIG_ARCH_SUPPORTS_INT128 set.
      
        $ test_btf
        ......
        BTF raw test[106] (128-bit int): OK
        BTF raw test[107] (struct, 128-bit int member): OK
        BTF raw test[108] (struct, 120-bit int member bitfield): OK
        BTF raw test[109] (struct, kind_flag, 128-bit int member): OK
        BTF raw test[110] (struct, kind_flag, 120-bit int member bitfield): OK
        ......
      Acked-by: 's avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: 's avatarYonghong Song <yhs@fb.com>
      Signed-off-by: 's avatarDaniel Borkmann <daniel@iogearbox.net>
      a80eba20
    • Fathi Boudra's avatar
      selftests: seccomp: use LDLIBS instead of LDFLAGS · 5bbc73a8
      Fathi Boudra authored
      seccomp_bpf fails to build due to undefined reference errors:
      
       aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
       -O2 -pipe -g -feliminate-unused-debug-types -Wl,-no-as-needed -Wall
       -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lpthread seccomp_bpf.c -o
       /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf
       /tmp/ccrlR3MW.o: In function `tsync_sibling':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1920: undefined reference to `sem_post'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1920: undefined reference to `sem_post'
       /tmp/ccrlR3MW.o: In function `TSYNC_setup':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1863: undefined reference to `sem_init'
       /tmp/ccrlR3MW.o: In function `TSYNC_teardown':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1904: undefined reference to `sem_destroy'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1897: undefined reference to `pthread_kill'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1898: undefined reference to `pthread_cancel'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1899: undefined reference to `pthread_join'
       /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create'
       /tmp/ccrlR3MW.o: In function `TSYNC_siblings_fail_prctl':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1978: undefined reference to `sem_wait'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1990: undefined reference to `pthread_join'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1992: undefined reference to `pthread_join'
       /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create'
       /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_with_ancestor':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2016: undefined reference to `sem_wait'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2032: undefined reference to `pthread_join'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2034: undefined reference to `pthread_join'
       /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create'
       /tmp/ccrlR3MW.o: In function `TSYNC_two_sibling_want_nnp':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2046: undefined reference to `sem_wait'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2058: undefined reference to `pthread_join'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2060: undefined reference to `pthread_join'
       /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create'
       /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_with_no_filter':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2073: undefined reference to `sem_wait'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2098: undefined reference to `pthread_join'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2100: undefined reference to `pthread_join'
       /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create'
       /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_with_one_divergence':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2125: undefined reference to `sem_wait'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2143: undefined reference to `pthread_join'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2145: undefined reference to `pthread_join'
       /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create'
       /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_not_under_filter':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2169: undefined reference to `sem_wait'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2202: undefined reference to `pthread_join'
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2227: undefined reference to `pthread_join'
       /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
       /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create'
      
      It's GNU Make and linker specific.
      
      The default Makefile rule looks like:
      
      $(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)
      
      When linking is done by gcc itself, no issue, but when it needs to be passed
      to proper ld, only LDLIBS follows and then ld cannot know what libs to link
      with.
      
      More detail:
      https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
      
      LDFLAGS
      Extra flags to give to compilers when they are supposed to invoke the linker,
      ‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
      instead.
      
      LDLIBS
      Library flags or names given to compilers when they are supposed to invoke the
      linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
      LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
      variable.
      
      https://lkml.org/lkml/2010/2/10/362
      
      tools/perf: libraries must come after objects
      
      Link order matters, use LDLIBS instead of LDFLAGS to properly link against
      libpthread.
      Signed-off-by: 's avatarFathi Boudra <fathi.boudra@linaro.org>
      Acked-by: 's avatarKees Cook <keescook@chromium.org>
      Signed-off-by: 's avatarShuah Khan <shuah@kernel.org>
      5bbc73a8
    • Davide Caratti's avatar
      selftests: tc-testing: fix tunnel_key failure if dst_port is unspecified · 5216bd77
      Davide Caratti authored
      After commit 1c25324c ("net/sched: act_tunnel_key: Don't dump dst port
      if it wasn't set"), act_tunnel_key doesn't dump anymore the destination
      port, unless it was explicitly configured. This caused systematic failures
      in the following TDC test case:
      
       7a88 - Add tunnel_key action with cookie parameter
      
      Avoid matching zero values of TCA_TUNNEL_KEY_ENC_DST_PORT to let the test
      pass again.
      Signed-off-by: 's avatarDavide Caratti <dcaratti@redhat.com>
      Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
      5216bd77
    • Davide Caratti's avatar
      selftests: tc-testing: drop test on missing tunnel key id · e4136155
      Davide Caratti authored
      After merge of commit 80ef0f22 ("net/sched: act_tunnel_key: Allow
      key-less tunnels"), act_tunnel_key does not reject anymore requests to
      install 'set' rules where the key id is missing. Therefore, drop the
      following TDC testcase:
      
       ba4e - Add tunnel_key set action with missing mandatory id parameter
      
      because it's going to become a systematic fail as soon as userspace
      iproute2 will start supporting key-less tunnels.
      Signed-off-by: 's avatarDavide Caratti <dcaratti@redhat.com>
      Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
      e4136155
  3. 15 Jan, 2019 8 commits
  4. 11 Jan, 2019 2 commits
  5. 10 Jan, 2019 2 commits
  6. 09 Jan, 2019 3 commits
    • Florian Westphal's avatar
      xfrm: policy: fix infinite loop when merging src-nodes · 12750aba
      Florian Westphal authored
      With very small change to test script we can trigger softlockup due to
      bogus assignment of 'p' (policy to be examined) on restart.
      
      Previously the two to-be-merged nodes had same address/prefixlength pair,
      so no erase/reinsert was necessary, we only had to append the list from
      node a to b.
      
      If prefix lengths are different, the node has to be deleted and re-inserted
      into the tree, with the updated prefix length.  This was broken; due to
      bogus update to 'p' this loops forever.
      
      Add a 'restart' label and use that instead.
      
      While at it, don't perform the unneeded reinserts of the policies that
      are already sorted into the 'new' node.
      
      A previous patch in this series made xfrm_policy_inexact_list_reinsert()
      use the relative position indicator to sort policies according to age in
      case priorities are identical.
      
      Fixes: 6ac098b2 ("xfrm: policy: add 2nd-level saddr trees for inexact policies")
      Signed-off-by: 's avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: 's avatarSteffen Klassert <steffen.klassert@secunet.com>
      12750aba
    • Florian Westphal's avatar
      selftests: xfrm: alter htresh to trigger move of policies to hash table · fcf86f55
      Florian Westphal authored
      ... and back to inexact tree.
      Repeat ping test after each htresh change: lookup results must not change.
      Signed-off-by: 's avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: 's avatarSteffen Klassert <steffen.klassert@secunet.com>
      fcf86f55
    • Florian Westphal's avatar
      selftests: xfrm: add block rules with adjacent/overlapping subnets · 0977b238
      Florian Westphal authored
      The existing script lacks a policy pattern that triggers 'tree node
      merges' in the kernel.
      
      Consider adding policy affecting following subnet:
      pol1: dst 10.0.0.0/22
      pol2: dst 10.0.0.0/23 # adds to existing 10.0.0.0/22 node
      
      -> no problems here.  But now, lets consider reverse order:
      pol1: dst 10.0.0.0/24
      pol2: dst 10.0.0.0/23 # CANNOT add to existing node
      
      When second policy gets added, the kernel must check that the new node
      ("10.0.0.0/23") doesn't overlap with any existing subnet.
      
      Example:
      dst 10.0.0.0/24
      dst 10.0.0.1/24
      dst 10.0.0.0/23
      
      When the third policy gets added, the kernel must replace the nodes for
      the 10.0.0.0/24 and 10.0.0.1/24 policies with a single one and must merge
      all the subtrees/lists stored in those nodes into the new node.
      
      The existing test cases only have overlaps with a single node, so no
      merging takes place (we can always remove the 'old' node and replace
      it with the new subnet prefix).
      
      Add a few 'block policies' in a pattern that triggers this, with a priority
      that will make kernel prefer the 'esp' rules.
      
      Make sure the 'tunnel ping' tests still pass after they have been added.
      Signed-off-by: 's avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: 's avatarSteffen Klassert <steffen.klassert@secunet.com>
      0977b238
  7. 08 Jan, 2019 8 commits
  8. 07 Jan, 2019 1 commit
  9. 06 Jan, 2019 1 commit
  10. 05 Jan, 2019 1 commit
    • Andrey Ignatov's avatar
      selftests/bpf: Test [::] -> [::1] rewrite in sys_sendmsg in test_sock_addr · 976b4f3a
      Andrey Ignatov authored
      Test that sys_sendmsg BPF hook doesn't break sys_sendmsg behaviour to
      rewrite destination IPv6 = [::] with [::1] (BSD'ism).
      
      Two test cases are added:
      
      1) User passes dst IPv6 = [::] and BPF_CGROUP_UDP6_SENDMSG program
         doesn't touch it.
      
      2) User passes dst IPv6 != [::], but BPF_CGROUP_UDP6_SENDMSG program
         rewrites it with [::].
      
      In both cases [::1] is used by sys_sendmsg code eventually and datagram
      is sent successfully for unconnected UDP socket.
      
      Example of relevant output:
        Test case: sendmsg6: set dst IP = [::] (BSD'ism) .. [PASS]
        Test case: sendmsg6: preserve dst IP = [::] (BSD'ism) .. [PASS]
      Signed-off-by: 's avatarAndrey Ignatov <rdna@fb.com>
      Signed-off-by: 's avatarAlexei Starovoitov <ast@kernel.org>
      976b4f3a
  11. 04 Jan, 2019 1 commit
    • Peter Oskolkov's avatar
      selftests: net: fix/improve ip_defrag selftest · 3271a482
      Peter Oskolkov authored
      Commit ade44640 ("net: ipv4: do not handle duplicate fragments as
      overlapping") changed IPv4 defragmentation so that duplicate fragments,
      as well as _some_ fragments completely covered by previously delivered
      fragments, do not lead to the whole frag queue being discarded. This
      makes the existing ip_defrag selftest flaky.
      
      This patch
      * makes sure that negative IPv4 defrag tests generate truly overlapping
        fragments that trigger defrag queue drops;
      * tests that duplicate IPv4 fragments do not trigger defrag queue drops;
      * makes a couple of minor tweaks to the test aimed at increasing its code
        coverage and reduce flakiness.
      Signed-off-by: 's avatarPeter Oskolkov <posk@google.com>
      Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
      3271a482
  12. 03 Jan, 2019 1 commit