From: Matthew Wilcox <willy@infradead.org>
To: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: viro@zeniv.linux.org.uk, dhowells@redhat.com,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v3] fs: fix undefined behavior in bit shift for SB_NOUSER
Date: Mon, 31 Oct 2022 14:28:08 +0000 [thread overview]
Message-ID: <Y1/beLrf1gr3/b2u@casper.infradead.org> (raw)
In-Reply-To: <20221031142621.194389-1-cuigaosheng1@huawei.com>
On Mon, Oct 31, 2022 at 10:26:21PM +0800, Gaosheng Cui wrote:
> Shifting signed 32-bit value by 31 bits is undefined, so changing most
> significant bit to unsigned, and mark all of the flags as unsigned so
> that we don't mix types. The UBSAN warning calltrace like below:
>
> UBSAN: shift-out-of-bounds in fs/namespace.c:2330:33
> left shift of 1 by 31 places cannot be represented in type 'int'
> Call Trace:
> <TASK>
> dump_stack_lvl+0x7d/0xa5
> dump_stack+0x15/0x1b
> ubsan_epilogue+0xe/0x4e
> __ubsan_handle_shift_out_of_bounds+0x1e7/0x20c
> graft_tree+0x36/0xf0
> do_add_mount+0x98/0x100
> path_mount+0xbd6/0xd50
> init_mount+0x6a/0xa3
> devtmpfs_setup+0x47/0x7e
> devtmpfsd+0x1a/0x50
> kthread+0x126/0x160
> ret_from_fork+0x1f/0x30
> </TASK>
>
> Fixes: e462ec50cb5f ("VFS: Differentiate mount flags (MS_*) from internal superblock flags")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
next prev parent reply other threads:[~2022-10-31 14:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-31 14:26 [PATCH v3] fs: fix undefined behavior in bit shift for SB_NOUSER Gaosheng Cui
2022-10-31 14:28 ` Matthew Wilcox [this message]
2022-11-19 5:14 ` Al Viro
-- strict thread matches above, loose matches on Subject: below --
2023-04-24 5:01 [PATCH V2] " Al Viro
2023-04-24 5:18 ` [PATCH V3] " Hao Ge
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=Y1/beLrf1gr3/b2u@casper.infradead.org \
--to=willy@infradead.org \
--cc=cuigaosheng1@huawei.com \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--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).