From: Hillf Danton <hdanton@sina.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
syzbot <syzbot+5e3f9b2a67b45f16d4e6@syzkaller.appspotmail.com>,
syzkaller-bugs@googlegroups.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [syzbot] [ext4?] KASAN: slab-use-after-free Read in fsnotify
Date: Sat, 13 Apr 2024 20:04:26 +0800 [thread overview]
Message-ID: <20240413120426.1889-1-hdanton@sina.com> (raw)
In-Reply-To: <CAOQ4uxhh4Tm6j+Hh+F2aQFuHfpCh_kJ10FYTfXo+AxoP4m01ag@mail.gmail.com>
On Sat, 13 Apr 2024 12:32:32 +0300 Amir Goldstein
> On Sat, Apr 13, 2024 at 11:45=E2=80=AFAM Hillf Danton <hdanton@sina.com> wrote:
> >
> > If you composed fix based on SB_ACTIVE that is cleared in
> > generic_shutdown_super() with &sb->s_umount held for write,
> > I wonder what simpler serialization than srcu you could
> > find/create in fsnotify.
>
> As far as I can tell there is no need for serialisation.
>
> The problem is that fsnotify_sb_error() can be called from the
> context of ->put_super() call from generic_shutdown_super().
>
> It's true that in the repro the thread calling fsnotify_sb_error()
> in the worker thread running quota deferred work from put_super()
> but I think there are sufficient barriers for this worker thread to
> observer the cleared SB_ACTIVE flag.
>
do_exit quota_release_workfn
--- ---
cleanup_mnt() ext4_release_dquot()
__super_lock_excl(s); __ext4_error()
deactivate_locked_super(s); fsnotify_sb_error()
ext4_kill_sb()
kill_block_super()
generic_shutdown_super()
if (!(sb->s_flags & SB_ACTIVE))
return;
sb->s_flags &= ~SB_ACTIVE;
fsnotify_sb_delete()
fsnotify()
Because of no sync like taking &sb->s_umount in the worker context,
checking SB_ACTIVE added in your fix is unable to close the race.
> Anyway, according to syzbot, repro does not trigger the UAF
> with my last fix.
>
Note: testing is done by a robot and is best-effort only.
next prev parent reply other threads:[~2024-04-13 12:05 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 8:11 syzbot
2024-04-11 12:13 ` Jan Kara
2024-04-11 16:07 ` Amir Goldstein
2024-04-11 19:25 ` Gabriel Krisman Bertazi
2024-04-11 20:27 ` Khazhy Kumykov
2024-04-12 10:24 ` Amir Goldstein
2024-04-11 20:06 ` syzbot
2024-04-12 7:52 ` Amir Goldstein
2024-04-12 14:30 ` syzbot
2024-04-12 14:32 ` Aleksandr Nogikh
2024-04-13 1:40 ` [syzbot] " syzbot
2024-04-13 6:42 ` syzbot
2024-04-13 8:45 ` Hillf Danton
2024-04-13 9:32 ` Amir Goldstein
2024-04-13 12:04 ` Hillf Danton [this message]
2024-04-15 14:03 ` Jan Kara
2024-04-15 14:47 ` Amir Goldstein
2024-04-16 10:47 ` Amir Goldstein
2024-04-17 2:03 ` syzbot
2024-04-16 13:22 ` [syzbot] " Jan Kara
2024-04-16 16:27 ` Amir Goldstein
2024-04-16 17:32 ` Jan Kara
2024-04-16 17:55 ` Amir Goldstein
2024-04-16 22:50 ` Hillf Danton
[not found] <20240413014033.1722-1-hdanton@sina.com>
2024-04-13 8:40 ` syzbot
[not found] <CAOQ4uxhJi_YT=AZOaJGH6tt9kM7kUoAF1uzVqfGBXjvc8S78Ug@mail.gmail.com>
2024-04-13 8:58 ` syzbot
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=20240413120426.1889-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+5e3f9b2a67b45f16d4e6@syzkaller.appspotmail.com \
--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
all inboxes | Powered by JetHome®