From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: Jan Kara <jack@suse.cz>
Cc: "zhangyi (F)" <yi.zhang@huawei.com>,
linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca
Subject: Re: [PATCH] ext4: fix integer overflow when calculating commit interval
Date: Wed, 28 Aug 2019 11:25:56 -0400 [thread overview]
Message-ID: <20190828152556.GH24857@mit.edu> (raw)
In-Reply-To: <20190826153014.GI10614@quack2.suse.cz>
On Mon, Aug 26, 2019 at 05:30:14PM +0200, Jan Kara wrote:
> On Mon 26-08-19 22:35:47, zhangyi (F) wrote:
> > If user specify a large enough value of "commit=" option, it may trigger
> > signed integer overflow which may lead to sbi->s_commit_interval becomes
> > a large or small value, zero in particular.
> >
> > UBSAN: Undefined behaviour in ../fs/ext4/super.c:1592:31
> > signed integer overflow:
> > 536870912 * 1000 cannot be represented in type 'int'
> > [...]
> > Call trace:
> > [...]
> > [<ffffff9008a2d120>] ubsan_epilogue+0x34/0x9c lib/ubsan.c:166
> > [<ffffff9008a2d8b8>] handle_overflow+0x228/0x280 lib/ubsan.c:197
> > [<ffffff9008a2d95c>] __ubsan_handle_mul_overflow+0x4c/0x68 lib/ubsan.c:218
> > [<ffffff90086d070c>] handle_mount_opt fs/ext4/super.c:1592 [inline]
> > [<ffffff90086d070c>] parse_options+0x1724/0x1a40 fs/ext4/super.c:1773
> > [<ffffff90086d51c4>] ext4_remount+0x2ec/0x14a0 fs/ext4/super.c:4834
> > [...]
> >
> > Although it is not a big deal, still silence the UBSAN by limit the
> > input value.
> >
> > Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
>
> Looks good to me. You can add:
>
> Reviewed-by: Jan Kara <jack@suse.cz>
Thanks, applied.
- Ted
prev parent reply other threads:[~2019-08-28 15:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-26 14:35 [PATCH] ext4: fix integer overflow when calculating commit interval zhangyi (F)
2019-08-26 15:30 ` Jan Kara
2019-08-28 15:25 ` Theodore Y. Ts'o [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=20190828152556.GH24857@mit.edu \
--to=tytso@mit.edu \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=yi.zhang@huawei.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 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.