linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Colascione <dancol@dancol.org>
To: Al Viro <viro@zeniv.linux.org.uk>, Hillf Danton <hdanton@sina.com>
Cc: syzbot <syzbot+75867c44841cb6373570@syzkaller.appspotmail.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzkaller-bugs@googlegroups.com,
	Markus Elfring <Markus.Elfring@web.de>
Subject: Re: KASAN: use-after-free Read in userfaultfd_release (2)
Date: Mon, 20 Jul 2020 16:46:00 -0700	[thread overview]
Message-ID: <1f69c0ab-5791-974f-8bc0-3997ab1d61ea@dancol.org> (raw)
In-Reply-To: <20200720160059.GO2786714@ZenIV.linux.org.uk>

On 7/20/20 9:00 AM, Al Viro wrote:
> On Mon, Jul 13, 2020 at 04:45:12PM +0800, Hillf Danton wrote:
> 
>> Bridge the gap between slab free and the fput in task work wrt
>> file's private data.
> 
> No.  This
> 
>> @@ -2048,6 +2055,7 @@ SYSCALL_DEFINE1(userfaultfd, int, flags)
>>   
>>   	fd = get_unused_fd_flags(O_RDONLY | O_CLOEXEC);
>>   	if (fd < 0) {
>> +		file->private_data = NULL;
>>   		fput(file);
>>   		goto out;
>>   	}
>>
> 
> is fundamentally wrong; you really shouldn't take over the cleanups
> if you ever do fput().

Yep. I don't recall how the O_CLOEXEC got in there: that's indeed wrong, 
and probably the result of patch-editing butchery. As for the exit 
cleanup: yes, that's a bug. I was trying to keep the exit paths 
together. We could fix it forward (which seems simple enough) or re-submit.

      reply	other threads:[~2020-07-21  0:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13  2:24 KASAN: use-after-free Read in userfaultfd_release (2) syzbot
2020-07-13 15:34 ` syzbot
2020-07-17 15:05   ` Qian Cai
2020-07-20 15:50     ` Qian Cai
2020-07-21  4:32       ` Stephen Rothwell
     [not found] ` <20200713084512.10416-1-hdanton@sina.com>
2020-07-20 16:00   ` Al Viro
2020-07-20 23:46     ` Daniel Colascione [this message]

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=1f69c0ab-5791-974f-8bc0-3997ab1d61ea@dancol.org \
    --to=dancol@dancol.org \
    --cc=Markus.Elfring@web.de \
    --cc=hdanton@sina.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+75867c44841cb6373570@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=viro@zeniv.linux.org.uk \
    /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).