Commit b6ec7951 authored by Hou Tao's avatar Hou Tao Committed by Daniel Borkmann
Browse files

bpf, x86: Remove unnecessary handling of BPF_SUB atomic op

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: default avatarHou Tao <houtao1@huawei.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarBrendan Jackman <jackmanb@google.com>
Link: https://lore.kernel.org/bpf/20220127083240.1425481-1-houtao1@huawei.com
parent 50fc9786
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -787,7 +787,6 @@ static int emit_atomic(u8 **pprog, u8 atomic_op,
	/* emit opcode */
	/* emit opcode */
	switch (atomic_op) {
	switch (atomic_op) {
	case BPF_ADD:
	case BPF_ADD:
	case BPF_SUB:
	case BPF_AND:
	case BPF_AND:
	case BPF_OR:
	case BPF_OR:
	case BPF_XOR:
	case BPF_XOR: