From: Hou Tao <houtao1@huawei.com>
Date: Thu, 27 Jan 2022 16:32:40 +0800
Subject: bpf, x86: Remove unnecessary handling of BPF_SUB atomic op
Patch-mainline: v5.18-rc1
Git-commit: b6ec79518ef0c84d1ed0f76b8af9592a75eb29b6
References: jsc#PED-1377
According to the LLVM commit (https://reviews.llvm.org/D72184),
sync_fetch_and_sub() is implemented as a negation followed by
sync_fetch_and_add(), so there will be no BPF_SUB op, thus just
remove it. BPF_SUB is also rejected by the verifier anyway.
Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Brendan Jackman <jackmanb@google.com>
Link: https://lore.kernel.org/bpf/20220127083240.1425481-1-houtao1@huawei.com
Acked-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
arch/x86/net/bpf_jit_comp.c | 1 -
1 file changed, 1 deletion(-)
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -773,7 +773,6 @@ static int emit_atomic(u8 **pprog, u8 at
/* emit opcode */
switch (atomic_op) {
case BPF_ADD:
- case BPF_SUB:
case BPF_AND:
case BPF_OR:
case BPF_XOR: