Re: [PATCH bpf-next v2 2/2] selftests/bpf: Make sure zero-len skbs aren't redirectable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 11/23/22 9:17 AM, sdf@xxxxxxxxxx wrote:
On 11/23, Yonghong Song wrote:


On 11/23/22 4:23 AM, Jiri Olsa wrote:
> On Mon, Nov 21, 2022 at 10:03:40AM -0800, Stanislav Fomichev wrote:
> > LWT_XMIT to test L3 case, TC to test L2 case.
> >
> > v2:
> > - s/veth_ifindex/ipip_ifindex/ in two places (Martin)
> > - add comment about which condition triggers the rejection (Martin)
> >
> > Signed-off-by: Stanislav Fomichev <sdf@xxxxxxxxxx>
>
> hi,
> I'm getting selftest fails and it looks like it's because of this test:
>
>     [root@qemu bpf]# ./test_progs -n 62,98
>     #62      empty_skb:OK
>     execute_one_variant:PASS:skel_open 0 nsec
>     execute_one_variant:PASS:my_pid_map_update 0 nsec
>     libbpf: failed to determine tracepoint 'raw_syscalls/sys_enter' perf event ID: No such file or directory >     libbpf: prog 'handle_legacy': failed to create tracepoint 'raw_syscalls/sys_enter' perf event: No such file or directory
>     libbpf: prog 'handle_legacy': failed to auto-attach: -2
>     execute_one_variant:FAIL:skel_attach unexpected error: -2 (errno 2)
>     test_legacy_printk:FAIL:legacy_case unexpected error: -2 (errno 2)
>     execute_one_variant:PASS:skel_open 0 nsec
>     libbpf: failed to determine tracepoint 'raw_syscalls/sys_enter' perf event ID: No such file or directory >     libbpf: prog 'handle_modern': failed to create tracepoint 'raw_syscalls/sys_enter' perf event: No such file or directory
>     libbpf: prog 'handle_modern': failed to auto-attach: -2
>     execute_one_variant:FAIL:skel_attach unexpected error: -2 (errno 2)
>     #98      legacy_printk:FAIL
>
>     All error logs:
>     execute_one_variant:PASS:skel_open 0 nsec
>     execute_one_variant:PASS:my_pid_map_update 0 nsec
>     libbpf: failed to determine tracepoint 'raw_syscalls/sys_enter' perf event ID: No such file or directory >     libbpf: prog 'handle_legacy': failed to create tracepoint 'raw_syscalls/sys_enter' perf event: No such file or directory
>     libbpf: prog 'handle_legacy': failed to auto-attach: -2
>     execute_one_variant:FAIL:skel_attach unexpected error: -2 (errno 2)
>     test_legacy_printk:FAIL:legacy_case unexpected error: -2 (errno 2)
>     execute_one_variant:PASS:skel_open 0 nsec
>     libbpf: failed to determine tracepoint 'raw_syscalls/sys_enter' perf event ID: No such file or directory >     libbpf: prog 'handle_modern': failed to create tracepoint 'raw_syscalls/sys_enter' perf event: No such file or directory
>     libbpf: prog 'handle_modern': failed to auto-attach: -2
>     execute_one_variant:FAIL:skel_attach unexpected error: -2 (errno 2)
>     #98      legacy_printk:FAIL
>     Summary: 1/0 PASSED, 0 SKIPPED, 1 FAILED
>
> when I run separately it passes:
>
>     [root@qemu bpf]# ./test_progs -n 98
>     #98      legacy_printk:OK
>     Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED
>
>
> it seems that the open_netns/close_netns does not work properly,
> and screw up access to tracefs for following tests
>
> if I comment out all the umounts in setns_by_fd, it does not fail

Agreed with the above observations.
With the current bpf-next, I can easily hit the above perf event ID issue.

But if I backout the following two patches:
68f8e3d4b916531ea3bb8b83e35138cf78f2fce5 selftests/bpf: Make sure zero-len
skbs aren't redirectable
114039b342014680911c35bd6b72624180fd669a bpf: Move skb->len == 0 checks into
__bpf_redirect


and run a few times with './test_progs -j' and I didn't hit any issues.

My guess would be that we need to remount debugfs in setns_by_fd?

diff --git a/tools/testing/selftests/bpf/network_helpers.c b/tools/testing/selftests/bpf/network_helpers.c
index bec15558fd93..1f37adff7632 100644
--- a/tools/testing/selftests/bpf/network_helpers.c
+++ b/tools/testing/selftests/bpf/network_helpers.c
@@ -426,6 +426,10 @@ static int setns_by_fd(int nsfd)
      if (!ASSERT_OK(err, "mount /sys/fs/bpf"))
          return err;

+    err = mount("debugfs", "/sys/kernel/debug", "debugfs", 0, NULL);
+    if (!ASSERT_OK(err, "mount /sys/kernel/debug"))
+        return err;
+
      return 0;
  }

Ya, this does fix the problem. Could you craft a patch for this?



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux