Re: [PATCH bpf-next v2 2/2] bpf: Remove unnecessary dup/restore subprog_starts and prog clone

From: Xu Kuohai

Date: Tue Aug 11 2026 - 09:02:10 EST


On 8/11/2026 5:27 AM, Eduard Zingerman wrote:
On Tue, 2026-07-28 at 20:25 +0000, Xu Kuohai wrote:

...

diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 505d134cd264..ab5da3ff941a 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -1564,27 +1564,34 @@ void bpf_jit_prog_release_other(struct bpf_prog *fp, struct bpf_prog *fp_other)
  * Now this function is used only to blind the main prog and must be invoked only when
  * bpf_prog_need_blind() returns true.
  */
-struct bpf_prog *bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog *prog)
+int bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog **pprog,
+     bool clone_needed, bool *cloned)

Imo, the code is harder to understand after this change.
Maybe it would be simpler if clone_needed/cloned handling would moved
to the caller. In the current form I'm not convinced the change is warranted.

...

Yes, this is not an elegant cleanup. I think the cleanest way is to create
a general JIT layer, then iterate through all the instructions and do the
constant blinding and arch JIT for each one on the fly. This would eliminate
the prog clone completely. However, since we have more than 10 arch JITs, I
would like to explore whether it is actually feasible and drop the current
patch for now.