diff options
| author | Eduard Zingerman <eddyz87@gmail.com> | 2026-10-09 03:47:24 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-10-09 20:29:12 +0000 |
| commit | 30175f5d9b1a82e6664485bfe9e50e4dcaa6f2ac (patch) | |
| tree | 4d4f39d330ea9085f93d8a609c306684f0062cbd /kernel/bpf | |
| parent | 0360ed8655cfe4ed25d5feb46c7f31addc59e63a (diff) | |
bpf: Summarize live stack slots in insn_aux_data
SCEV needs live stack information in order to skip tracking dead
slots. Liveness tracks this per function instance, but SCEV is not
callchain-sensitive and needs a summary across calling contexts.
For each instruction, union the current-frame liveness masks from all
analyzed function instances. Represent 8-byte slots as a summary of
constituent halves. Store the summary in insn_aux_data.
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261009-scev-minimal-rebase-v3-6-bcba9bc53ac9@gmail.com
Diffstat (limited to 'kernel/bpf')
| -rw-r--r-- | kernel/bpf/liveness.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/bpf/liveness.c b/kernel/bpf/liveness.c index ec9c8beef556..004c1f48a065 100644 --- a/kernel/bpf/liveness.c +++ b/kernel/bpf/liveness.c @@ -729,8 +729,9 @@ static void half_spis_to_slots(unsigned long *slots, const unsigned long *mask, } /* - * Precompute, for each instruction, the OR of may_write masks over its top - * frame across all func_instances reaching it, stash it in the insn_aux_data. + * Precompute, for each instruction, the OR of may_write and live_before masks + * over its top frame across all func_instances reaching it, stash them in the + * insn_aux_data. */ static void compute_may_write_masks(struct bpf_verifier_env *env) { @@ -746,9 +747,12 @@ static void compute_may_write_masks(struct bpf_verifier_env *env) if (!fm) continue; nbits = frame_mask_bits(fm); - for (i = 0; i < instance->insn_cnt; i++) + for (i = 0; i < instance->insn_cnt; i++) { half_spis_to_slots(aux[instance->subprog_start + i].may_write_mask, rel_mask(fm, i, FM_MAY_WRITE), nbits); + half_spis_to_slots(aux[instance->subprog_start + i].live_stack_before, + rel_mask(fm, i, FM_LIVE_BEFORE), nbits); + } } } |
