From: Qian Cai <cai@lca.pw>
To: mike.kravetz@oracle.com
Cc: dhowells@redhat.com, viro@zeniv.linux.org.uk, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Qian Cai <cai@lca.pw>
Subject: [PATCH -next] hugetlbfs: a terminator for hugetlb_param_specs[]
Date: Mon, 4 Feb 2019 20:22:24 -0500 [thread overview]
Message-ID: <20190205012224.65672-1-cai@lca.pw> (raw)
Booting up an arm64 server with CONFIG_VALIDATE_FS_PARSER=n triggers a
out-of-bounds error below, due to the commit 2284cf59cbce ("hugetlbfs:
Convert to fs_context") missed a terminator for hugetlb_param_specs[],
and causes this loop in fs_lookup_key(),
for (p = desc->specs; p->name; p++)
could not exit properly due to p->name is never be NULL.
[ 91.575203] BUG: KASAN: global-out-of-bounds in fs_lookup_key+0x60/0x94
[ 91.581810] Read of size 8 at addr ffff200010deeb10 by task mount/2461
[ 91.597350] Call trace:
[ 91.597357] dump_backtrace+0x0/0x2b0
[ 91.597361] show_stack+0x24/0x30
[ 91.597373] dump_stack+0xc0/0xf8
[ 91.623263] print_address_description+0x64/0x2b0
[ 91.627965] kasan_report+0x150/0x1a4
[ 91.627970] __asan_report_load8_noabort+0x30/0x3c
[ 91.627974] fs_lookup_key+0x60/0x94
[ 91.627977] fs_parse+0x104/0x990
[ 91.627986] hugetlbfs_parse_param+0xc4/0x5e8
[ 91.651081] vfs_parse_fs_param+0x2e4/0x378
[ 91.658118] vfs_parse_fs_string+0xbc/0x12c
[ 91.658122] do_mount+0x11f0/0x1640
[ 91.658125] ksys_mount+0xc0/0xd0
[ 91.658129] __arm64_sys_mount+0xcc/0xe4
[ 91.658137] el0_svc_handler+0x28c/0x338
[ 91.681740] el0_svc+0x8/0xc
Fixes: 2284cf59cbce ("hugetlbfs: Convert to fs_context")
Signed-off-by: Qian Cai <cai@lca.pw>
---
fs/hugetlbfs/inode.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index abf0c2eb834e..4f352743930f 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -81,6 +81,7 @@ static const struct fs_parameter_spec hugetlb_param_specs[] = {
fsparam_string("pagesize", Opt_pagesize),
fsparam_string("size", Opt_size),
fsparam_u32 ("uid", Opt_uid),
+ {}
};
static const struct fs_parameter_description hugetlb_fs_parameters = {
--
2.17.2 (Apple Git-113)
next reply other threads:[~2019-02-05 1:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-05 1:22 Qian Cai [this message]
2019-02-05 3:32 ` Mike Kravetz
2019-02-08 16:31 ` David Howells
2019-02-08 22:29 ` Al Viro
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=20190205012224.65672-1-cai@lca.pw \
--to=cai@lca.pw \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox