Re: [PATCH bpf-next v6 2/8] bpf: reject unhashed sockets in bpf_sk_assign

From: Lorenz Bauer
Date: Mon Jul 24 2023 - 04:02:02 EST


On Thu, Jul 20, 2023 at 11:17 PM Kuniyuki Iwashima <kuniyu@xxxxxxxxxx> wrote:

> > Fix the problem by rejecting unhashed sockets in bpf_sk_assign().
> > This matches the behaviour of __inet_lookup_skb which is ultimately
> > the goal of bpf_sk_assign().
> >
> > Fixes: cf7fbe660f2d ("bpf: Add socket assign support")
>
> Should this be 0c48eefae712 then ?

I think it makes sense to target it at the original helper add, since
we really should've done the unhashed check back then. Relying on
unhashed not being available is too subtle.