From: Randy Dunlap <rdunlap@infradead.org>
To: kbuild test robot <lkp@intel.com>, Mike Rapoport <rppt@linux.ibm.com>
Cc: kbuild-all@lists.01.org,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [linux-next:master 10679/10701] arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used
Date: Wed, 20 May 2020 13:58:02 -0700 [thread overview]
Message-ID: <c66f84f9-606a-058d-7d02-312a79aba217@infradead.org> (raw)
In-Reply-To: <202005210343.GBNjOjOX%lkp@intel.com>
On 5/20/20 12:56 PM, kbuild test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head: fb57b1fabcb28f358901b2df90abd2b48abc1ca8
> commit: 0e19fc1c40bd7516d5a30a459db4f49d48910847 [10679/10701] mm: consolidate pgd_index() and pgd_offset{_k}() definitions
> config: i386-randconfig-a005-20200520 (attached as .config)
> compiler: gcc-4.9 (Ubuntu 4.9.3-13ubuntu2) 4.9.3
> reproduce:
> git checkout 0e19fc1c40bd7516d5a30a459db4f49d48910847
> # save the attached .config to linux build tree
> make ARCH=i386
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
>
> arch/x86/mm/pgtable.c: In function 'pgd_alloc':
>>> arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used [-Wvla]
> pmd_t *u_pmds[MAX_PREALLOCATED_USER_PMDS];
> ^
>>> arch/x86/mm/pgtable.c:428:2: warning: variable length array 'pmds' is used [-Wvla]
> pmd_t *pmds[MAX_PREALLOCATED_PMDS];
> ^
>
Yes, I also reported this on linux-next of 20200518 (but I didn't copy Mike on it).
> vim +/u_pmds +427 arch/x86/mm/pgtable.c
>
> 1db491f77b6ed0 Fenghua Yu 2015-01-15 423
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 424 pgd_t *pgd_alloc(struct mm_struct *mm)
> 1ec1fe73dfb711 Ingo Molnar 2008-03-19 425 {
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 426 pgd_t *pgd;
> 184d47f0fd3651 Kees Cook 2018-10-08 @427 pmd_t *u_pmds[MAX_PREALLOCATED_USER_PMDS];
> 184d47f0fd3651 Kees Cook 2018-10-08 @428 pmd_t *pmds[MAX_PREALLOCATED_PMDS];
> 1ec1fe73dfb711 Ingo Molnar 2008-03-19 429
> 1db491f77b6ed0 Fenghua Yu 2015-01-15 430 pgd = _pgd_alloc();
> 1ec1fe73dfb711 Ingo Molnar 2008-03-19 431
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 432 if (pgd == NULL)
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 433 goto out;
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17 434
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 435 mm->pgd = pgd;
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17 436
> f59dbe9ca6707e Joerg Roedel 2018-07-18 437 if (preallocate_pmds(mm, pmds, PREALLOCATED_PMDS) != 0)
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 438 goto out_free_pgd;
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 439
> f59dbe9ca6707e Joerg Roedel 2018-07-18 440 if (preallocate_pmds(mm, u_pmds, PREALLOCATED_USER_PMDS) != 0)
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 441 goto out_free_pmds;
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 442
> f59dbe9ca6707e Joerg Roedel 2018-07-18 443 if (paravirt_pgd_alloc(mm) != 0)
> f59dbe9ca6707e Joerg Roedel 2018-07-18 444 goto out_free_user_pmds;
> f59dbe9ca6707e Joerg Roedel 2018-07-18 445
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 446 /*
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 447 * Make sure that pre-populating the pmds is atomic with
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 448 * respect to anything walking the pgd_list, so that they
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 449 * never see a partially populated pgd.
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 450 */
> a79e53d85683c6 Andrea Arcangeli 2011-02-16 451 spin_lock(&pgd_lock);
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17 452
> 617d34d9e5d832 Jeremy Fitzhardinge 2010-09-21 453 pgd_ctor(mm, pgd);
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 454 pgd_prepopulate_pmd(mm, pgd, pmds);
> f59dbe9ca6707e Joerg Roedel 2018-07-18 455 pgd_prepopulate_user_pmd(mm, pgd, u_pmds);
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17 456
> a79e53d85683c6 Andrea Arcangeli 2011-02-16 457 spin_unlock(&pgd_lock);
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17 458
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17 459 return pgd;
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 460
> f59dbe9ca6707e Joerg Roedel 2018-07-18 461 out_free_user_pmds:
> f59dbe9ca6707e Joerg Roedel 2018-07-18 462 free_pmds(mm, u_pmds, PREALLOCATED_USER_PMDS);
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 463 out_free_pmds:
> f59dbe9ca6707e Joerg Roedel 2018-07-18 464 free_pmds(mm, pmds, PREALLOCATED_PMDS);
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 465 out_free_pgd:
> 1db491f77b6ed0 Fenghua Yu 2015-01-15 466 _pgd_free(pgd);
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 467 out:
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25 468 return NULL;
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17 469 }
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17 470
>
> :::::: The code at line 427 was first introduced by commit
> :::::: 184d47f0fd365108bd06ab26cdb3450b716269fd x86/mm: Avoid VLA in pgd_alloc()
>
> :::::: TO: Kees Cook <keescook@chromium.org>
> :::::: CC: Ingo Molnar <mingo@kernel.org>
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>
--
~Randy
Reported-by: Randy Dunlap <rdunlap@infradead.org>
next prev parent reply other threads:[~2020-05-20 20:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-20 19:56 [linux-next:master 10679/10701] arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used kbuild test robot
2020-05-20 20:58 ` Randy Dunlap [this message]
2020-05-20 23:11 ` Andrew Morton
2020-05-20 23:50 ` Randy Dunlap
2020-05-21 7:02 ` Mike Rapoport
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=c66f84f9-606a-058d-7d02-312a79aba217@infradead.org \
--to=rdunlap@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=kbuild-all@lists.01.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=rppt@linux.ibm.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 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).