[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <60a34c768873f_56215208a1@john-XPS-13-9370.notmuch>
Date: Mon, 17 May 2021 22:11:18 -0700
From: John Fastabend <john.fastabend@...il.com>
To: Cong Wang <xiyou.wangcong@...il.com>,
John Fastabend <john.fastabend@...il.com>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, Jiang Wang <jiang.wang@...edance.com>,
Xiongchun Duan <duanxiongchun@...edance.com>,
Dongdong Wang <wangdongdong.6@...edance.com>,
Cong Wang <cong.wang@...edance.com>,
Daniel Borkmann <daniel@...earbox.net>,
Jakub Sitnicki <jakub@...udflare.com>,
Lorenz Bauer <lmb@...udflare.com>
Subject: Re: [Patch bpf-next v3 02/10] af_unix: implement ->read_sock() for
sockmap
Cong Wang wrote:
> On Mon, May 10, 2021 at 10:34 PM John Fastabend
> <john.fastabend@...il.com> wrote:
> > > +static int unix_read_sock(struct sock *sk, read_descriptor_t *desc,
> > > + sk_read_actor_t recv_actor)
> > > +{
> > > + int copied = 0;
> > > +
> > > + while (1) {
> > > + struct unix_sock *u = unix_sk(sk);
> > > + struct sk_buff *skb;
> > > + int used, err;
> > > +
> > > + mutex_lock(&u->iolock);
> > > + skb = skb_recv_datagram(sk, 0, 1, &err);
> > > + if (!skb) {
> > > + mutex_unlock(&u->iolock);
> > > + return err;
> >
> > Here we should check copied and break if copied is >0. Sure the caller here
> > has desc.count = 1 but its still fairly fragile.
>
> Technically, sockmap does not even care about what we return
> here, so I am sure what you suggest here even makes a difference.
> Also, desc->count is always 1 and never changes here.
Right, so either don't wrap it in a while() loop so its obviously
not workable or fix it so that it returns the correct copied value if
we ever did pass it count > 1..
>
> Thanks.
Powered by blists - more mailing lists