[PATCH bpf-next 0/2] bpf: Eliminate unnecessary clone/restore due to constants blinding

From: Xu Kuohai

Date: Sat Jul 11 2026 - 01:24:57 EST


This series eliminates the unnecessary clone/restore overhead
introduced by patch d3e945223e0158c8 ("bpf: Move constants blinding
out of arch-specific JITs"), which moved constants blinding from JIT
code to general verifier code, and added env->insn_aux_data and subprog
starts duplication and restoration around constants blinding operations
to resolve the inconsistency between the metadata and instruction arrays.

Patch 1 eliminates the insn_aux_data duplication/restore. After JIT
failure, bpf_clear_insn_aux_data() is the only function that requires
insnsi and insn_aux_data to stay in sync as it accesses them using the
same size and index. However, the insnsi access is unnecessary as it is
checked to skip the second slot of an ldimm64 instruction which can be
absorbed into the jt check itself, so removing it eliminates the need
for the duplication/restore.

Patch 2 eliminates the prog clone and subprog duplication/restore
when the interpreter fallback is not available on JIT failure.

Xu Kuohai (2):
bpf: Eliminate dup/restore of insn_aux_data
bpf: Remove unnecessary dup/restore subprog_starts and prog clone

include/linux/bpf_verifier.h | 1 +
include/linux/filter.h | 22 ++-----
kernel/bpf/core.c | 120 +++++++++++++++++------------------
kernel/bpf/fixups.c | 68 ++++++--------------
kernel/bpf/verifier.c | 4 +-
5 files changed, 86 insertions(+), 129 deletions(-)

--
2.43.0