All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] mm: huge-vmap: fail gracefully on unexpected huge vmap mappings
@ 2017-06-08 19:22 ` Ard Biesheuvel
  0 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2017-06-08 19:22 UTC (permalink / raw)
  To: linux-mm
  Cc: akpm, mhocko, zhongjiang, labbott, mark.rutland,
	linux-arm-kernel, dave.hansen, Ard Biesheuvel

Existing code that uses vmalloc_to_page() may assume that any
address for which is_vmalloc_addr() returns true may be passed
into vmalloc_to_page() to retrieve the associated struct page.

This is not un unreasonable assumption to make, but on architectures
that have CONFIG_HAVE_ARCH_HUGE_VMAP=y, it no longer holds, and we
need to ensure that vmalloc_to_page() does not go off into the weeds
trying to dereference huge PUDs or PMDs as table entries.

Given that vmalloc() and vmap() themselves never create huge
mappings or deal with compound pages at all, there is no correct
answer in this case, so return NULL instead, and issue a warning.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
v4: - use pud_bad/pmd_bad instead of pud_huge/pmd_huge, which don't require
      changes to hugetlb.h, and give us what we need on all architectures
    - move WARN_ON_ONCE() calls out of conditionals
    - add explanatory comment

 mm/vmalloc.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 34a1c3e46ed7..0ba20eb17212 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -287,10 +287,21 @@ struct page *vmalloc_to_page(const void *vmalloc_addr)
 	if (p4d_none(*p4d))
 		return NULL;
 	pud = pud_offset(p4d, addr);
-	if (pud_none(*pud))
+
+	/*
+	 * Don't dereference bad PUD or PMD (below) entries. This will also
+	 * identify huge mappings, which we may encounter on architectures
+	 * that define CONFIG_HAVE_ARCH_HUGE_VMAP=y. Such regions will be
+	 * identified as vmalloc addresses by is_vmalloc_addr(), but are not
+	 * [unambiguously] associated with a struct page, so there is no
+	 * correct value to return for them.
+	 */
+	WARN_ON_ONCE(pud_bad(*pud));
+	if (pud_none(*pud) || pud_bad(*pud))
 		return NULL;
 	pmd = pmd_offset(pud, addr);
-	if (pmd_none(*pmd))
+	WARN_ON_ONCE(pmd_bad(*pmd);
+	if (pmd_none(*pmd) || pmd_bad(*pmd))
 		return NULL;
 
 	ptep = pte_offset_map(pmd, addr);
-- 
2.9.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v4] mm: huge-vmap: fail gracefully on unexpected huge vmap mappings
@ 2017-06-08 19:22 ` Ard Biesheuvel
  0 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2017-06-08 19:22 UTC (permalink / raw)
  To: linux-arm-kernel

Existing code that uses vmalloc_to_page() may assume that any
address for which is_vmalloc_addr() returns true may be passed
into vmalloc_to_page() to retrieve the associated struct page.

This is not un unreasonable assumption to make, but on architectures
that have CONFIG_HAVE_ARCH_HUGE_VMAP=y, it no longer holds, and we
need to ensure that vmalloc_to_page() does not go off into the weeds
trying to dereference huge PUDs or PMDs as table entries.

Given that vmalloc() and vmap() themselves never create huge
mappings or deal with compound pages at all, there is no correct
answer in this case, so return NULL instead, and issue a warning.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
v4: - use pud_bad/pmd_bad instead of pud_huge/pmd_huge, which don't require
      changes to hugetlb.h, and give us what we need on all architectures
    - move WARN_ON_ONCE() calls out of conditionals
    - add explanatory comment

 mm/vmalloc.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 34a1c3e46ed7..0ba20eb17212 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -287,10 +287,21 @@ struct page *vmalloc_to_page(const void *vmalloc_addr)
 	if (p4d_none(*p4d))
 		return NULL;
 	pud = pud_offset(p4d, addr);
-	if (pud_none(*pud))
+
+	/*
+	 * Don't dereference bad PUD or PMD (below) entries. This will also
+	 * identify huge mappings, which we may encounter on architectures
+	 * that define CONFIG_HAVE_ARCH_HUGE_VMAP=y. Such regions will be
+	 * identified as vmalloc addresses by is_vmalloc_addr(), but are not
+	 * [unambiguously] associated with a struct page, so there is no
+	 * correct value to return for them.
+	 */
+	WARN_ON_ONCE(pud_bad(*pud));
+	if (pud_none(*pud) || pud_bad(*pud))
 		return NULL;
 	pmd = pmd_offset(pud, addr);
