From: Daniel Borkmann Date: Mon, 4 Nov 2019 14:27:02 +0000 (+0100) Subject: bpf: re-fix skip write only files in debugfs X-Git-Tag: v5.15~5092^2~231 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=56c1291ee48b4da2a70aa116098c2afc4a54783b;p=platform%2Fkernel%2Flinux-starfive.git bpf: re-fix skip write only files in debugfs 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 Cc: Jakub Kicinski Cc: Alexei Starovoitov Acked-by: Jakub Kicinski Signed-off-by: David S. Miller --- diff --git a/tools/testing/selftests/bpf/test_offload.py b/tools/testing/selftests/bpf/test_offload.py index fc8a431..1afa22c 100755 --- a/tools/testing/selftests/bpf/test_offload.py +++ b/tools/testing/selftests/bpf/test_offload.py @@ -314,7 +314,10 @@ class DebugfsDir: 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):