Martin Lau wrote: > On Fri, Jan 10, 2020 at 11:50:23AM +0100, Jakub Sitnicki wrote: > > Tooling that populates the SOCKMAP with sockets from user-space needs a way > > to inspect its contents. Returning the struct sock * that SOCKMAP holds to > > user-space is neither safe nor useful. An approach established by > > REUSEPORT_SOCKARRAY is to return a socket cookie (a unique identifier) > > instead. > > > > Since socket cookies are u64 values SOCKMAP needs to support such a value > > size for lookup to be possible. This requires special handling on update, > > though. Attempts to do a lookup on SOCKMAP holding u32 values will be met > > with ENOSPC error. > > > > Signed-off-by: Jakub Sitnicki <jakub@xxxxxxxxxxxxxx> > > --- [...] > > +static void *sock_map_lookup_sys(struct bpf_map *map, void *key) > > +{ > > + struct sock *sk; > > + > > + WARN_ON_ONCE(!rcu_read_lock_held()); > It seems unnecessary. It is only called by syscall.c which > holds the rcu_read_lock(). Other than that, > +1 drop it. The normal rcu annotations/splats should catch anything here. > Acked-by: Martin KaFai Lau <kafai@xxxxxx>