From: Paul Chaignon <paul@cilium.io>
To: bpf@vger.kernel.org
Cc: Yonghong Song <yhs@fb.com>, Martynas Pumputis <m@lambda.lt>
Subject: R11 is invalid with LLVM 12 and later
Date: Mon, 9 Aug 2021 17:12:02 +0200 [thread overview]
Message-ID: <20210809151202.GB1012999@Mem> (raw)
Hello,
While trying to use LLVM 12.0.0 in Cilium, we've noticed that it can
generate invalid BPF bytecode:
$ clang --version
Ubuntu clang version 12.0.0-++20210409092622+fa0971b87fb2-1~exp1~20210409193326.73
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ make -C bpf -j6 KERNEL=419
$ llvm-objdump -D -section=2/20 bpf/bpf_lxc.o | grep -i r11
171: 7b ba 18 ff 00 00 00 00 *(u64 *)(r10 - 232) = r11
436: 79 ab 18 ff 00 00 00 00 r11 = *(u64 *)(r10 - 232)
484: bf 8b 00 00 00 00 00 00 r11 = r8
That bytecode is of course rejected by the verifier:
171: (7b) *(u64 *)(r10 -232) = r11
R11 is invalid
LLVM 12.0.1 and latest LLVM sources (e.g., commit 2b4a1d4b from today)
have the same issue. We've bisected it to LLVM commit 552c6c23
("PR44406: Follow behavior of array bound constant folding in more
recent versions of GCC."), but that could just be the commit where
the regression was exposed in Cilium's case.
--
Paul
next reply other threads:[~2021-08-09 15:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-09 15:12 Paul Chaignon [this message]
2021-08-09 22:53 ` R11 is invalid with LLVM 12 and later Yonghong Song
2021-08-10 6:31 ` Yonghong Song
2021-08-11 16:54 ` Paul Chaignon
2021-08-12 1:23 ` Yonghong Song
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=20210809151202.GB1012999@Mem \
--to=paul@cilium.io \
--cc=bpf@vger.kernel.org \
--cc=m@lambda.lt \
--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