All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: syzbot <syzbot+a2872d6feea6918008a9@syzkaller.appspotmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk,
	linux-ext4@vger.kernel.org
Subject: Re: KASAN: use-after-free Read in seq_escape
Date: Tue, 2 Oct 2018 10:49:33 -0400	[thread overview]
Message-ID: <20181002144933.GC17537@thunk.org> (raw)
In-Reply-To: <000000000000902cb10577255369@google.com>

On Sun, Sep 30, 2018 at 11:58:02PM -0700, syzbot wrote:
> Hello,
> 
> syzbot found the following crash on:
> 
> HEAD commit:    17b57b1883c1 Linux 4.19-rc6
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1672d711400000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=c0af03fe452b65fb
> dashboard link: https://syzkaller.appspot.com/bug?extid=a2872d6feea6918008a9
> compiler:       gcc (GCC) 8.0.1 20180413 (experimental)

This should be fixed with the following patch.

     	       	     	      		- Ted

>From 89cc85e761c5b905b1a61cb85440bf9b5e841c80 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Tue, 2 Oct 2018 10:40:57 -0400
Subject: [PATCH] ext4: fix use-after-free race in ext4_remount()'s error path

It's possible for ext4_show_quota_options() to try reading
s_qf_names[i] while it is being modified by ext4_remount() --- most
notably, in ext4_remount's error path when the original values of the
quota file name gets restored.

Reported-by: syzbot+a2872d6feea6918008a9@syzkaller.appspotmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
---
 fs/ext4/super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index faf293ed8060..11a1bfae0937 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2048,11 +2048,13 @@ static inline void ext4_show_quota_options(struct seq_file *seq,
 		seq_printf(seq, ",jqfmt=%s", fmtname);
 	}
 
+	down_read(&sb->s_umount);
 	if (sbi->s_qf_names[USRQUOTA])
 		seq_show_option(seq, "usrjquota", sbi->s_qf_names[USRQUOTA]);
 
 	if (sbi->s_qf_names[GRPQUOTA])
 		seq_show_option(seq, "grpjquota", sbi->s_qf_names[GRPQUOTA]);
+	up_read(&sb->s_umount);
 #endif
 }
 
-- 
2.18.0.rc0

WARNING: multiple messages have this Message-ID (diff)
From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: syzbot <syzbot+a2872d6feea6918008a9@syzkaller.appspotmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk,
	linux-ext4@vger.kernel.org
Subject: Re: KASAN: use-after-free Read in seq_escape
Date: Tue, 2 Oct 2018 10:49:33 -0400	[thread overview]
Message-ID: <20181002144933.GC17537@thunk.org> (raw)
In-Reply-To: <000000000000902cb10577255369@google.com>

On Sun, Sep 30, 2018 at 11:58:02PM -0700, syzbot wrote:
> Hello,
> 
> syzbot found the following crash on:
> 
> HEAD commit:    17b57b1883c1 Linux 4.19-rc6
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1672d711400000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=c0af03fe452b65fb
> dashboard link: https://syzkaller.appspot.com/bug?extid=a2872d6feea6918008a9
> compiler:       gcc (GCC) 8.0.1 20180413 (experimental)

This should be fixed with the following patch.

     	       	     	      		- Ted

From 89cc85e761c5b905b1a61cb85440bf9b5e841c80 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Tue, 2 Oct 2018 10:40:57 -0400
Subject: [PATCH] ext4: fix use-after-free race in ext4_remount()'s error path

It's possible for ext4_show_quota_options() to try reading
s_qf_names[i] while it is being modified by ext4_remount() --- most
notably, in ext4_remount's error path when the original values of the
quota file name gets restored.

Reported-by: syzbot+a2872d6feea6918008a9@syzkaller.appspotmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
---
 fs/ext4/super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index faf293ed8060..11a1bfae0937 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2048,11 +2048,13 @@ static inline void ext4_show_quota_options(struct seq_file *seq,
 		seq_printf(seq, ",jqfmt=%s", fmtname);
 	}
 
+	down_read(&sb->s_umount);
 	if (sbi->s_qf_names[USRQUOTA])
 		seq_show_option(seq, "usrjquota", sbi->s_qf_names[USRQUOTA]);
 
 	if (sbi->s_qf_names[GRPQUOTA])
 		seq_show_option(seq, "grpjquota", sbi->s_qf_names[GRPQUOTA]);
+	up_read(&sb->s_umount);
 #endif
 }
 
-- 
2.18.0.rc0


  reply	other threads:[~2018-10-02 21:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01  6:58 KASAN: use-after-free Read in seq_escape syzbot
2018-10-02 14:49 ` Theodore Y. Ts'o [this message]
2018-10-02 14:49   ` Theodore Y. Ts'o

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=20181002144933.GC17537@thunk.org \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+a2872d6feea6918008a9@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.