All of lore.kernel.org
 help / color / mirror / Atom feed
* R11 is invalid with LLVM 12 and later
@ 2021-08-09 15:12 Paul Chaignon
  2021-08-09 22:53 ` Yonghong Song
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Chaignon @ 2021-08-09 15:12 UTC (permalink / raw)
  To: bpf; +Cc: Yonghong Song, Martynas Pumputis

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-12  1:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-09 15:12 R11 is invalid with LLVM 12 and later Paul Chaignon
2021-08-09 22:53 ` Yonghong Song
2021-08-10  6:31   ` Yonghong Song
2021-08-11 16:54     ` Paul Chaignon
2021-08-12  1:23       ` Yonghong Song

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.