linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Qian Cai <cai@lca.pw>
Cc: dhowells@redhat.com, viro@zeniv.linux.org.uk, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] hugetlbfs: a terminator for hugetlb_param_specs[]
Date: Mon, 4 Feb 2019 19:32:32 -0800	[thread overview]
Message-ID: <ce8d60c2-5166-6c40-011f-4dff8dc25ebe@oracle.com> (raw)
In-Reply-To: <20190205012224.65672-1-cai@lca.pw>

On 2/4/19 5:22 PM, Qian Cai wrote:
> 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>

Thanks for fixing this.  Looks like a simple oversight when 2284cf59cbce
was added.

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>

I just started looking at the new mount API now.  It would be good if
David also took a look to make sure everything else is OK.

FYI David, the fs_parameter_spec example in the documentation (mount_api.txt)
is also missing a terminator.
-- 
Mike Kravetz

> ---
>  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 = {
> 


  reply	other threads:[~2019-02-05  3:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-05  1:22 [PATCH -next] hugetlbfs: a terminator for hugetlb_param_specs[] Qian Cai
2019-02-05  3:32 ` Mike Kravetz [this message]
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=ce8d60c2-5166-6c40-011f-4dff8dc25ebe@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=cai@lca.pw \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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).