Re: [PATCH bpf-next v2] [tools/bpf] workaround a verifier failure for test_progs

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

 





On 4/27/20 7:56 PM, Ma Xinjian wrote:
Hi Yonghong.

During our team's test, we find a similar issue. when run test_sysctl of bpf, we met error:

```

libbpf: -- END LOG --
libbpf: failed to load program 'cgroup/sysctl'
libbpf: failed to load object './test_sysctl_prog.o'
(test_sysctl.c:1490: errno: Permission denied) >>> Loading program (./test_sysctl_prog.o) error.

```

Testing env: "Debian GNU/Linux 9 (stretch)"

kernel: 5.6 5.7-rc1 5.7-rc2 5.7-rc3

clang/llvm version: v11.0.0.

we have tested a log of commits, following commits are part of them

drwxrwxr-x 2 root root  1 Apr 28 07:01 f30416fdde922eaa655934e050026930fefbd260 drwxrwxr-x 2 root root  2 Apr 26 11:38 10bc12588dac532fad044b2851dde8e7b9121e88 drwxrwxr-x 2 root root  1 Apr 26 07:01 969e7edd88ceb4791eb1cac22828290f0ae30b3d drwxrwxr-x 2 root root  1 Apr 23 13:51 bbf386f02b05db017fda66875cc5edef70779244 drwxrwxr-x 2 root root  1 Apr 22 10:01 2de52422acf04662b45599f77c14ce1b2cec2b81 drwxrwxr-x 2 root root  1 Apr 21 07:07 a9b137f9ffba8cb25dfd7dd1fb613e8aac121b37 drwxrwxr-x 2 root root  1 Apr 17 07:01 40d139c620f83509fe18acbff5ec358298e99def

drwxrwxr-x 2 root root  1 Apr 16 07:02 bee6c234ed28ae7349cb83afa322dfd8394590ee


And I have tested, If I add following patch like you did, test_sysctl pass:

diff --git a/tools/testing/selftests/bpf/progs/test_sysctl_prog.c b/tools/testing/selftests/bpf/progs/test_sysctl_prog.c
index 2d0b0b82a78a..8e3da8d2e7c9 100644
--- a/tools/testing/selftests/bpf/progs/test_sysctl_prog.c
+++ b/tools/testing/selftests/bpf/progs/test_sysctl_prog.c
@@ -45,7 +45,10 @@ int sysctl_tcp_mem(struct bpf_sysctl *ctx)
         unsigned long tcp_mem[3] = {0, 0, 0};
         char value[MAX_VALUE_STR_LEN];
         unsigned char i, off = 0;
-       int ret;
+      /* a workaround to prevent compiler from generating
+      * codes verifier cannot handle yet.
+      */
+      volatile int ret;

         if (ctx->write)
                 return 0;

Right. This is related to alu32 mode. The detailed description
https://lore.kernel.org/bpf/20191107170045.2503480-1-yhs@xxxxxx/

We are still working on this, either a verifier solution or a compiler workaround.


root@vm-snb-15 /usr/src/perf_selftests-x86_64-rhel-7.6-kselftests-6a8b55ed4056ea5559ebe4f6a4b247f627870d4c/tools/testing/selftests/bpf# ./test_sysctl

...

  Summary: 40 PASSED, 0 FAILED




[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