[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200717114532.GA688728@PWN>
Date: Fri, 17 Jul 2020 07:45:32 -0400
From: Peilin Ye <yepeilin.cs@...il.com>
To: Daniel Colascione <dancol@...gle.com>
Cc: timmurray@...gle.com, selinux@...r.kernel.org,
linux-security-module@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, viro@...iv.linux.org.uk, paul@...l-moore.com,
nnk@...gle.com, sds@...ho.nsa.gov, lokeshgidra@...gle.com,
jmorris@...ei.org
Subject: Reporting a use-after-free read bug in userfaultfd_release()
Hi all,
Syzbot reported the following use-after-free bug in
userfaultfd_release():
https://syzkaller.appspot.com/bug?id=4b9e5aea757b678d9939c364e50212354a3480a6
It seems to be caused by this patch. I took a look at the stack trace.
In the patch:
fd = get_unused_fd_flags(O_RDONLY | O_CLOEXEC);
if (fd < 0) {
fput(file);
goto out;
}
If get_unused_fd_flags() fails, `ctx` is freed. Later however, before
returning back to userland, userfaultfd_release() is called and tries to
use `ctx` again, causing a use-after-free bug.
The syzbot reproducer does a setrlimit() then a userfaultfd(). The
former sets a hard limit on number of open files to zero, which causes
get_unused_fd_flags() to fail.
Thank you,
Peilin Ye
Powered by blists - more mailing lists