-	if (pmd_none(*pmd))
+	WARN_ON_ONCE(pmd_bad(*pmd);
+	if (pmd_none(*pmd) || pmd_bad(*pmd))
 		return NULL;
 
 	ptep = pte_offset_map(pmd, addr);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v4] mm: huge-vmap: fail gracefully on unexpected huge vmap mappings
  2017-06-08 19:22 ` Ard Biesheuvel
@ 2017-06-09  2:29   ` kbuild test robot
  -1 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2017-06-09  2:29 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: kbuild-all, linux-mm, akpm, mhocko, zhongjiang, labbott,
	mark.rutland, linux-arm-kernel, dave.hansen

[-- Attachment #1: Type: text/plain, Size: 3382 bytes --]

Hi Ard,

[auto build test ERROR on mmotm/master]
[also build test ERROR on v4.12-rc4 next-20170608]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ard-Biesheuvel/mm-huge-vmap-fail-gracefully-on-unexpected-huge-vmap-mappings/20170609-093236
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: x86_64-randconfig-x019-201723 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   mm/vmalloc.c: In function 'vmalloc_to_page':
>> mm/vmalloc.c:2775:0: error: unterminated argument list invoking macro "WARN_ON_ONCE"
    
    
>> mm/vmalloc.c:303:2: error: 'WARN_ON_ONCE' undeclared (first use in this function)
     WARN_ON_ONCE(pmd_bad(*pmd);
     ^~~~~~~~~~~~
   mm/vmalloc.c:303:2: note: each undeclared identifier is reported only once for each function it appears in
>> mm/vmalloc.c:303:2: error: expected ';' at end of input
>> mm/vmalloc.c:303:2: error: expected declaration or statement at end of input
   mm/vmalloc.c:276:15: warning: unused variable 'pte' [-Wunused-variable]
     pte_t *ptep, pte;
                  ^~~
   mm/vmalloc.c:276:9: warning: unused variable 'ptep' [-Wunused-variable]
     pte_t *ptep, pte;
            ^~~~
   mm/vmalloc.c:271:15: warning: unused variable 'page' [-Wunused-variable]
     struct page *page = NULL;
                  ^~~~
   mm/vmalloc.c: At top level:
>> mm/vmalloc.c:47:13: warning: '__vunmap' used but never defined
    static void __vunmap(const void *, int);
                ^~~~~~~~
   mm/vmalloc.c: In function 'vmalloc_to_page':
>> mm/vmalloc.c:303:2: warning: control reaches end of non-void function [-Wreturn-type]
     WARN_ON_ONCE(pmd_bad(*pmd);
     ^~~~~~~~~~~~
   At top level:
   mm/vmalloc.c:240:12: warning: 'vmap_page_range' defined but not used [-Wunused-function]
    static int vmap_page_range(unsigned long start, unsigned long end,
               ^~~~~~~~~~~~~~~
   mm/vmalloc.c:121:13: warning: 'vunmap_page_range' defined but not used [-Wunused-function]
    static void vunmap_page_range(unsigned long addr, unsigned long end)
                ^~~~~~~~~~~~~~~~~
   mm/vmalloc.c:49:13: warning: 'free_work' defined but not used [-Wunused-function]
    static void free_work(struct work_struct *w)
                ^~~~~~~~~

vim +/WARN_ON_ONCE +2775 mm/vmalloc.c

5f6a6a9c4 Alexey Dobriyan   2008-10-06  2769  	proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations);
5f6a6a9c4 Alexey Dobriyan   2008-10-06  2770  	return 0;
5f6a6a9c4 Alexey Dobriyan   2008-10-06  2771  }
5f6a6a9c4 Alexey Dobriyan   2008-10-06  2772  module_init(proc_vmalloc_init);
db3808c1b Joonsoo Kim       2013-04-29  2773  
a10aa5798 Christoph Lameter 2008-04-28  2774  #endif
a10aa5798 Christoph Lameter 2008-04-28 @2775  

:::::: The code at line 2775 was first introduced by commit
:::::: a10aa579878fc6f9cd17455067380bbdf1d53c91 vmalloc: show vmalloced areas via /proc/vmallocinfo

:::::: TO: Christoph Lameter <clameter@sgi.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31818 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4] mm: huge-vmap: fail gracefully on unexpected huge vmap mappings
@ 2017-06-09  2:29   ` kbuild test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2017-06-09  2:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Ard,

[auto build test ERROR on mmotm/master]
[also build test ERROR on v4.12-rc4 next-20170608]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ard-Biesheuvel/mm-huge-vmap-fail-gracefully-on-unexpected-huge-vmap-mappings/20170609-093236
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: x86_64-randconfig-x019-201723 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   mm/vmalloc.c: In function 'vmalloc_to_page':
>> mm/vmalloc.c:2775:0: error: unterminated argument list invoking macro "WARN_ON_ONCE"
    
    
>> mm/vmalloc.c:303:2: error: 'WARN_ON_ONCE' undeclared (first use in this function)
     WARN_ON_ONCE(pmd_bad(*pmd);
     ^~~~~~~~~~~~
   mm/vmalloc.c:303:2: note: each undeclared identifier is reported only once for each function it appears in
>> mm/vmalloc.c:303:2: error: expected ';' at end of input
>> mm/vmalloc.c:303:2: error: expected declaration or statement at end of input
   mm/vmalloc.c:276:15: warning: unused variable 'pte' [-Wunused-variable]
     pte_t *ptep, pte;
                  ^~~
   mm/vmalloc.c:276:9: warning: unused variable 'ptep' [-Wunused-variable]
     pte_t *ptep, pte;
            ^~~~
   mm/vmalloc.c:271:15: warning: unused variable 'page' [-Wunused-variable]
     struct page *page = NULL;
                  ^~~~
   mm/vmalloc.c: At top level:
>> mm/vmalloc.c:47:13: warning: '__vunmap' used but never defined
    static void __vunmap(const void *, int);
                ^~~~~~~~
   mm/vmalloc.c: In function 'vmalloc_to_page':
>> mm/vmalloc.c:303:2: warning: control reaches end of non-void function [-Wreturn-type]
     WARN_ON_ONCE(pmd_bad(*pmd);
     ^~~~~~~~~~~~
   At top level:
   mm/vmalloc.c:240:12: warning: 'vmap_page_range' defined but not used [-Wunused-function]
    static int vmap_page_range(unsigned long start, unsigned long end,
               ^~~~~~~~~~~~~~~
   mm/vmalloc.c:121:13: warning: 'vunmap_page_range' defined but not used [-Wunused-function]
    static void vunmap_page_range(unsigned long addr, unsigned long end)
                ^~~~~~~~~~~~~~~~~
   mm/vmalloc.c:49:13: warning: 'free_work' defined but not used [-Wunused-function]
    static void free_work(struct work_struct *w)
                ^~~~~~~~~

vim +/WARN_ON_ONCE +2775 mm/vmalloc.c

5f6a6a9c4 Alexey Dobriyan   2008-10-06  2769  	proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations);
5f6a6a9c4 Alexey Dobriyan   2008-10-06  2770  	return 0;
5f6a6a9c4 Alexey Dobriyan   2008-10-06  2771  }
5f6a6a9c4 Alexey Dobriyan   2008-10-06  2772  module_init(proc_vmalloc_init);
db3808c1b Joonsoo Kim       2013-04-29  2773  
a10aa5798 Christoph Lameter 2008-04-28  2774  #endif
a10aa5798 Christoph Lameter 2008-04-28 @2775  

:::::: The code at line 2775 was first introduced by commit
:::::: a10aa579878fc6f9cd17455067380bbdf1d53c91 vmalloc: show vmalloced areas via /proc/vmallocinfo

:::::: TO: Christoph Lameter <clameter@sgi.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 31818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170609/46c091e8/attachment-0001.gz>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v4] mm: huge-vmap: fail gracefully on unexpected huge vmap mappings
  2017-06-08 19:22 ` Ard Biesheuvel
@ 2017-06-09  2:29   ` kbuild test robot
  -1 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2017-06-09  2:29 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: kbuild-all, linux-mm, akpm, mhocko, zhongjiang, labbott,
	mark.rutland, linux-arm-kernel, dave.hansen

[-- Attachment #1: Type: text/plain, Size: 7070 bytes --]

Hi Ard,

[auto build test WARNING on mmotm/master]
[also build test WARNING on v4.12-rc4 next-20170608]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ard-Biesheuvel/mm-huge-vmap-fail-gracefully-on-unexpected-huge-vmap-mappings/20170609-093236
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: x86_64-randconfig-x015-201723 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   mm/vmalloc.c: In function 'vmalloc_to_page':
   mm/vmalloc.c:2775:0: error: unterminated argument list invoking macro "WARN_ON_ONCE"
    
    
   mm/vmalloc.c:303:2: error: 'WARN_ON_ONCE' undeclared (first use in this function)
     WARN_ON_ONCE(pmd_bad(*pmd);
     ^~~~~~~~~~~~
   mm/vmalloc.c:303:2: note: each undeclared identifier is reported only once for each function it appears in
   mm/vmalloc.c:303:2: error: expected ';' at end of input
   mm/vmalloc.c:303:2: error: expected declaration or statement at end of input
   mm/vmalloc.c:276:15: warning: unused variable 'pte' [-Wunused-variable]
     pte_t *ptep, pte;
                  ^~~
   mm/vmalloc.c:276:9: warning: unused variable 'ptep' [-Wunused-variable]
     pte_t *ptep, pte;
            ^~~~
   mm/vmalloc.c:271:15: warning: unused variable 'page' [-Wunused-variable]
     struct page *page = NULL;
                  ^~~~
   mm/vmalloc.c: At top level:
   mm/vmalloc.c:47:13: warning: '__vunmap' used but never defined
    static void __vunmap(const void *, int);
                ^~~~~~~~
   mm/vmalloc.c: In function 'vmalloc_to_page':
   mm/vmalloc.c:303:2: warning: control reaches end of non-void function [-Wreturn-type]
     WARN_ON_ONCE(pmd_bad(*pmd);
     ^~~~~~~~~~~~
   At top level:
   mm/vmalloc.c:240:12: warning: 'vmap_page_range' defined but not used [-Wunused-function]
    static int vmap_page_range(unsigned long start, unsigned long end,
               ^~~~~~~~~~~~~~~
   mm/vmalloc.c:121:13: warning: 'vunmap_page_range' defined but not used [-Wunused-function]
    static void vunmap_page_range(unsigned long addr, unsigned long end)
                ^~~~~~~~~~~~~~~~~
   mm/vmalloc.c:49:13: warning: 'free_work' defined but not used [-Wunused-function]
    static void free_work(struct work_struct *w)
                ^~~~~~~~~
   In file included from include/asm-generic/percpu.h:6:0,
                    from arch/x86/include/asm/percpu.h:542,
                    from arch/x86/include/asm/preempt.h:5,
                    from include/linux/preempt.h:80,
                    from include/linux/spinlock.h:50,
                    from include/linux/vmalloc.h:4,
                    from mm/vmalloc.c:11:
   mm/vmalloc.c:45:46: warning: 'vfree_deferred' defined but not used [-Wunused-variable]
    static DEFINE_PER_CPU(struct vfree_deferred, vfree_deferred);
                                                 ^
   include/linux/percpu-defs.h:105:19: note: in definition of macro 'DEFINE_PER_CPU_SECTION'
     __typeof__(type) name
                      ^~~~
>> mm/vmalloc.c:45:8: note: in expansion of macro 'DEFINE_PER_CPU'
    static DEFINE_PER_CPU(struct vfree_deferred, vfree_deferred);
           ^~~~~~~~~~~~~~

vim +/DEFINE_PER_CPU +45 mm/vmalloc.c

^1da177e4 Linus Torvalds       2005-04-16   5   *  Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
^1da177e4 Linus Torvalds       2005-04-16   6   *  SMP-safe vmalloc/vfree/ioremap, Tigran Aivazian <tigran@veritas.com>, May 2000
^1da177e4 Linus Torvalds       2005-04-16   7   *  Major rework to support vmap/vunmap, Christoph Hellwig, SGI, August 2002
930fc45a4 Christoph Lameter    2005-10-29   8   *  Numa awareness, Christoph Lameter, SGI, June 2005
^1da177e4 Linus Torvalds       2005-04-16   9   */
^1da177e4 Linus Torvalds       2005-04-16  10  
db64fe022 Nick Piggin          2008-10-18 @11  #include <linux/vmalloc.h>
^1da177e4 Linus Torvalds       2005-04-16  12  #include <linux/mm.h>
^1da177e4 Linus Torvalds       2005-04-16  13  #include <linux/module.h>
^1da177e4 Linus Torvalds       2005-04-16  14  #include <linux/highmem.h>
c3edc4010 Ingo Molnar          2017-02-02  15  #include <linux/sched/signal.h>
^1da177e4 Linus Torvalds       2005-04-16  16  #include <linux/slab.h>
^1da177e4 Linus Torvalds       2005-04-16  17  #include <linux/spinlock.h>
^1da177e4 Linus Torvalds       2005-04-16  18  #include <linux/interrupt.h>
5f6a6a9c4 Alexey Dobriyan      2008-10-06  19  #include <linux/proc_fs.h>
a10aa5798 Christoph Lameter    2008-04-28  20  #include <linux/seq_file.h>
3ac7fe5a4 Thomas Gleixner      2008-04-30  21  #include <linux/debugobjects.h>
230169693 Christoph Lameter    2008-04-28  22  #include <linux/kallsyms.h>
db64fe022 Nick Piggin          2008-10-18  23  #include <linux/list.h>
4da56b99d Chris Wilson         2016-04-04  24  #include <linux/notifier.h>
db64fe022 Nick Piggin          2008-10-18  25  #include <linux/rbtree.h>
db64fe022 Nick Piggin          2008-10-18  26  #include <linux/radix-tree.h>
db64fe022 Nick Piggin          2008-10-18  27  #include <linux/rcupdate.h>
f0aa66179 Tejun Heo            2009-02-20  28  #include <linux/pfn.h>
89219d37a Catalin Marinas      2009-06-11  29  #include <linux/kmemleak.h>
60063497a Arun Sharma          2011-07-26  30  #include <linux/atomic.h>
3b32123d7 Gideon Israel Dsouza 2014-04-07  31  #include <linux/compiler.h>
32fcfd407 Al Viro              2013-03-10  32  #include <linux/llist.h>
0f616be12 Toshi Kani           2015-04-14  33  #include <linux/bitops.h>
3b32123d7 Gideon Israel Dsouza 2014-04-07  34  
7c0f6ba68 Linus Torvalds       2016-12-24  35  #include <linux/uaccess.h>
^1da177e4 Linus Torvalds       2005-04-16  36  #include <asm/tlbflush.h>
2dca6999e David Miller         2009-09-21  37  #include <asm/shmparam.h>
^1da177e4 Linus Torvalds       2005-04-16  38  
dd56b0464 Mel Gorman           2015-11-06  39  #include "internal.h"
dd56b0464 Mel Gorman           2015-11-06  40  
32fcfd407 Al Viro              2013-03-10  41  struct vfree_deferred {
32fcfd407 Al Viro              2013-03-10  42  	struct llist_head list;
32fcfd407 Al Viro              2013-03-10  43  	struct work_struct wq;
32fcfd407 Al Viro              2013-03-10  44  };
32fcfd407 Al Viro              2013-03-10 @45  static DEFINE_PER_CPU(struct vfree_deferred, vfree_deferred);
32fcfd407 Al Viro              2013-03-10  46  
32fcfd407 Al Viro              2013-03-10  47  static void __vunmap(const void *, int);
32fcfd407 Al Viro              2013-03-10  48  

:::::: The code at line 45 was first introduced by commit
:::::: 32fcfd40715ed13f7a80cbde49d097ddae20c8e2 make vfree() safe to call from interrupt contexts

:::::: TO: Al Viro <viro@zeniv.linux.org.uk>
:::::: CC: Al Viro <viro@zeniv.linux.org.uk>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26719 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4] mm: huge-vmap: fail gracefully on unexpected huge vmap mappings
@ 2017-06-09  2:29   ` kbuild test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2017-06-09  2:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Ard,

[auto build test WARNING on mmotm/master]
[also build test WARNING on v4.12-rc4 next-20170608]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ard-Biesheuvel/mm-huge-vmap-fail-gracefully-on-unexpected-huge-vmap-mappings/20170609-093236
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: x86_64-randconfig-x015-201723 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   mm/vmalloc.c: In function 'vmalloc_to_page':
   mm/vmalloc.c:2775:0: error: unterminated argument list invoking macro "WARN_ON_ONCE"
    
    
   mm/vmalloc.c:303:2: error: 'WARN_ON_ONCE' undeclared (first use in this function)
     WARN_ON_ONCE(pmd_bad(*pmd);
     ^~~~~~~~~~~~
   mm/vmalloc.c:303:2: note: each undeclared identifier is reported only once for each function it appears in
   mm/vmalloc.c:303:2: error: expected ';' at end of input
   mm/vmalloc.c:303:2: error: expected declaration or statement at end of input
   mm/vmalloc.c:276:15: warning: unused variable 'pte' [-Wunused-variable]
     pte_t *ptep, pte;
                  ^~~
   mm/vmalloc.c:276:9: warning: unused variable 'ptep' [-Wunused-variable]
     pte_t *ptep, pte;
            ^~~~
   mm/vmalloc.c:271:15: warning: unused variable 'page' [-Wunused-variable]
     struct page *page = NULL;
                  ^~~~
   mm/vmalloc.c: At top level:
   mm/vmalloc.c:47:13: warning: '__vunmap' used but never defined
    static void __vunmap(const void *, int);
                ^~~~~~~~
   mm/vmalloc.c: In function 'vmalloc_to_page':
   mm/vmalloc.c:303:2: warning: control reaches end of non-void function [-Wreturn-type]
     WARN_ON_ONCE(pmd_bad(*pmd);
     ^~~~~~~~~~~~
   At top level:
   mm/vmalloc.c:240:12: warning: 'vmap_page_range' defined but not used [-Wunused-function]
    static int vmap_page_range(unsigned long start, unsigned long end,
               ^~~~~~~~~~~~~~~
   mm/vmalloc.c:121:13: warning: 'vunmap_page_range' defined but not used [-Wunused-function]
    static void vunmap_page_range(unsigned long addr, unsigned long end)
                ^~~~~~~~~~~~~~~~~
   mm/vmalloc.c:49:13: warning: 'free_work' defined but not used [-Wunused-function]
    static void free_work(struct work_struct *w)
                ^~~~~~~~~
   In file included from include/asm-generic/percpu.h:6:0,
                    from arch/x86/include/asm/percpu.h:542,
                    from arch/x86/include/asm/preempt.h:5,
                    from include/linux/preempt.h:80,
                    from include/linux/spinlock.h:50,
                    from include/linux/vmalloc.h:4,
                    from mm/vmalloc.c:11:
   mm/vmalloc.c:45:46: warning: 'vfree_deferred' defined but not used [-Wunused-variable]
    static DEFINE_PER_CPU(struct vfree_deferred, vfree_deferred);
                                                 ^
   include/linux/percpu-defs.h:105:19: note: in definition of macro 'DEFINE_PER_CPU_SECTION'
     __typeof__(type) name
                      ^~~~
>> mm/vmalloc.c:45:8: note: in expansion of macro 'DEFINE_PER_CPU'
    static DEFINE_PER_CPU(struct vfree_deferred, vfree_deferred);
           ^~~~~~~~~~~~~~

vim +/DEFINE_PER_CPU +45 mm/vmalloc.c

^1da177e4 Linus Torvalds       2005-04-16   5   *  Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
^1da177e4 Linus Torvalds       2005-04-16   6   *  SMP-safe vmalloc/vfree/ioremap, Tigran Aivazian <tigran@veritas.com>, May 2000
^1da177e4 Linus Torvalds       2005-04-16   7   *  Major rework to support vmap/vunmap, Christoph Hellwig, SGI, August 2002
930fc45a4 Christoph Lameter    2005-10-29   8   *  Numa awareness, Christoph Lameter, SGI, June 2005
^1da177e4 Linus Torvalds       2005-04-16   9   */
^1da177e4 Linus Torvalds       2005-04-16  10  
db64fe022 Nick Piggin          2008-10-18 @11  #include <linux/vmalloc.h>
^1da177e4 Linus Torvalds       2005-04-16  12  #include <linux/mm.h>
^1da177e4 Linus Torvalds       2005-04-16  13  #include <linux/module.h>
^1da177e4 Linus Torvalds       2005-04-16  14  #include <linux/highmem.h>
c3edc4010 Ingo Molnar          2017-02-02  15  #include <linux/sched/signal.h>
^1da177e4 Linus Torvalds       2005-04-16  16  #include <linux/slab.h>
^1da177e4 Linus Torvalds       2005-04-16  17  #include <linux/spinlock.h>
^1da177e4 Linus Torvalds       2005-04-16  18  #include <linux/interrupt.h>
5f6a6a9c4 Alexey Dobriyan      2008-10-06  19  #include <linux/proc_fs.h>
a10aa5798 Christoph Lameter    2008-04-28  20  #include <linux/seq_file.h>
3ac7fe5a4 Thomas Gleixner      2008-04-30  21  #include <linux/debugobjects.h>
230169693 Christoph Lameter    2008-04-28  22  #include <linux/kallsyms.h>
db64fe022 Nick Piggin          2008-10-18  23  #include <linux/list.h>
4da56b99d Chris Wilson         2016-04-04  24  #include <linux/notifier.h>
db64fe022 Nick Piggin          2008-10-18  25  #include <linux/rbtree.h>
db64fe022 Nick Piggin          2008-10-18  26  #include <linux/radix-tree.h>
db64fe022 Nick Piggin          2008-10-18  27  #include <linux/rcupdate.h>
f0aa66179 Tejun Heo            2009-02-20  28  #include <linux/pfn.h>
89219d37a Catalin Marinas      2009-06-11  29  #include <linux/kmemleak.h>
60063497a Arun Sharma          2011-07-26  30  #include <linux/atomic.h>
3b32123d7 Gideon Israel Dsouza 2014-04-07  31  #include <linux/compiler.h>
32fcfd407 Al Viro              2013-03-10  32  #include <linux/llist.h>
0f616be12 Toshi Kani           2015-04-14  33  #include <linux/bitops.h>
3b32123d7 Gideon Israel Dsouza 2014-04-07  34  
7c0f6ba68 Linus Torvalds       2016-12-24  35  #include <linux/uaccess.h>
^1da177e4 Linus Torvalds       2005-04-16  36  #include <asm/tlbflush.h>
2dca6999e David Miller         2009-09-21  37  #include <asm/shmparam.h>
^1da177e4 Linus Torvalds       2005-04-16  38  
dd56b0464 Mel Gorman           2015-11-06  39  #include "internal.h"
dd56b0464 Mel Gorman           2015-11-06  40  
32fcfd407 Al Viro              2013-03-10  41  struct vfree_deferred {
32fcfd407 Al Viro              2013-03-10  42  	struct llist_head list;
32fcfd407 Al Viro              2013-03-10  43  	struct work_struct wq;
32fcfd407 Al Viro              2013-03-10  44  };
32fcfd407 Al Viro              2013-03-10 @45  static DEFINE_PER_CPU(struct vfree_deferred, vfree_deferred);
32fcfd407 Al Viro              2013-03-10  46  
32fcfd407 Al Viro              2013-03-10  47  static void __vunmap(const void *, int);
32fcfd407 Al Viro              2013-03-10  48  

:::::: The code at line 45 was first introduced by commit
:::::: 32fcfd40715ed13f7a80cbde49d097ddae20c8e2 make vfree() safe to call from interrupt contexts

:::::: TO: Al Viro <viro@zeniv.linux.org.uk>
:::::: CC: Al Viro <viro@zeniv.linux.org.uk>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 26719 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170609/de1f4dfc/attachment-0001.gz>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-06-09  2:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-08 19:22 [PATCH v4] mm: huge-vmap: fail gracefully on unexpected huge vmap mappings Ard Biesheuvel
2017-06-08 19:22 ` Ard Biesheuvel
2017-06-09  2:29 ` kbuild test robot
2017-06-09  2:29   ` kbuild test robot
2017-06-09  2:29 ` kbuild test robot
2017-06-09  2:29   ` kbuild test robot

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.