Commit 3776f351 authored by Ilya Leoshkevich's avatar Ilya Leoshkevich Committed by Daniel Borkmann

selftests, bpf: Test that dead ldx_w insns are accepted

Prevent regressions related to zero-extension metadata handling during
dead code sanitization.
Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210812151811.184086-3-iii@linux.ibm.com
parent 45c709f8
......@@ -159,3 +159,15 @@
.result = ACCEPT,
.retval = 2,
},
{
"dead code: zero extension",
.insns = {
BPF_MOV64_IMM(BPF_REG_0, 0),
BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_0, -4),
BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 0, 1),
BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_10, -4),
BPF_EXIT_INSN(),
},
.result = ACCEPT,
.retval = 0,
},
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment