Skip to content
Snippets Groups Projects
  1. Feb 26, 2020
    • Stefano Brivio's avatar
      selftests: nft_concat_range: Add test for reported add/flush/add issue · 0954df70
      Stefano Brivio authored
      
      Add a specific test for the crash reported by Phil Sutter and addressed
      in the previous patch. The test cases that, in my intention, should
      have covered these cases, that is, the ones from the 'concurrency'
      section, don't run these sequences tightly enough and spectacularly
      failed to catch this.
      
      While at it, define a convenient way to add these kind of tests, by
      adding a "reported issues" test section.
      
      It's more convenient, for this particular test, to execute the set
      setup in its own function. However, future test cases like this one
      might need to call setup functions, and will typically need no tools
      other than nft, so allow for this in check_tools().
      
      The original form of the reproducer used here was provided by Phil.
      
      Reported-by: default avatarPhil Sutter <phil@nwl.cc>
      Signed-off-by: default avatarStefano Brivio <sbrivio@redhat.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      0954df70
  2. Feb 25, 2020
  3. Feb 21, 2020
  4. Feb 20, 2020
  5. Feb 19, 2020
  6. Feb 18, 2020
  7. Feb 17, 2020
    • Jason A. Donenfeld's avatar
      wireguard: selftests: reduce complexity and fix make races · 04ddf120
      Jason A. Donenfeld authored
      
      This gives us fewer dependencies and shortens build time, fixes up some
      hash checking race conditions, and also fixes missing directory creation
      that caused issues on massively parallel builds.
      
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      04ddf120
    • Hangbin Liu's avatar
      selftests: forwarding: vxlan_bridge_1d: fix tos value · 4e867c9a
      Hangbin Liu authored
      
      After commit 71130f29 ("vxlan: fix tos value before xmit") we start
      strict vxlan xmit tos value by RT_TOS(), which limits the tos value less
      than 0x1E. With current value 0x40 the test will failed with "v1: Expected
      to capture 10 packets, got 0". So let's choose a smaller tos value for
      testing.
      
      Fixes: d417ecf5 ("selftests: forwarding: vxlan_bridge_1d: Add a TOS test")
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4e867c9a
    • Benjamin Poirier's avatar
      ipv6: Fix route replacement with dev-only route · e404b8c7
      Benjamin Poirier authored
      
      After commit 27596472 ("ipv6: fix ECMP route replacement") it is no
      longer possible to replace an ECMP-able route by a non ECMP-able route.
      For example,
      	ip route add 2001:db8::1/128 via fe80::1 dev dummy0
      	ip route replace 2001:db8::1/128 dev dummy0
      does not work as expected.
      
      Tweak the replacement logic so that point 3 in the log of the above commit
      becomes:
      3. If the new route is not ECMP-able, and no matching non-ECMP-able route
      exists, replace matching ECMP-able route (if any) or add the new route.
      
      We can now summarize the entire replace semantics to:
      When doing a replace, prefer replacing a matching route of the same
      "ECMP-able-ness" as the replace argument. If there is no such candidate,
      fallback to the first route found.
      
      Fixes: 27596472 ("ipv6: fix ECMP route replacement")
      Signed-off-by: default avatarBenjamin Poirier <bpoirier@cumulusnetworks.com>
      Reviewed-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e404b8c7
    • Hangbin Liu's avatar
      selftests: forwarding: use proto icmp for {gretap, ip6gretap}_mac testing · e8023b03
      Hangbin Liu authored
      
      For tc ip_proto filter, when we extract the flow via __skb_flow_dissect()
      without flag FLOW_DISSECTOR_F_STOP_AT_ENCAP, we will continue extract to
      the inner proto.
      
      So for GRE + ICMP messages, we should not track GRE proto, but inner ICMP
      proto.
      
      For test mirror_gre.sh, it may make user confused if we capture ICMP
      message on $h3(since the flow is GRE message). So I move the capture
      dev to h3-gt{4,6}, and only capture ICMP message.
      
      Before the fix:
      ]# ./mirror_gre.sh
      TEST: ingress mirror to gretap (skip_hw)                            [ OK ]
      TEST: egress mirror to gretap (skip_hw)                             [ OK ]
      TEST: ingress mirror to ip6gretap (skip_hw)                         [ OK ]
      TEST: egress mirror to ip6gretap (skip_hw)                          [ OK ]
      TEST: ingress mirror to gretap: envelope MAC (skip_hw)              [FAIL]
       Expected to capture 10 packets, got 0.
      TEST: egress mirror to gretap: envelope MAC (skip_hw)               [FAIL]
       Expected to capture 10 packets, got 0.
      TEST: ingress mirror to ip6gretap: envelope MAC (skip_hw)           [FAIL]
       Expected to capture 10 packets, got 0.
      TEST: egress mirror to ip6gretap: envelope MAC (skip_hw)            [FAIL]
       Expected to capture 10 packets, got 0.
      TEST: two simultaneously configured mirrors (skip_hw)               [ OK ]
      WARN: Could not test offloaded functionality
      
      After fix:
      ]# ./mirror_gre.sh
      TEST: ingress mirror to gretap (skip_hw)                            [ OK ]
      TEST: egress mirror to gretap (skip_hw)                             [ OK ]
      TEST: ingress mirror to ip6gretap (skip_hw)                         [ OK ]
      TEST: egress mirror to ip6gretap (skip_hw)                          [ OK ]
      TEST: ingress mirror to gretap: envelope MAC (skip_hw)              [ OK ]
      TEST: egress mirror to gretap: envelope MAC (skip_hw)               [ OK ]
      TEST: ingress mirror to ip6gretap: envelope MAC (skip_hw)           [ OK ]
      TEST: egress mirror to ip6gretap: envelope MAC (skip_hw)            [ OK ]
      TEST: two simultaneously configured mirrors (skip_hw)               [ OK ]
      WARN: Could not test offloaded functionality
      
      Fixes: ba8d3987 ("selftests: forwarding: Add test for mirror to gretap")
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Reviewed-by: default avatarPetr Machata <pmachata@gmail.com>
      Tested-by: default avatarPetr Machata <pmachata@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e8023b03
  8. Feb 14, 2020
    • Arnaldo Carvalho de Melo's avatar
      perf llvm: Fix script used to obtain kernel make directives to work with new kbuild · 62765941
      Arnaldo Carvalho de Melo authored
      
      Before this patch:
      
        # ./perf test 39 41
        39: LLVM search and compile                               :
        39.1: Basic BPF llvm compile                              : Ok
        39.2: kbuild searching                                    : FAILED!
        39.3: Compile source for BPF prologue generation          : Skip
        39.4: Compile source for BPF relocation                   : Skip
        41: BPF filter                                            :
        41.1: Basic BPF filtering                                 : Ok
        41.2: BPF pinning                                         : Ok
        41.3: BPF prologue generation                             : FAILED!
        41.4: BPF relocation checker                              : Skip
        #
      
      Using 'perf test -v' for these tests shows that it is not finding
      uapi/linux/fs.h, which ends up being because we don't setup the right header
      path. Fix it.
      
      After this patch:
      
        # perf test 39 41
        39: LLVM search and compile                               :
        39.1: Basic BPF llvm compile                              : Ok
        39.2: kbuild searching                                    : Ok
        39.3: Compile source for BPF prologue generation          : Ok
        39.4: Compile source for BPF relocation                   : Ok
        41: BPF filter                                            :
        41.1: Basic BPF filtering                                 : Ok
        41.2: BPF pinning                                         : Ok
        41.3: BPF prologue generation                             : Ok
        41.4: BPF relocation checker                              : Ok
        #
      
      Longer description:
      
      In llvm-utils.c we use some techniques to obtain the kbuild make
      directives and that recently stopped working as now 'ar' gets called and
      expects to find the dummy.o used to echo these variables:
      
        $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS)
      
      Add the $(CC) line to satisfy that, making sure this works with all
      kernels, i.e. preserving the temp directory and files in it used for
      this technique we can see that it works everywhere:
      
        # make -s -C /lib/modules/5.4.18-100.fc30.x86_64/build M=/tmp/tmp.qgaFHgxjZ4/ clean
        # ls -la /tmp/tmp.qgaFHgxjZ4/
        total 4
        drwx------.  2 root root   80 Feb 14 09:42 .
        drwxrwxrwt. 47 root root 1200 Feb 14 09:42 ..
        -rw-r--r--.  1 root root    0 Feb 13 17:14 dummy.c
        -rw-r--r--.  1 root root  121 Feb 13 17:14 Makefile
        #
        # cat /tmp/tmp.qgaFHgxjZ4/Makefile
        obj-y := dummy.o
        $(obj)/%.o: $(src)/%.c
                @echo -n "$(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS)"
                $(CC) -c -o $@ $<
        #
      
      Then build with an old kernel Makefile:
      
        # make -s -C /lib/modules/5.4.18-100.fc30.x86_64/build M=/tmp/tmp.qgaFHgxjZ4/ dummy.o
        -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/9/include -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h
        #
        # ls -la /tmp/tmp.qgaFHgxjZ4/
        total 8
        drwx------.  2 root root  100 Feb 14 09:43 .
        drwxrwxrwt. 47 root root 1200 Feb 14 09:43 ..
        -rw-r--r--.  1 root root    0 Feb 13 17:14 dummy.c
        -rw-r--r--.  1 root root  936 Feb 14 09:43 dummy.o
        -rw-r--r--.  1 root root  121 Feb 13 17:14 Makefile
        #
      
      And a new one:
      
        # make -s -C /lib/modules/5.4.18-100.fc30.x86_64/build M=/tmp/tmp.qgaFHgxjZ4/ clean
        # ls -la /tmp/tmp.qgaFHgxjZ4/
        total 4
        drwx------.  2 root root   80 Feb 14 09:43 .
        drwxrwxrwt. 47 root root 1200 Feb 14 09:43 ..
        -rw-r--r--.  1 root root    0 Feb 13 17:14 dummy.c
        -rw-r--r--.  1 root root  121 Feb 13 17:14 Makefile
        # make -s -C /lib/modules/5.6.0-rc1+/build M=/tmp/tmp.qgaFHgxjZ4/ dummy.o
         -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/9/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h
        #
        # ls -la /tmp/tmp.qgaFHgxjZ4/
        total 16
        drwx------.  2 root root  160 Feb 14 09:44 .
        drwxrwxrwt. 47 root root 1200 Feb 14 09:44 ..
        -rw-r--r--.  1 root root  158 Feb 14 09:44 built-in.a
        -rw-r--r--.  1 root root  149 Feb 14 09:44 .built-in.a.cmd
        -rw-r--r--.  1 root root    0 Feb 13 17:14 dummy.c
        -rw-r--r--.  1 root root  936 Feb 14 09:44 dummy.o
        -rw-r--r--.  1 root root  121 Feb 13 17:14 Makefile
        -rw-r--r--.  1 root root    0 Feb 14 09:44 modules.order
        #
      
      Reported-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Tested-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Link: https://www.spinics.net/lists/linux-perf-users/msg10600.html
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      62765941
  9. Feb 13, 2020
    • Jason A. Donenfeld's avatar
      wireguard: device: use icmp_ndo_send helper · a12d7f3c
      Jason A. Donenfeld authored
      
      Because wireguard is calling icmp from network device context, it should
      use the ndo helper so that the rate limiting applies correctly.  This
      commit adds a small test to the wireguard test suite to ensure that the
      new functions continue doing the right thing in the context of
      wireguard. It does this by setting up a condition that will definately
      evoke an icmp error message from the driver, but along a nat'd path.
      
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a12d7f3c
    • Aleksa Sarai's avatar
      selftests: openat2: fix build error on newer glibc · 9a0584f0
      Aleksa Sarai authored
      
      It appears that newer glibcs check that openat(O_CREAT) was provided a
      fourth argument (rather than passing garbage), resulting in the
      following build error:
      
      > In file included from /usr/include/fcntl.h:301,
      >                  from helpers.c:9:
      > In function 'openat',
      >     inlined from 'touchat' at helpers.c:49:11:
      > /usr/include/x86_64-linux-gnu/bits/fcntl2.h:126:4: error: call to
      > '__openat_missing_mode' declared with attribute error: openat with O_CREAT
      > or O_TMPFILE in third argument needs 4 arguments
      >   126 |    __openat_missing_mode ();
      >       |    ^~~~~~~~~~~~~~~~~~~~~~~~
      
      Reported-by: default avatarShuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAleksa Sarai <cyphar@cyphar.com>
      Tested-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      9a0584f0
    • Dmitry Safonov's avatar
      selftests: use LDLIBS for libraries instead of LDFLAGS · 3e839363
      Dmitry Safonov authored
      While building selftests, the following errors were observed:
      > tools/testing/selftests/timens'
      > gcc -Wall -Werror -pthread  -lrt -ldl  timens.c  -o tools/testing/selftests/timens/timens
      > /usr/bin/ld: /tmp/ccGy5CST.o: in function `check_config_posix_timers':
      > timens.c:(.text+0x65a): undefined reference to `timer_create'
      > collect2: error: ld returned 1 exit status
      
      Quoting commit 870f193d ("selftests: net: use LDLIBS instead of
      LDFLAGS"):
      
      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.
      
      While at here, correct other selftests, not only timens ones.
      
      Reported-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarDmitry Safonov <dima@arista.com>
      Tested-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      3e839363
  10. Feb 12, 2020
  11. Feb 11, 2020
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync sched.h with the kernel · d6d829d9
      Arnaldo Carvalho de Melo authored
      
      To get the changes in:
      
        769071ac ("ns: Introduce Time Namespace")
      
      Silencing this tools/perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/sched.h' differs from latest version at 'include/uapi/linux/sched.h'
        diff -u tools/include/uapi/linux/sched.h include/uapi/linux/sched.h
      
      Which enables 'perf trace' to decode the CLONE_NEWTIME bit in the
      'flags' argument to the clone syscalls.
      
      Example of clone flags being decoded:
      
        [root@quaco ~]# perf trace -e clone*
             0.000 qemu-system-x8/23923 clone(clone_flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, newsp: 0x7f0dad7f9870, parent_tidptr: 0x7f0dad7fa9d0, child_tidptr: 0x7f0dad7fa9d0, tls: 0x7f0dad7fa700) = 6806 (qemu-system-x86)
                 ? qemu-system-x8/6806  ... [continued]: clone())              = 0
        ^C[root@quaco ~]#
      
      At some point this should enable things like:
      
        # perf trace -e 'clone*/clone_flags&NEWTIME/'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andrei Vagin <avagin@openvz.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d6d829d9
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Resolve prctl's 'option' arg strings to numbers · d7a07b29
      Arnaldo Carvalho de Melo authored
      
        # perf trace -e syscalls:sys_enter_prctl --filter="option==SET_NAME"
           0.000 Socket Thread/3860 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7fc50b9733e8)
           0.053 SSL Cert #78/3860 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7fc50b9733e8)
      ^C  #
      
      If one uses '-v' with 'perf trace', we can see the filter it puts in
      place:
      
        New filter for syscalls:sys_enter_prctl: (option==0xf) && (common_pid != 3859 && common_pid != 2757)
      
      We still need to allow using plain '-e prctl' and have this turn into
      creating a 'syscalls:sys_enter_prctl' event so that the filter can be
      applied only to it as right now '-e prctl' ends up using the
      'raw_syscalls:sys_enter/sys_exit'.
      
      The end goal is to have something like:
      
        # perf trace -e prctl/option==SET_NAME/
      
      And have that use tracepoint filters or eBPF ones.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d7a07b29
Loading