Re: [PATCH bpf-next v3 1/2] bpf: verifier: Support eliding map lookup nullness

2024-10-01 Thread Daniel Xu
On Wed, Sep 25, 2024 at 10:24:01AM GMT, Alexei Starovoitov wrote: > On Tue, Sep 24, 2024 at 12:40 PM Daniel Xu wrote: > > > > + > > +/* Returns constant key value if possible, else -1 */ > > +static long get_constant_map_key(struct bpf_verifier_env *env, > > +struct

Re: [PATCH bpf-next v3 1/2] bpf: verifier: Support eliding map lookup nullness

2024-10-01 Thread Daniel Xu
Hit send too early. On Tue, Oct 1, 2024, at 5:07 PM, Daniel Xu wrote: > On Wed, Sep 25, 2024 at 10:24:01AM GMT, Alexei Starovoitov wrote: >> On Tue, Sep 24, 2024 at 12:40 PM Daniel Xu wrote: >> > >> > + >> > +/* Returns constant key value if possible, else -1 */ >> > +static long get_constant_map

Re: [PATCH bpf-next v3 1/2] bpf: verifier: Support eliding map lookup nullness

2024-09-25 Thread Alexei Starovoitov
On Tue, Sep 24, 2024 at 12:40 PM Daniel Xu wrote: > > + > +/* Returns constant key value if possible, else -1 */ > +static long get_constant_map_key(struct bpf_verifier_env *env, > +struct bpf_reg_state *key) > +{ > + struct bpf_func_state *state = func(env, k

Re: [PATCH bpf-next v3 1/2] bpf: verifier: Support eliding map lookup nullness

2024-09-24 Thread Eduard Zingerman
On Tue, 2024-09-24 at 04:40 -0600, Daniel Xu wrote: > This commit allows progs to elide a null check on statically known map > lookup keys. In other words, if the verifier can statically prove that > the lookup will be in-bounds, allow the prog to drop the null check. > > This is useful for two re

[PATCH bpf-next v3 1/2] bpf: verifier: Support eliding map lookup nullness

2024-09-24 Thread Daniel Xu
This commit allows progs to elide a null check on statically known map lookup keys. In other words, if the verifier can statically prove that the lookup will be in-bounds, allow the prog to drop the null check. This is useful for two reasons: 1. Large numbers of nullness checks (especially when t