diff options
| author | Yonghong Song <yonghong.song@linux.dev> | 2026-08-18 22:53:04 -0700 |
|---|---|---|
| committer | Eduard Zingerman <eddyz87@gmail.com> | 2026-08-21 10:49:27 -0700 |
| commit | 991fb7823106bb2faa8a4871bc1d7c745201bac9 (patch) | |
| tree | 1ddf7f1120706e45d6e7493aa06c1399435873c9 /scripts/Makefile.thinlto | |
| parent | 5bbb242c0859024d6d0ba990c0476b33c7c0be71 (diff) | |
| download | linux-next-991fb7823106bb2faa8a4871bc1d7c745201bac9.tar.gz linux-next-991fb7823106bb2faa8a4871bc1d7c745201bac9.zip | |
bpf: Account R2 of register-pair returns in live register analysis
A BPF_EXIT of a subprogram returning a value larger than 8 bytes (a
struct/union or an __int128) reads R2 as well as R0, since the second half
of the return value is passed back in R2. compute_insn_live_regs() only
marked R0 used at exit, so a callee's R2 could be considered dead and
cleaned from checkpointed states, which would allow unsound state pruning.
Mark R2 as read at the BPF_EXIT of a subprogram that does return a register
pair. bpf_compute_live_registers() now loops over the subprograms and, for
each, over the [start, end) instruction range from env->subprog_info[], so
the return convention is queried once per subprogram through
bpf_ret_reg_pair() rather than once per instruction.
Marking R2 at every exit instead would be simpler, but R2 would then stay
live backwards across any call that is not followed by a write to R2, which
is nearly every program, and would needlessly hurt state pruning.
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://patch.msgid.link/20260819055304.3296353-1-yonghong.song@linux.dev
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
