[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240503213625.GA2118490@ZenIV>
Date: Fri, 3 May 2024 22:36:25 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Kees Cook <keescook@...omium.org>
Cc: Jens Axboe <axboe@...nel.dk>, Bui Quang Minh <minhquangbui99@...il.com>,
Christian Brauner <brauner@...nel.org>,
syzbot <syzbot+045b454ab35fd82a35fb@...kaller.appspotmail.com>,
io-uring@...r.kernel.org, jack@...e.cz,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com,
Sumit Semwal <sumit.semwal@...aro.org>,
Christian König <christian.koenig@....com>,
linux-media@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linaro-mm-sig@...ts.linaro.org, Laura Abbott <laura@...bott.name>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: get_file() unsafe under epoll (was Re: [syzbot] [fs?]
[io-uring?] general protection fault in __ep_remove)
On Fri, May 03, 2024 at 10:11:09PM +0100, Al Viro wrote:
> On Fri, May 03, 2024 at 01:28:37PM -0700, Kees Cook wrote:
> >
> > Is this the right approach? It still feels to me like get_file() needs
> > to happen much earlier...
>
> I don't believe it needs to happen at all. The problem is not that
> ->release() can be called during ->poll() - it can't and it doesn't.
> It's that this instance of ->poll() is trying to extend the lifetime
> of that struct file, when it might very well be past the point of no
> return.
>
> What we need is
> * promise that ep_item_poll() won't happen after eventpoll_release_file().
> AFAICS, we do have that.
> * ->poll() not playing silly buggers.
>
> As it is, dma_buf ->poll() is very suspicious regardless of that
> mess - it can grab reference to file for unspecified interval.
> Have that happen shortly before reboot and you are asking for failing
> umount.
>
> ->poll() must be refcount-neutral wrt file passed to it. I'm seriously
> tempted to make ->poll() take const struct file * and see if there's
> anything else that would fall out.
.. the last part is no-go - poll_wait() must be able to grab a reference
(well, the callback in it must)
Powered by blists - more mailing lists