From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <edumazet@google.com>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <kuni1840@gmail.com>,
<kuniyu@amazon.com>, <netdev@vger.kernel.org>,
<pabeni@redhat.com>,
<syzbot+b72d86aa5df17ce74c60@syzkaller.appspotmail.com>,
<tom@herbertland.com>
Subject: Re: [PATCH v1 net] kcm: Serialise kcm_sendmsg() for the same socket.
Date: Mon, 19 Aug 2024 11:02:16 -0700 [thread overview]
Message-ID: <20240819180216.15865-1-kuniyu@amazon.com> (raw)
In-Reply-To: <CANn89iK60jxsJCzq29WPSZJnYNHHpPS09_ZmSi1JHmbkZ2GznA@mail.gmail.com>
From: Eric Dumazet <edumazet@google.com>
Date: Mon, 19 Aug 2024 17:56:55 +0200
> On Fri, Aug 16, 2024 at 12:04 AM Kuniyuki Iwashima <kuniyu@amazon.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@syzkaller.appspotmail.com
> > Closes: https://syzkaller.appspot.com/bug?extid=b72d86aa5df17ce74c60
> > Tested-by: syzbot+b72d86aa5df17ce74c60@syzkaller.appspotmail.com
> > Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> > ---
>
> Reviewed-by: Eric Dumazet <edumazet@google.com>
>
> I wonder if anyone is using KCM....
Same impression :)
Maybe it's time to remove KCM.
https://lore.kernel.org/netdev/CALx6S37hSfQWw3Rku8vsavn8ejk0fndRk+=-=73gU7G-RbnK8Q@mail.gmail.com/
next prev parent reply other threads:[~2024-08-19 18:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-15 22:04 [PATCH v1 net] kcm: Serialise kcm_sendmsg() for the same socket Kuniyuki Iwashima
2024-08-16 2:56 ` Jason Xing
2024-08-16 3:05 ` Kuniyuki Iwashima
2024-08-16 3:36 ` Jason Xing
2024-08-16 3:46 ` Kuniyuki Iwashima
2024-08-16 6:57 ` Jason Xing
2024-08-19 15:56 ` Eric Dumazet
2024-08-19 18:02 ` Kuniyuki Iwashima [this message]
2024-08-20 2:20 ` patchwork-bot+netdevbpf
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=20240819180216.15865-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+b72d86aa5df17ce74c60@syzkaller.appspotmail.com \
--cc=tom@herbertland.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.