From: John Fastabend <john.fastabend@gmail.com>
To: John Fastabend <john.fastabend@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
John Fastabend <john.fastabend@gmail.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org,
yangyingliang@huawei.com, martin.lau@kernel.org,
Jakub Sitnicki <jakub@cloudflare.com>
Subject: Re: [PATCH bpf 1/2] bpf: sockmap, af_unix sockets need to hold ref for pair sock
Date: Wed, 22 Nov 2023 11:26:10 -0800 [thread overview]
Message-ID: <655e55d2a665e_51e272082b@john.notmuch> (raw)
In-Reply-To: <655d15cdb26fb_1fc7a208a5@john.notmuch>
John Fastabend wrote:
> Martin KaFai Lau wrote:
> > On 11/6/23 4:35 AM, Jakub Sitnicki wrote:
> > >> diff --git a/net/unix/unix_bpf.c b/net/unix/unix_bpf.c
> > >> index 2f9d8271c6ec..705eeed10be3 100644
> > >> --- a/net/unix/unix_bpf.c
> > >> +++ b/net/unix/unix_bpf.c
> > >> @@ -143,6 +143,8 @@ static void unix_stream_bpf_check_needs_rebuild(struct proto *ops)
> > >>
> > >> int unix_dgram_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore)
> > >> {
> > >> + struct sock *skpair;
> > >> +
> > >> if (sk->sk_type != SOCK_DGRAM)
> > >> return -EOPNOTSUPP;
> > >>
> > >> @@ -152,6 +154,9 @@ int unix_dgram_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool re
> > >> return 0;
> > >> }
> > >>
> > >> + skpair = unix_peer(sk);
> > >> + sock_hold(skpair);
> > >> + psock->skpair = skpair;
> > >> unix_dgram_bpf_check_needs_rebuild(psock->sk_proto);
> > >> sock_replace_proto(sk, &unix_dgram_bpf_prot);
> > >> return 0;
> > > unix_dgram should not need this, since it grabs a ref on each sendmsg.
> >
> > John, could you address this comment and respin v2?
>
> Respinning now just letting some tests run for a bit and I'll kick it out.
v2 on the list. Unfortunately the simple fix to the selftests to test STREAM
and DGRAM types caused a test failure. I look at it Monday unless someone
beats me to it.
>
> Thanks.
>
> >
> > The unix_inet_redir_to_connected() seems needing a fix in patch 2 also as
> > pointed out by JakubS.
> >
> > Thanks.
> >
> > >
> > > I'm not able to reproduce this bug for unix_dgram.
> > >
> > > Have you seen any KASAN reports for unix_dgram from syzcaller?
next prev parent reply other threads:[~2023-11-22 19:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 19:08 [PATCH bpf 0/2] sockmap fix for KASAN_VMALLOC and af_unix John Fastabend
2023-10-16 19:08 ` [PATCH bpf 1/2] bpf: sockmap, af_unix sockets need to hold ref for pair sock John Fastabend
2023-10-18 10:40 ` Jakub Sitnicki
2023-10-24 21:39 ` John Fastabend
2023-10-27 13:32 ` Jakub Sitnicki
2023-10-27 17:38 ` Kuniyuki Iwashima
2023-10-28 7:33 ` Jakub Sitnicki
2023-11-04 3:38 ` John Fastabend
2023-11-06 10:15 ` Jakub Sitnicki
2023-11-06 12:35 ` Jakub Sitnicki
2023-11-20 21:13 ` Martin KaFai Lau
2023-11-21 20:40 ` John Fastabend
2023-11-22 19:26 ` John Fastabend [this message]
2023-10-16 19:08 ` [PATCH bpf 2/2] bpf: sockmap, add af_unix test with both sockets in map John Fastabend
2023-11-06 12:44 ` Jakub Sitnicki
2023-11-06 14:42 ` Jakub Sitnicki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=655e55d2a665e_51e272082b@john.notmuch \
--to=john.fastabend@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=jakub@cloudflare.com \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=yangyingliang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).