From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <rao.shoaib@oracle.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<kuniyu@amazon.com>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>, <pabeni@redhat.com>,
<syzbot+8811381d455e3e9ec788@syzkaller.appspotmail.com>,
<syzkaller-bugs@googlegroups.com>
Subject: Re: [syzbot] [net?] KASAN: slab-use-after-free Read in unix_stream_read_actor (2)
Date: Thu, 5 Sep 2024 13:42:49 -0700 [thread overview]
Message-ID: <20240905204249.27077-1-kuniyu@amazon.com> (raw)
In-Reply-To: <68873c3c-d1ec-4041-96d8-e6921be13de5@oracle.com>
From: Shoaib Rao <rao.shoaib@oracle.com>
Date: Thu, 5 Sep 2024 13:37:06 -0700
> On 9/5/2024 1:15 PM, Shoaib Rao wrote:
> >
> > On 9/5/2024 12:46 PM, Kuniyuki Iwashima wrote:
> >> From: Shoaib Rao <rao.shoaib@oracle.com>
> >> Date: Thu, 5 Sep 2024 00:35:35 -0700
> >>> Hi All,
> >>>
> >>> I am not able to reproduce the issue. I have run the C program at least
> >>> 100 times in a loop. In the I do get an EFAULT, not sure if that is
> >>> intentional or not but no panic. Should I be doing something
> >>> differently? The kernel version I am using is
> >>> v6.11-rc6-70-gc763c4339688. Later I can try with the exact version.
> >> The -EFAULT is the bug meaning that we were trying to read an
> >> consumed skb.
> >>
> >> But the first bug is in recvfrom() that shouldn't be able to read OOB
> >> skb
> >> without MSG_OOB, which doesn't clear unix_sk(sk)->oob_skb, and later
> >> something bad happens.
> >>
> >> socketpair(AF_UNIX, SOCK_STREAM, 0, [3, 4]) = 0
> >> sendmsg(4, {msg_name=NULL, msg_namelen=0,
> >> msg_iov=[{iov_base="\333", iov_len=1}], msg_iovlen=1,
> >> msg_controllen=0, msg_flags=0}, MSG_OOB|MSG_DONTWAIT) = 1
> >> recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=NULL,
> >> msg_iovlen=0, msg_controllen=0, msg_flags=MSG_OOB},
> >> MSG_OOB|MSG_WAITFORONE) = 1
> >> sendmsg(4, {msg_name=NULL, msg_namelen=0,
> >> msg_iov=[{iov_base="\21", iov_len=1}], msg_iovlen=1,
> >> msg_controllen=0, msg_flags=0}, MSG_OOB|MSG_NOSIGNAL|MSG_MORE) = 1
> >>> recvfrom(3, "\21", 125, MSG_DONTROUTE|MSG_TRUNC|MSG_DONTWAIT, NULL,
> >>> NULL) = 1
> >> recvmsg(3, {msg_namelen=0}, MSG_OOB|MSG_ERRQUEUE) = -1 EFAULT (Bad
> >> address)
> >>
> >> I posted a fix officially:
> >> https://urldefense.com/v3/__https://lore.kernel.org/netdev/20240905193240.17565-5-kuniyu@amazon.com/__;!!ACWV5N9M2RV99hQ!IJeFvLdaXIRN2ABsMFVaKOEjI3oZb2kUr6ld6ZRJCPAVum4vuyyYwUP6_5ZH9mGZiJDn6vrbxBAOqYI$
> >>
> >
> > Thanks that is great. Isn't EFAULT, normally indicative of an issue
> > with the user provided address of the buffer, not the kernel buffer.
> >
> > Shoaib
> >
> Can you provide the full test case that you used to reproduce the issue.
I used the syzbot's repro, but you can check a new test case added
in my patch.
next prev parent reply other threads:[~2024-09-05 20:43 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 15:13 [syzbot] [net?] KASAN: slab-use-after-free Read in unix_stream_read_actor (2) syzbot
2024-09-04 15:32 ` Eric Dumazet
2024-09-04 17:32 ` Shoaib Rao
2024-09-05 7:35 ` Shoaib Rao
2024-09-05 8:04 ` Eric Dumazet
2024-09-05 19:06 ` Shoaib Rao
2024-09-05 19:46 ` Kuniyuki Iwashima
2024-09-05 20:15 ` Shoaib Rao
2024-09-05 20:35 ` Kuniyuki Iwashima
2024-09-05 20:48 ` Shoaib Rao
2024-09-05 21:03 ` Kuniyuki Iwashima
2024-09-06 12:37 ` Eric Dumazet
2024-09-06 16:48 ` Shoaib Rao
2024-09-07 5:06 ` Shoaib Rao
2024-09-07 5:39 ` Kuniyuki Iwashima
2024-09-10 0:29 ` Shoaib Rao
2024-09-10 0:48 ` Kuniyuki Iwashima
2024-09-10 16:55 ` Shoaib Rao
2024-09-10 17:57 ` Kuniyuki Iwashima
2024-09-10 18:16 ` Shoaib Rao
2024-09-10 18:33 ` Kuniyuki Iwashima
2024-09-10 18:49 ` Shoaib Rao
2024-09-10 19:49 ` Kuniyuki Iwashima
2024-09-10 20:57 ` Shoaib Rao
2024-09-10 21:53 ` Kuniyuki Iwashima
2024-09-10 22:30 ` Shoaib Rao
2024-09-10 22:59 ` Kuniyuki Iwashima
2024-09-10 23:42 ` Shoaib Rao
2024-09-11 0:16 ` Kuniyuki Iwashima
2024-09-05 20:37 ` Shoaib Rao
2024-09-05 20:41 ` Shoaib Rao
2024-09-05 20:42 ` Kuniyuki Iwashima [this message]
2024-09-05 5:25 ` Lizhi Xu
2024-09-05 5:57 ` syzbot
2024-09-05 6:59 ` Kuniyuki Iwashima
2024-09-05 7:46 ` syzbot
2024-09-05 22:50 ` Hillf Danton
2024-09-05 23:17 ` syzbot
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=20240905204249.27077-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rao.shoaib@oracle.com \
--cc=syzbot+8811381d455e3e9ec788@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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