[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iK60jxsJCzq29WPSZJnYNHHpPS09_ZmSi1JHmbkZ2GznA@mail.gmail.com>
Date: Mon, 19 Aug 2024 17:56:55 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Tom Herbert <tom@...bertland.com>,
Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org,
syzbot+b72d86aa5df17ce74c60@...kaller.appspotmail.com
Subject: Re: [PATCH v1 net] kcm: Serialise kcm_sendmsg() for the same socket.
On Fri, Aug 16, 2024 at 12:04 AM Kuniyuki Iwashima <kuniyu@...zon.com> wrote:
>
> syzkaller reported UAF in kcm_release(). [0]
>
> The scenario is
>
> 1. Thread A builds a skb with MSG_MORE and sets kcm->seq_skb.
>
> 2. Thread A resumes building skb from kcm->seq_skb but is blocked
> by sk_stream_wait_memory()
>
> 3. Thread B calls sendmsg() concurrently, finishes building kcm->seq_skb
> and puts the skb to the write queue
>
> 4. Thread A faces an error and finally frees skb that is already in the
> write queue
>
> 5. kcm_release() does double-free the skb in the write queue
>
> When a thread is building a MSG_MORE skb, another thread must not touch it.
>
> Let's add a per-sk mutex and serialise kcm_sendmsg().
>
>
> Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
> Reported-by: syzbot+b72d86aa5df17ce74c60@...kaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=b72d86aa5df17ce74c60
> Tested-by: syzbot+b72d86aa5df17ce74c60@...kaller.appspotmail.com
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
I wonder if anyone is using KCM....
Powered by blists - more mailing lists