public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org, ast@kernel.org,
	andrii@kernel.org
Cc: daniel@iogearbox.net, martin.lau@linux.dev, kernel-team@fb.com,
	 yonghong.song@linux.dev, martin.lau@kernel.org, clm@meta.com,
	 ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v4 07/14] bpf: introduce forward arg-tracking dataflow analysis
Date: Fri, 10 Apr 2026 14:46:03 -0700	[thread overview]
Message-ID: <71cc59df90881090e7e74ca0cab7cb8b64e27979.camel@gmail.com> (raw)
In-Reply-To: <fb5b061479a00ba43992f755435e158bb913fb80e5ce106d20c81c42f6bb4356@mail.kernel.org>

On Fri, 2026-04-10 at 21:44 +0000, bot+bpf-ci@kernel.org wrote:
> > diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
> > index 7b31d8024c61..49b19118c326 100644
> > --- a/include/linux/bpf_verifier.h
> > +++ b/include/linux/bpf_verifier.h
> 
> [ ... ]
> 
> > @@ -886,6 +887,8 @@ struct bpf_verifier_env {
> >  	} cfg;
> >  	struct backtrack_state bt;
> >  	struct bpf_jmp_history_entry *cur_hist_ent;
> > +	/* Per-callsite copy of parent's converged at_stack_in for cross-frame fills. */
> > +	struct arg_track **callsite_at_stack;
> >  	u32 pass_cnt; /* number of times do_check() was called */
> 
> [ ... ]
> 
> > diff --git a/kernel/bpf/liveness.c b/kernel/bpf/liveness.c
> > index a3af5972520f..c5d6760454d6 100644
> > --- a/kernel/bpf/liveness.c
> > +++ b/kernel/bpf/liveness.c
> 
> [ ... ]
> 
> > +static struct arg_track fill_from_stack(struct bpf_insn *insn,
> > +					struct arg_track *at_out, int reg,
> > +					struct arg_track *at_stack_out,
> > +					int depth)
> > +{
> 
> [ ... ]
> 
> > +	cnt = at_out[reg].off_cnt;
> > +	if (cnt == 0)
> > +		return imp;
> > +
> > +	for (i = 0; i < cnt; i++) {
> > +		s16 fp_off = arg_add(at_out[reg].off[i], insn->off);
> > +		int slot = fp_off_to_slot(fp_off);
> > +
> > +		if (slot < 0)
> > +			return imp;
> > +		result = __arg_track_join(result, at_stack_out[slot]);
> > +	}
> > +	return result;
> > +}
> 
> [ ... ]
> 
> > +	} else if (class == BPF_LDX) {
> > +		u32 sz = bpf_size_to_bytes(BPF_SIZE(insn->code));
> > +		bool src_is_local_fp = insn->src_reg == BPF_REG_FP || src->frame == depth ||
> > +				       (src->frame == ARG_IMPRECISE && (src->mask & BIT(depth)));
> > +
> 
> [ ... ]
> 
> > +		} else if (src->frame >= 0 && src->frame < depth &&
> > +			   BPF_MODE(insn->code) == BPF_MEM && sz == 8) {
> > +			struct arg_track *parent_stack =
> > +				env->callsite_at_stack[callsites[src->frame]];
> > +
> > +			*dst = fill_from_stack(insn, at_out, insn->src_reg,
> > +					       parent_stack, src->frame);
> 
> Can parent_stack be NULL here? bpf_compute_subprog_arg_access()
> allocates callsite_at_stack with kvzalloc_objs (zero-filled), but
> nothing in this commit ever writes to individual callsite_at_stack[]
> entries. They all remain NULL.
> 
> When a callee receives a parent-frame FP-derived pointer (e.g. r1 with
> frame=0 at depth 1) and does an 8-byte load from it, this path is
> taken. fill_from_stack() then dereferences the NULL at_stack_out:
> 
>   fill_from_stack()
>     cnt = at_out[reg].off_cnt;   /* > 0 for precise args */
>     ...
>     result = __arg_track_join(result, at_stack_out[slot]);
>                                       ^^^^^^^^^^^^^^^^
>                                       NULL dereference
> 
> This appears to be a bisection hazard. The next commit in the series,
> 0458daba63a9 ("bpf: record arg tracking results in bpf_liveness
> masks"), adds the code that populates these entries:
> 
>   if (bpf_pseudo_call(insn) || bpf_calls_callback(env, idx)) {
>       env->callsite_at_stack[idx] = kvmalloc_objs(...);
>       memcpy(env->callsite_at_stack[idx], at_stack_in[i], ...);
>   }
> 
> Would it make sense to either defer wiring up the
> bpf_compute_subprog_arg_access() call into compute_live_registers()
> until the next patch, or move the callsite_at_stack population into
> this commit?

Yeap, should be moved.

> 
> > +		} else if (src->frame == ARG_IMPRECISE &&
> 
> [ ... ]
> 
> 
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
> 
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/24264407165

  reply	other threads:[~2026-04-10 21:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 20:55 [PATCH bpf-next v4 00/14] bpf: static stack liveness data flow analysis Eduard Zingerman
2026-04-10 20:55 ` [PATCH bpf-next v4 01/14] bpf: share several utility functions as internal API Eduard Zingerman
2026-04-10 20:55 ` [PATCH bpf-next v4 02/14] bpf: save subprogram name in bpf_subprog_info Eduard Zingerman
2026-04-10 20:55 ` [PATCH bpf-next v4 03/14] bpf: Add spis_*() helpers for 4-byte stack slot bitmasks Eduard Zingerman
2026-04-10 20:55 ` [PATCH bpf-next v4 04/14] bpf: make liveness.c track stack with 4-byte granularity Eduard Zingerman
2026-04-10 20:55 ` [PATCH bpf-next v4 05/14] bpf: 4-byte precise clean_verifier_state Eduard Zingerman
2026-04-10 20:55 ` [PATCH bpf-next v4 06/14] bpf: prepare liveness internal API for static analysis pass Eduard Zingerman
2026-04-10 20:55 ` [PATCH bpf-next v4 07/14] bpf: introduce forward arg-tracking dataflow analysis Eduard Zingerman
2026-04-10 21:44   ` bot+bpf-ci
2026-04-10 21:46     ` Eduard Zingerman [this message]
2026-04-10 22:17       ` Alexei Starovoitov
2026-04-10 20:55 ` [PATCH bpf-next v4 08/14] bpf: record arg tracking results in bpf_liveness masks Eduard Zingerman
2026-04-10 20:56 ` [PATCH bpf-next v4 09/14] bpf: simplify liveness to use (callsite, depth) keyed func_instances Eduard Zingerman
2026-04-10 21:39   ` Paul Chaignon
2026-04-10 21:42     ` Eduard Zingerman
2026-04-10 21:44   ` bot+bpf-ci
2026-04-10 22:33     ` Alexei Starovoitov
2026-04-10 20:56 ` [PATCH bpf-next v4 10/14] bpf: change logging scheme for live stack analysis Eduard Zingerman
2026-04-10 20:56 ` [PATCH bpf-next v4 11/14] selftests/bpf: update existing tests due to liveness changes Eduard Zingerman
2026-04-10 20:56 ` [PATCH bpf-next v4 12/14] selftests/bpf: adjust verifier_log buffers Eduard Zingerman
2026-04-10 20:56 ` [PATCH bpf-next v4 13/14] selftests/bpf: add new tests for static stack liveness analysis Eduard Zingerman
2026-04-10 20:56 ` [PATCH bpf-next v4 14/14] bpf: poison dead stack slots Eduard Zingerman
2026-04-10 22:40 ` [PATCH bpf-next v4 00/14] bpf: static stack liveness data flow analysis patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71cc59df90881090e7e74ca0cab7cb8b64e27979.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox