bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ma Xinjian <max.xinjian@intel.com>
To: yhs@fb.com, ast@fb.com, bpf@vger.kernel.org,
	daniel@iogearbox.net, kernel-team@fb.com
Cc: "Li, Philip" <philip.li@intel.com>
Subject: Re: [PATCH bpf-next v2] [tools/bpf] workaround a verifier failure for test_progs
Date: Tue, 28 Apr 2020 10:56:11 +0800	[thread overview]
Message-ID: <4c14c01e-be39-817b-ca8c-200690ac4caf@intel.com> (raw)

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;

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

-- 
Best Regards.
Ma Xinjian


             reply	other threads:[~2020-04-28  2:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28  2:56 Ma Xinjian [this message]
2020-04-28  6:13 ` [PATCH bpf-next v2] [tools/bpf] workaround a verifier failure for test_progs Yonghong Song
2020-04-28 22:33   ` Alexei Starovoitov
  -- strict thread matches above, loose matches on Subject: below --
2019-11-07 17:00 Yonghong Song
2019-11-07 23:10 ` Song Liu
2019-11-11 13:07 ` Daniel Borkmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c14c01e-be39-817b-ca8c-200690ac4caf@intel.com \
    --to=max.xinjian@intel.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=philip.li@intel.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).