[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bc92c670-f472-43b1-af0b-a50353ed8757@linux.dev>
Date: Mon, 20 Nov 2023 13:13:18 -0800
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: John Fastabend <john.fastabend@...il.com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org, yangyingliang@...wei.com,
martin.lau@...nel.org, Jakub Sitnicki <jakub@...udflare.com>
Subject: Re: [PATCH bpf 1/2] bpf: sockmap, af_unix sockets need to hold ref
for pair sock
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?
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?
Powered by blists - more mailing lists