From: Al Viro <viro@ZenIV.linux.org.uk>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
syzkaller <syzkaller@googlegroups.com>
Subject: Re: fs: use-after-free in path_lookupat
Date: Sat, 4 Mar 2017 19:39:10 +0000 [thread overview]
Message-ID: <20170304193910.GG29622@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CACT4Y+bWe1bhVKmH4v1RrhQYUKzwu9BG1COaffx-4J2nnzPO-A@mail.gmail.com>
On Sat, Mar 04, 2017 at 03:59:36PM +0100, Dmitry Vyukov wrote:
> I am getting the following use-after-free reports while running
> syzkaller fuzzer on 86292b33d4b79ee03e2f43ea0381ef85f077c760 (but also
> happened on 6dc39c50e4aeb769c8ae06edf2b1a732f3490913 and
> c82be9d2244aacea9851c86f4fb74694c99cd874).
IOW, it's not fs/namei.c patches from this window...
> unlazy_walk+0xf2/0x4b0 fs/namei.c:692
Could you post disassembly (e.g. from objdump -d) of your unlazy_walk()?
For the kernel the trace is from...
> r4 = memfd_create(&(0x7f0000013000)="2f6465762f6877726e6700", 0x0)
> name_to_handle_at(r4, &(0x7f0000003000-0x6)="2e2f62757300",
> &(0x7f0000003000-0xd)={0xc, 0x0, "cd21"}, &(0x7f0000002000)=0x0,
> 0x1000)
>
> What's strange is that dirfd passed to name_to_handle_at is memfd
> handle (sic). And path lookup somehow does not fail early on this.
> Does it make any sense?
It doesn't, but is that the triggering call of name_to_handle_at(), or do you
have it called elsewhere?
FWIW, no LOOKUP_ROOT in filename_lookup() flags + NULL root + dfd not
equal to AT_FDCWD + non-empty name should've ended up in
if (!d_can_lookup(dentry)) {
fdput(f);
return ERR_PTR(-ENOTDIR);
}
in path_init() and it shouldn't have progressed any further. And in case
of name_to_handle_at() we have user_path_at(dfd, name, lookup_flags, &path),
i.e. user_path_at_empty(dfd, name, lookup_flags, &path, NULL), i.e.
filename_lookup(dfd, getname_flags(name, lookup_flags, NULL), lookup_flags,
&path, NULL). IOW, filename_lookup() is called with root equal to NULL,
dfd and name coming straight from userland and lookup_flags containing
nothing beyond LOOKUP_EMPTY and LOOKUP_FOLLOW...
next prev parent reply other threads:[~2017-03-04 19:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-04 14:59 fs: use-after-free in path_lookupat Dmitry Vyukov
2017-03-04 19:39 ` Al Viro [this message]
2017-03-05 11:15 ` Dmitry Vyukov
2017-03-05 11:20 ` Dmitry Vyukov
2017-03-05 11:24 ` Dmitry Vyukov
2017-03-05 11:37 ` Dmitry Vyukov
2017-03-05 15:57 ` Al Viro
2017-03-05 16:14 ` Dmitry Vyukov
2017-03-05 16:33 ` Al Viro
2017-03-05 17:33 ` Dmitry Vyukov
2017-03-05 17:38 ` Dmitry Vyukov
2017-03-05 19:18 ` Al Viro
2017-03-06 9:46 ` Dmitry Vyukov
2017-03-23 14:17 ` Dmitry Vyukov
2017-04-28 6:19 ` Dmitry Vyukov
2017-05-29 14:48 ` Dmitry Vyukov
2017-05-30 6:24 ` Al Viro
2017-05-30 8:19 ` 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=20170304193910.GG29622@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=dvyukov@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller@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;
as well as URLs for NNTP newsgroup(s).