lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 8 Sep 2022 03:10:51 +0000
From:   "Zhou, Jie2X" <jie2x.zhou@...el.com>
To:     Ido Schimmel <idosch@...sch.org>,
        "kuba@...nel.org" <kuba@...nel.org>
CC:     "andrii@...nel.org" <andrii@...nel.org>,
        "mykolal@...com" <mykolal@...com>,
        "ast@...nel.org" <ast@...nel.org>,
        "daniel@...earbox.net" <daniel@...earbox.net>,
        "martin.lau@...ux.dev" <martin.lau@...ux.dev>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "hawk@...nel.org" <hawk@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        "linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Li, Philip" <philip.li@...el.com>,
        "petrm@...dia.com" <petrm@...dia.com>
Subject: Re: test ./tools/testing/selftests/bpf/test_offload.py failed

hi ido,

My error is  "Exception: Command failed: cat /sys/kernel/debug/netdevsim/netdevsim0//ports/0/dev/hwstats/l3/disable_ifindex"

Do you get [1]error, after patch [2]?

[1]
# bpftool prog load /home/idosch/code/linux/tools/testing/selftests/bpf/sample_ret0.o /sys/fs/bpf/nooffload type xdp
Error: object file doesn't contain any bpf program
Warning: bpftool is now running in libbpf strict mode and has more stringent requirements about BPF programs.
If it used to work for this object file but now doesn't, see --legacy option for more details.

[2]
diff --git a/drivers/net/netdevsim/hwstats.c b/drivers/net/netdevsim/hwstats.c
index 605a38e16db0..0e58aa7f0374 100644
--- a/drivers/net/netdevsim/hwstats.c
+++ b/drivers/net/netdevsim/hwstats.c
@@ -433,11 +433,11 @@ int nsim_dev_hwstats_init(struct nsim_dev *nsim_dev)
                goto err_remove_hwstats_recursive;
        }

-       debugfs_create_file("enable_ifindex", 0600, hwstats->l3_ddir, hwstats,
+       debugfs_create_file("enable_ifindex", 0200, hwstats->l3_ddir, hwstats,
                            &nsim_dev_hwstats_l3_enable_fops.fops);
-       debugfs_create_file("disable_ifindex", 0600, hwstats->l3_ddir, hwstats,
+       debugfs_create_file("disable_ifindex", 0200, hwstats->l3_ddir, hwstats,
                            &nsim_dev_hwstats_l3_disable_fops.fops);
-       debugfs_create_file("fail_next_enable", 0600, hwstats->l3_ddir, hwstats,
+       debugfs_create_file("fail_next_enable", 0200, hwstats->l3_ddir, hwstats,
                            &nsim_dev_hwstats_l3_fail_fops.fops);

        INIT_DELAYED_WORK(&hwstats->traffic_dw,

best regards,

________________________________________
From: Ido Schimmel <idosch@...sch.org>
Sent: Thursday, September 8, 2022 12:08 AM
To: Zhou, Jie2X; kuba@...nel.org
Cc: andrii@...nel.org; mykolal@...com; ast@...nel.org; daniel@...earbox.net; martin.lau@...ux.dev; davem@...emloft.net; kuba@...nel.org; hawk@...nel.org; netdev@...r.kernel.org; bpf@...r.kernel.org; linux-kselftest@...r.kernel.org; linux-kernel@...r.kernel.org; Li, Philip; petrm@...dia.com
Subject: Re: test ./tools/testing/selftests/bpf/test_offload.py failed

On Wed, Sep 07, 2022 at 08:51:56AM +0000, Zhou, Jie2X wrote:
> What is the output of test_offload.py?

This output [1], but requires this [2] additional fix on top of the one
I already posted for netdevsim. Hopefully someone more familiar with
this test can comment if this is the right fix or not.

Without it, bpftool refuses to load the program [3].

[1]
# ./test_offload.py
Test destruction of generic XDP...
Test TC non-offloaded...
Test TC non-offloaded isn't getting bound...
Test TC offloads are off by default...
[...]
test_offload.py: OK
# echo $?
0

[2]
diff --git a/tools/testing/selftests/bpf/progs/sample_map_ret0.c b/tools/testing/selftests/bpf/progs/sample_map_ret0.c
index 495990d355ef..91417aae6194 100644
--- a/tools/testing/selftests/bpf/progs/sample_map_ret0.c
+++ b/tools/testing/selftests/bpf/progs/sample_map_ret0.c
@@ -17,7 +17,8 @@ struct {
 } array SEC(".maps");

 /* Sample program which should always load for testing control paths. */
-SEC(".text") int func()
+SEC("xdp")
+int func()
 {
        __u64 key64 = 0;
        __u32 key = 0;
diff --git a/tools/testing/selftests/bpf/progs/sample_ret0.c b/tools/testing/selftests/bpf/progs/sample_ret0.c
index fec99750d6ea..f51c63dd6f20 100644
--- a/tools/testing/selftests/bpf/progs/sample_ret0.c
+++ b/tools/testing/selftests/bpf/progs/sample_ret0.c
@@ -1,6 +1,9 @@
 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */
+#include <linux/bpf.h>
+#include <bpf/bpf_helpers.h>

 /* Sample program which should always load for testing control paths. */
+SEC("xdp")
 int func()
 {
        return 0;
diff --git a/tools/testing/selftests/bpf/test_offload.py b/tools/testing/selftests/bpf/test_offload.py
index 6cd6ef9fc20b..0381f48f45a6 100755
--- a/tools/testing/selftests/bpf/test_offload.py
+++ b/tools/testing/selftests/bpf/test_offload.py
@@ -235,7 +235,7 @@ def tc(args, JSON=True, ns="", fail=True, include_stderr=False):
 def ethtool(dev, opt, args, fail=True):
     return cmd("ethtool %s %s %s" % (opt, dev["ifname"], args), fail=fail)

-def bpf_obj(name, sec=".text", path=bpf_test_dir,):
+def bpf_obj(name, sec="xdp", path=bpf_test_dir,):
     return "obj %s sec %s" % (os.path.join(path, name), sec)

 def bpf_pinned(name):

[3]
# bpftool prog load /home/idosch/code/linux/tools/testing/selftests/bpf/sample_ret0.o /sys/fs/bpf/nooffload type xdp
Error: object file doesn't contain any bpf program
Warning: bpftool is now running in libbpf strict mode and has more stringent requirements about BPF programs.
If it used to work for this object file but now doesn't, see --legacy option for more details.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