diff options
author | Yonghong Song <yonghong.song@linux.dev> | 2025-01-18 22:20:24 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2025-01-20 20:43:29 +0300 |
commit | aefaa4313b5083427781f9e3e0cc7b5ce5cb4df0 (patch) | |
tree | 0f83d0e97cbf3a96de41e4e9a25d362b565f92c6 /scripts/gdb/linux/lists.py | |
parent | d10cafc5d54a0f70681ab2f739ea6c46282c86f9 (diff) | |
download | linux-aefaa4313b5083427781f9e3e0cc7b5ce5cb4df0.tar.xz |
bpf: Allow 'may_goto 0' instruction in verifier
Commit 011832b97b31 ("bpf: Introduce may_goto instruction") added support
for may_goto insn. The 'may_goto 0' insn is disallowed since the insn is
equivalent to a nop as both branch will go to the next insn.
But it is possible that compiler transformation may generate 'may_goto 0'
insn. Emil Tsalapatis from Meta reported such a case which caused
verification failure. For example, for the following code,
int i, tmp[3];
for (i = 0; i < 3 && can_loop; i++)
tmp[i] = 0;
...
clang 20 may generate code like
may_goto 2;
may_goto 1;
may_goto 0;
r1 = 0; /* tmp[0] = 0; */
r2 = 0; /* tmp[1] = 0; */
r3 = 0; /* tmp[2] = 0; */
Let us permit 'may_goto 0' insn to avoid verification failure for codes
like the above.
Reported-by: Emil Tsalapatis <etsal@meta.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/r/20250118192024.2124059-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'scripts/gdb/linux/lists.py')
0 files changed, 0 insertions, 0 deletions