History

bpf: Fix arg_track_join log to use sa prefix for stack arg slots

arg_track_join() logs state transitions at CFG merge points. For stack arg slots (r >= MAX_BPF_REG), it printed "r11:", "r12:", etc., which is misleading since r11 is a special register (BPF_REG_PARAMS) not meaningful to the user. Fix it to print "sa0:", "sa1:", etc., matching the per-instruction transition log in arg_track_log() which already uses the "sa" prefix. Update the existing stack_arg_pruning_type_mismatch selftest to expect the corrected format.

Yonghong Song committed 6 months ago

Commit d1dbe441 parent 0e264772 files · +4 −2Browse files

Showing the changes to kernel (1 of 2 files). Show all

Unified · Split

kernel/bpf/liveness.c+3−1
@@ -806,7 +806,9 @@ static bool arg_track_join(struct bpf_verifier_env *env, int idx, int target, in · 805 unmodified lines
806 return true;806 return true;
807 807
808 verbose(env, "arg JOIN insn %d -> %d ", idx, target);808 verbose(env, "arg JOIN insn %d -> %d ", idx, target);
809 if (r >= 0)809 if (r >= MAX_BPF_REG)
810 verbose(env, "sa%d: ", r - MAX_BPF_REG);
811 else if (r >= 0)
810 verbose(env, "r%d: ", r);812 verbose(env, "r%d: ", r);
811 else813 else
812 verbose(env, "fp%+d: ", r * 8);814 verbose(env, "fp%+d: ", r * 8);