public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rustam Kovhaev <rkovhaev@gmail.com>
To: dsterba@suse.cz, Dmitry Vyukov <dvyukov@google.com>,
	Chris Mason <clm@fb.com>,
	dsterba@suse.com, Josef Bacik <josef@toxicpanda.com>,
	linux-btrfs@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>
Cc: gregkh@linuxfoundation.org
Subject: Re: KASAN: use-after-free Read in btrfs_scan_one_device
Date: Mon, 12 Oct 2020 13:56:50 -0700	[thread overview]
Message-ID: <20201012205650.GA1180751@thinkpad> (raw)
In-Reply-To: <20201001133546.GV6756@twin.jikos.cz>

On Thu, Oct 01, 2020 at 03:35:46PM +0200, David Sterba wrote:
> On Thu, Oct 01, 2020 at 03:08:34PM +0200, Dmitry Vyukov wrote:
> > On Thu, Oct 1, 2020 at 3:05 PM Dmitry Vyukov <dvyukov@google.com> wrote:
> > >
> > > On Wed, Sep 30, 2020 at 8:06 PM David Sterba <dsterba@suse.cz> wrote:
> > > >
> > > > On Wed, Sep 30, 2020 at 06:57:56PM +0200, David Sterba wrote:
> > > > > On Sun, Sep 20, 2020 at 07:12:14AM -0700, syzbot wrote:
> > > > > > Hello,
> > > > > >
> > > > > > syzbot found the following issue on:
> > > > > >
> > > > > > HEAD commit:    eb5f95f1 Merge tag 's390-5.9-6' of git://git.kernel.org/pu..
> > > > > > git tree:       upstream
> > > > > > console output: https://syzkaller.appspot.com/x/log.txt?x=10a0a8bb900000
> > > > > > kernel config:  https://syzkaller.appspot.com/x/.config?x=ffe85b197a57c180
> > > > > > dashboard link: https://syzkaller.appspot.com/bug?extid=582e66e5edf36a22c7b0
> > > > > > compiler:       gcc (GCC) 10.1.0-syz 20200507
> > > > > >
> > > > > > Unfortunately, I don't have any reproducer for this issue yet.
> > > > > >
> > > > > > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > > > > > Reported-by: syzbot+582e66e5edf36a22c7b0@syzkaller.appspotmail.com
> > > > >
> > > > > #syz fix: btrfs: fix overflow when copying corrupt csums for a message
> > > >
> > > > Johannes spotted that this is not the right fix for this report, I don't
> > > > know how to tell syzbot to revert the 'fix:' command, there isn't
> > > > 'unfix' (like there's 'undup').
> > >
> > > Hi David,
> > >
> > > I've added "unfix" command:
> > > https://github.com/google/syzkaller/pull/2156
> > >
> > > Let's give it a try:
> > > #syz unfix
> > >
> > > Thanks
> > 
> > Voilà! Unfixed:
> > https://syzkaller.appspot.com/bug?extid=582e66e5edf36a22c7b0
> 
> Thanks!

the problem is that btrfs_kill_super() frees *fs_info while it is still
being referenced by btrfs_scan_one_device() on behalf of another
concurrent mount syscall
a very simple and dumb fix is to remove that printk that references
*fs_info:
https://syzkaller.appspot.com/text?tag=Patch&x=123537fb900000
but instead, i think proper synchronization is needed here
any advice or pointers would be highly appreciated
tyvm!

      reply	other threads:[~2020-10-12 20:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-20 14:12 KASAN: use-after-free Read in btrfs_scan_one_device syzbot
2020-09-21  5:38 ` syzbot
2020-09-21  8:22   ` Johannes Thumshirn
2020-09-21  8:53   ` Johannes Thumshirn
2020-09-21  8:53     ` syzbot
2020-09-21  8:53     ` syzbot
2020-09-30 16:57 ` David Sterba
2020-09-30 18:05   ` David Sterba
2020-10-01 13:05     ` Dmitry Vyukov
2020-10-01 13:08       ` Dmitry Vyukov
2020-10-01 13:35         ` David Sterba
2020-10-12 20:56           ` Rustam Kovhaev [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=20201012205650.GA1180751@thinkpad \
    --to=rkovhaev@gmail.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=dvyukov@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@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