bpf, x86: remove unnecessary handling of BPF_SUB atomic op
Subsystems (5)
PATCH 1/1 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 and just remove it.
--- arch/x86/net/bpf_jit_comp.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/net/bpf_jit_comp.c +0 -1
@@ -787,7 +787,6 @@ static int emit_atomic(u8 **pprog, u8 atomic_op,/* emit opcode */ switch (atomic_op) {case BPF_ADD : -case BPF_SUB :case BPF_AND :case BPF_OR :case BPF_XOR :
Signature · 1 line
2.29.2
Yep - BPF_SUB is also excluded in Documentation/networking/filter.rst, plus the interpreter and verifier don't support it.
Thanks,
Quoted 26 lines · Hou Tao
According to the LLVM commit (https://reviews.llvm.org/D72184),
sync_fetch_and_sub()is implemented as a negation followed bysync_fetch_and_add(), so there will be noBPF_SUBop and just remove it.Signed-off-by Hou Tao <[email protected]>--- arch/x86/net/bpf_jit_comp.c | 1 - 1 file changed, 1 deletion(-)arch/x86/net/bpf_jit_comp.c +0
-2@@ -787,7 +787,6 @@ static int emit_atomic(u8 **pprog, u8 atomic_op,/* emit opcode */ switch (atomic_op) {case BPF_ADD : -case BPF_SUB :case BPF_AND :case BPF_OR :case BPF_XOR : --2.29.2
Daniel Borkmann
maintainerQuoted 6 lines · Brendan Jackman
Yep -
BPF_SUBis also excluded inDocumentation/networking/filter.rst, plus the interpreter and verifier don't support it.Thanks,
Acked-by Brendan Jackman <[email protected]>
I was wondering about verifier specifically as well. Added a note to the commit log that verifier rejects BPF_SUB while applying, thanks!
Quoted 27 lines · Hou Tao
Quoted 26 lines
According to the LLVM commit (https://reviews.llvm.org/D72184),
sync_fetch_and_sub()is implemented as a negation followed bysync_fetch_and_add(), so there will be noBPF_SUBop and just remove it.Signed-off-by Hou Tao <[email protected]>--- arch/x86/net/bpf_jit_comp.c | 1 - 1 file changed, 1 deletion(-)arch/x86/net/bpf_jit_comp.c +0
-2@@ -787,7 +787,6 @@ static int emit_atomic(u8 **pprog, u8 atomic_op,/* emit opcode */ switch (atomic_op) {case BPF_ADD : -case BPF_SUB :case BPF_AND :case BPF_OR :case BPF_XOR : --2.29.2
Quoted 11 lines · Daniel Borkmann
Quoted 6 lines · Brendan Jackman
Yep -
BPF_SUBis also excluded inDocumentation/networking/filter.rst, plus the interpreter and verifier don't support it.Thanks,
Acked-by Brendan Jackman <[email protected]>I was wondering about verifier specifically as well. Added a note to the commit log that verifier rejects
BPF_SUBwhile applying, thanks!
Thanks for the follow up Hou/Brendan LGTM as well. After its been merged, but ACK from me as well.
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Quoted 8 lines · On Thu, 27 Jan 2022 16:32:40 +0800 you wrote:
According to the LLVM commit (https://reviews.llvm.org/D72184),
sync_fetch_and_sub()is implemented as a negation followed bysync_fetch_and_add(), so there will be noBPF_SUBop and just remove it.Signed-off-by Hou Tao <[email protected]>[...]
Here is the summary with links:
- [bpf-next] bpf, x86: remove unnecessary handling of BPF_SUB atomic op
https://git.kernel.org/bpf/bpf-next/c/b6ec79518ef0
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html