From: Al Viro <viro@zeniv.linux.org.uk>
To: syzbot <syzbot+503d4cc169fcec1cb18c@syzkaller.appspotmail.com>
Cc: davem@davemloft.net, jbaron@akamai.com, kgraul@linux.ibm.com,
ktkhai@virtuozzo.com, kyeongdon.kim@lge.com,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
pabeni@redhat.com, syzkaller-bugs@googlegroups.com,
xiyou.wangcong@gmail.com, hch@lst.de
Subject: Re: KASAN: use-after-free Read in unix_dgram_poll
Date: Sun, 3 Mar 2019 13:55:02 +0000 [thread overview]
Message-ID: <20190303135502.GP2217@ZenIV.linux.org.uk> (raw)
In-Reply-To: <000000000000f39c7b05832e0219@google.com>
On Sun, Mar 03, 2019 at 02:22:04AM -0800, syzbot wrote:
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit: 7d762d69145a afs: Fix manually set volume location server ..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=131d832ac00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=b76ec970784287c
> dashboard link: https://syzkaller.appspot.com/bug?extid=503d4cc169fcec1cb18c
> compiler: gcc (GCC) 9.0.0 20181231 (experimental)
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11934262c00000
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+503d4cc169fcec1cb18c@syzkaller.appspotmail.com
>
> ==================================================================
> BUG: KASAN: use-after-free in unix_dgram_poll+0x5e1/0x690
> net/unix/af_unix.c:2695
> Read of size 4 at addr ffff88809292aae0 by task syz-executor.1/18946
>
> CPU: 0 PID: 18946 Comm: syz-executor.1 Not tainted 5.0.0-rc8+ #88
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
> __dump_stack lib/dump_stack.c:77 [inline]
> dump_stack+0x172/0x1f0 lib/dump_stack.c:113
> print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187
> kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
> __asan_report_load4_noabort+0x14/0x20 mm/kasan/generic_report.c:134
> unix_dgram_poll+0x5e1/0x690 net/unix/af_unix.c:2695
> sock_poll+0x291/0x340 net/socket.c:1127
> vfs_poll include/linux/poll.h:86 [inline]
> aio_poll fs/aio.c:1766 [inline]
> __io_submit_one fs/aio.c:1876 [inline]
> io_submit_one+0xe3e/0x1cf0 fs/aio.c:1909
> __do_sys_io_submit fs/aio.c:1954 [inline]
> __se_sys_io_submit fs/aio.c:1924 [inline]
> __x64_sys_io_submit+0x1bd/0x580 fs/aio.c:1924
> ? 0xffffffff81000000
> do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
> entry_SYSCALL_64_after_hwframe+0x49/0xbe
Apparently, a call of ->poll() overlapping with call of ->release()
(if not outright happening after it). Which should never happen...
Maybe unrelated to this bug, but... What's to prevent a wakeup
that happens just after we'd been added to a waitqueue by ->poll()
triggering aio_poll_wake(), which gets to aio_poll_complete()
with its fput() *before* we'd reached the end of ->poll() instance?
I wonder if adding
get_file(req->file); // make sure that early completion is safe
right after
req->file = fget(iocb->aio_fildes);
if (unlikely(!req->file))
return -EBADF;
paired with
fput(req->file);
right after out: in aio_poll() is needed... Am I missing something
obvious here? Christoph?
next prev parent reply other threads:[~2019-03-03 13:55 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-03 10:22 KASAN: use-after-free Read in unix_dgram_poll syzbot
2019-03-03 13:55 ` Al Viro [this message]
2019-03-03 15:18 ` [PATCH] aio: prevent the final fput() in the middle of vfs_poll() (Re: KASAN: use-after-free Read in unix_dgram_poll) Al Viro
2019-03-03 18:37 ` Eric Dumazet
2019-03-03 19:44 ` Linus Torvalds
2019-03-03 20:13 ` Linus Torvalds
2019-03-03 20:30 ` Al Viro
2019-03-03 22:23 ` Linus Torvalds
2019-03-04 2:36 ` Al Viro
2019-03-04 21:22 ` Linus Torvalds
2019-03-07 0:03 ` [PATCH 1/8] aio: make sure file is pinned Al Viro
2019-03-07 0:03 ` [PATCH 2/8] aio_poll_wake(): don't set ->woken if we ignore the wakeup Al Viro
2019-03-07 2:18 ` Al Viro
2019-03-08 11:16 ` zhengbin (A)
2019-03-07 0:03 ` [PATCH 3/8] aio_poll(): sanitize the logics after vfs_poll(), get rid of leak on error Al Viro
2019-03-07 2:11 ` zhengbin (A)
2019-03-07 0:03 ` [PATCH 4/8] aio_poll(): get rid of weird refcounting Al Viro
2019-03-07 0:03 ` [PATCH 5/8] make aio_read()/aio_write() return int Al Viro
2019-03-07 0:03 ` [PATCH 6/8] move dropping ->ki_eventfd into iocb_put() Al Viro
2019-03-07 0:03 ` [PATCH 7/8] deal with get_reqs_available() in aio_get_req() itself Al Viro
2019-03-07 0:03 ` [PATCH 8/8] aio: move sanity checks and request allocation to io_submit_one() Al Viro
2019-03-07 0:23 ` [PATCH 1/8] aio: make sure file is pinned Linus Torvalds
2019-03-07 0:41 ` Al Viro
2019-03-07 0:48 ` Al Viro
2019-03-07 1:20 ` Al Viro
2019-03-07 1:30 ` Linus Torvalds
2019-03-08 3:36 ` Al Viro
2019-03-08 15:50 ` Christoph Hellwig
2019-03-10 7:06 ` Al Viro
2019-03-10 7:08 ` [PATCH 1/8] pin iocb through aio Al Viro
2019-03-10 7:08 ` [PATCH 2/8] keep io_event in aio_kiocb Al Viro
2019-03-11 19:43 ` Christoph Hellwig
2019-03-11 21:17 ` Al Viro
2019-03-10 7:08 ` [PATCH 3/8] aio: store event at final iocb_put() Al Viro
2019-03-11 19:44 ` Christoph Hellwig
2019-03-11 21:13 ` Al Viro
2019-03-11 22:52 ` Al Viro
2019-03-10 7:08 ` [PATCH 4/8] Fix aio_poll() races Al Viro
2019-03-11 19:58 ` Christoph Hellwig
2019-03-11 21:06 ` Al Viro
2019-03-12 19:18 ` Christoph Hellwig
2019-03-10 7:08 ` [PATCH 5/8] make aio_read()/aio_write() return int Al Viro
2019-03-11 19:44 ` Christoph Hellwig
2019-03-10 7:08 ` [PATCH 6/8] move dropping ->ki_eventfd into iocb_destroy() Al Viro
2019-03-11 19:46 ` Christoph Hellwig
2019-03-10 7:08 ` [PATCH 7/8] deal with get_reqs_available() in aio_get_req() itself Al Viro
2019-03-11 19:46 ` Christoph Hellwig
2019-03-10 7:08 ` [PATCH 8/8] aio: move sanity checks and request allocation to io_submit_one() Al Viro
2019-03-11 19:48 ` Christoph Hellwig
2019-03-11 21:12 ` Al Viro
2019-03-11 19:41 ` [PATCH 1/8] pin iocb through aio Christoph Hellwig
2019-03-11 19:41 ` [PATCH 1/8] aio: make sure file is pinned Christoph Hellwig
2019-03-04 7:53 ` [PATCH] aio: prevent the final fput() in the middle of vfs_poll() (Re: KASAN: use-after-free Read in unix_dgram_poll) Dmitry Vyukov
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=20190303135502.GP2217@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=davem@davemloft.net \
--cc=hch@lst.de \
--cc=jbaron@akamai.com \
--cc=kgraul@linux.ibm.com \
--cc=ktkhai@virtuozzo.com \
--cc=kyeongdon.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+503d4cc169fcec1cb18c@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=xiyou.wangcong@gmail.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).