[PATCH net-next] bpf: re-fix skip write only files in debugfs

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

 



Commit 5bc60de50dfe ("selftests: bpf: Don't try to read files without
read permission") got reverted as the fix was not working as expected
and real fix came in via 8101e069418d ("selftests: bpf: Skip write
only files in debugfs"). When bpf-next got merged into net-next, the
test_offload.py had a small conflict. Fix the resolution in ae8a76fb8b5d
iby not reintroducing 5bc60de50dfe again.

Fixes: ae8a76fb8b5d ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next")
Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
Cc: Jakub Kicinski <jakub.kicinski@xxxxxxxxxxxxx>
Cc: Alexei Starovoitov <ast@xxxxxxxxxx>
---
 [
   Hey Jakub, please take a look at the below merge fix ... still trying
   to figure out why the netdev doesn't appear on my test node when I
   wanted to run the test script, but seems independent of the fix.

   [...]
   [ 1901.270493] netdevsim: probe of netdevsim4 failed with error -17
   [...]

   # ./test_offload.py
   Test destruction of generic XDP...
   Traceback (most recent call last):
    File "./test_offload.py", line 800, in <module>
     simdev = NetdevSimDev()
    File "./test_offload.py", line 355, in __init__
     self.wait_for_netdevs(port_count)
    File "./test_offload.py", line 390, in wait_for_netdevs
     raise Exception("netdevices did not appear within timeout")
   Exception: netdevices did not appear within timeout
 ]

 tools/testing/selftests/bpf/test_offload.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/test_offload.py b/tools/testing/selftests/bpf/test_offload.py
index fc8a4319c1b2..1afa22c88e42 100755
--- a/tools/testing/selftests/bpf/test_offload.py
+++ b/tools/testing/selftests/bpf/test_offload.py
@@ -314,7 +314,10 @@ def bpftool_prog_load(sample, file_name, maps=[], prog_type="xdp", dev=None,
                 continue
 
             p = os.path.join(path, f)
-            if os.path.isfile(p) and os.access(p, os.R_OK):
+            if not os.stat(p).st_mode & stat.S_IRUSR:
+                continue
+
+            if os.path.isfile(p):
                 _, out = cmd('cat %s/%s' % (path, f))
                 dfs[f] = out.strip()
             elif os.path.isdir(p):
-- 
2.21.0




[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