Re: [PATCH v3 bpf-next 01/13] bpf: fix the return value of push_stack

Anton Protopopov
2025-09-19T07:12:08Z

On 25/09/18 05:17PM, Eduard Zingerman wrote:
> On Thu, 2025-09-18 at 09:38 +0000, Anton Protopopov wrote:
> > In [1] Eduard mentioned that on push_stack failure verifier code
> > should return -ENOMEM instead of -EFAULT. After checking with the
> > other call sites I've found that code randomly returns either -ENOMEM
> > or -EFAULT. This patch unifies the return values for the push_stack
> > (and similar push_async_cb) functions such that error codes are
> > always assigned properly.
> >
> > [1] https://lore.kernel.org/bpf/20250615085943.3871208-1-a.s.protopopov@gmail.com
> >
> > Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
> > ---
>
> Acked-by: Eduard Zingerman <eddyz87@gmail.com>
>
> > @@ -14256,7 +14255,7 @@ sanitize_speculative_path(struct bpf_verifier_env *env,
> > mark_reg_unknown(env, regs, insn->src_reg);
> > }
> > }
> > - return branch;
> > + return IS_ERR(branch) ? PTR_ERR(branch) : 0;
>
> Nit: this is the same as PTR_ERR_OR_ZERO.

thanks, fixed

> > }
> >
> > static int sanitize_ptr_alu(struct bpf_verifier_env *env,
>
> …