[PATCH] bpf, x86_32: Fix logic error in BPF_LDX zero-extension
From: Wang YanQing
Date: Thu Apr 23 2020 - 01:18:09 EST
When verifier_zext is true, we don't need to emit code
for zero-extension.
Fixes: 836256bf ("x32: bpf: eliminate zero extension code-gen")
Signed-off-by: Wang YanQing <udknight@xxxxxxxxx>
---
arch/x86/net/bpf_jit_comp32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c
index 4d2a7a764602..ed34dd16ebc5 100644
--- a/arch/x86/net/bpf_jit_comp32.c
+++ b/arch/x86/net/bpf_jit_comp32.c
@@ -1847,7 +1847,7 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image,
case BPF_B:
case BPF_H:
case BPF_W:
- if (!bpf_prog->aux->verifier_zext)
+ if (bpf_prog->aux->verifier_zext)
break;
if (dstk) {
EMIT3(0xC7, add_1reg(0x40, IA32_EBP),
--
2.17.1