Re: [PATCH 2/2] x86/KASLR/64: Determine kernel text mapping size at runtime

From: kbuild test robot
Date: Thu Dec 08 2016 - 04:42:51 EST


Hi Baoquan,

[auto build test WARNING on tip/x86/core]
[also build test WARNING on v4.9-rc8 next-20161208]
[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/Baoquan-He/Determine-kernel-text-mapping-size-at-runtime-for-x86_64/20161208-172019
config: x86_64-randconfig-x014-201649 (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 >>):

In file included from include/linux/linkage.h:4:0,
from include/linux/preempt.h:9,
from include/linux/spinlock.h:50,
from include/linux/mmzone.h:7,
from include/linux/bootmem.h:7,
from arch/x86/mm/physaddr.c:1:
arch/x86/mm/physaddr.c: In function '__phys_addr':
arch/x86/include/asm/page_64_types.h:67:29: error: 'kernel_mapping_size' undeclared (first use in this function)
#define KERNEL_MAPPING_SIZE kernel_mapping_size
^
include/linux/compiler.h:168:42: note: in definition of macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/mmdebug.h:55:30: note: in expansion of macro 'BUG_ON'
#define VIRTUAL_BUG_ON(cond) BUG_ON(cond)
^~~~~~
>> arch/x86/mm/physaddr.c:21:3: note: in expansion of macro 'VIRTUAL_BUG_ON'
VIRTUAL_BUG_ON(y >= KERNEL_MAPPING_SIZE);
^~~~~~~~~~~~~~
arch/x86/mm/physaddr.c:21:23: note: in expansion of macro 'KERNEL_MAPPING_SIZE'
VIRTUAL_BUG_ON(y >= KERNEL_MAPPING_SIZE);
^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/page_64_types.h:67:29: note: each undeclared identifier is reported only once for each function it appears in
#define KERNEL_MAPPING_SIZE kernel_mapping_size
^
include/linux/compiler.h:168:42: note: in definition of macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/mmdebug.h:55:30: note: in expansion of macro 'BUG_ON'
#define VIRTUAL_BUG_ON(cond) BUG_ON(cond)
^~~~~~
>> arch/x86/mm/physaddr.c:21:3: note: in expansion of macro 'VIRTUAL_BUG_ON'
VIRTUAL_BUG_ON(y >= KERNEL_MAPPING_SIZE);
^~~~~~~~~~~~~~
arch/x86/mm/physaddr.c:21:23: note: in expansion of macro 'KERNEL_MAPPING_SIZE'
VIRTUAL_BUG_ON(y >= KERNEL_MAPPING_SIZE);
^~~~~~~~~~~~~~~~~~~
arch/x86/mm/physaddr.c: In function '__phys_addr_symbol':
arch/x86/include/asm/page_64_types.h:67:29: error: 'kernel_mapping_size' undeclared (first use in this function)
#define KERNEL_MAPPING_SIZE kernel_mapping_size
^
include/linux/compiler.h:168:42: note: in definition of macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/mmdebug.h:55:30: note: in expansion of macro 'BUG_ON'
#define VIRTUAL_BUG_ON(cond) BUG_ON(cond)
^~~~~~
arch/x86/mm/physaddr.c:38:2: note: in expansion of macro 'VIRTUAL_BUG_ON'
VIRTUAL_BUG_ON(y >= KERNEL_MAPPING_SIZE);
^~~~~~~~~~~~~~
arch/x86/mm/physaddr.c:38:22: note: in expansion of macro 'KERNEL_MAPPING_SIZE'
VIRTUAL_BUG_ON(y >= KERNEL_MAPPING_SIZE);
^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/page_types.h:47:0,
from arch/x86/include/asm/page.h:8,
from arch/x86/include/asm/thread_info.h:11,
from include/linux/thread_info.h:58,
from arch/x86/include/asm/preempt.h:6,
from include/linux/preempt.h:59,
from include/linux/spinlock.h:50,
from include/linux/mmzone.h:7,
from include/linux/bootmem.h:7,
from arch/x86/mm/physaddr.c:1:
arch/x86/mm/physaddr.c: In function '__virt_addr_valid':
arch/x86/include/asm/page_64_types.h:67:29: error: 'kernel_mapping_size' undeclared (first use in this function)
#define KERNEL_MAPPING_SIZE kernel_mapping_size
^
>> arch/x86/mm/physaddr.c:53:12: note: in expansion of macro 'KERNEL_MAPPING_SIZE'
if (y >= KERNEL_MAPPING_SIZE)
^~~~~~~~~~~~~~~~~~~
--
In file included from arch/x86/include/asm/page_types.h:47:0,
from arch/x86/include/asm/page.h:8,
from arch/x86/include/asm/thread_info.h:11,
from include/linux/thread_info.h:58,
from arch/x86/include/asm/preempt.h:6,
from include/linux/preempt.h:59,
from include/linux/spinlock.h:50,
from include/linux/wait.h:8,
from include/linux/fs.h:5,
from include/linux/debugfs.h:18,
from arch/x86/mm/dump_pagetables.c:15:
arch/x86/mm/dump_pagetables.c: In function 'pt_dump_init':
arch/x86/include/asm/page_64_types.h:67:29: error: 'kernel_mapping_size' undeclared (first use in this function)
#define KERNEL_MAPPING_SIZE kernel_mapping_size
^
>> arch/x86/include/asm/pgtable_64_types.h:69:48: note: in expansion of macro 'KERNEL_MAPPING_SIZE'
#define MODULES_VADDR (__START_KERNEL_map + KERNEL_MAPPING_SIZE)
^~~~~~~~~~~~~~~~~~~
>> arch/x86/mm/dump_pagetables.c:445:52: note: in expansion of macro 'MODULES_VADDR'
address_markers[MODULES_VADDR_NR].start_address = MODULES_VADDR;
^~~~~~~~~~~~~
arch/x86/include/asm/page_64_types.h:67:29: note: each undeclared identifier is reported only once for each function it appears in
#define KERNEL_MAPPING_SIZE kernel_mapping_size
^
>> arch/x86/include/asm/pgtable_64_types.h:69:48: note: in expansion of macro 'KERNEL_MAPPING_SIZE'
#define MODULES_VADDR (__START_KERNEL_map + KERNEL_MAPPING_SIZE)
^~~~~~~~~~~~~~~~~~~
>> arch/x86/mm/dump_pagetables.c:445:52: note: in expansion of macro 'MODULES_VADDR'
address_markers[MODULES_VADDR_NR].start_address = MODULES_VADDR;
^~~~~~~~~~~~~

vim +/VIRTUAL_BUG_ON +21 arch/x86/mm/physaddr.c

5
6 #include <asm/page.h>
7
8 #include "physaddr.h"
9
10 #ifdef CONFIG_X86_64
11
12 #ifdef CONFIG_DEBUG_VIRTUAL
13 unsigned long __phys_addr(unsigned long x)
14 {
15 unsigned long y = x - __START_KERNEL_map;
16
17 /* use the carry flag to determine if x was < __START_KERNEL_map */
18 if (unlikely(x > y)) {
19 x = y + phys_base;
20
> 21 VIRTUAL_BUG_ON(y >= KERNEL_MAPPING_SIZE);
22 } else {
23 x = y + (__START_KERNEL_map - PAGE_OFFSET);
24
25 /* carry flag will be set if starting x was >= PAGE_OFFSET */
26 VIRTUAL_BUG_ON((x > y) || !phys_addr_valid(x));
27 }
28
29 return x;

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

Attachment: .config.gz
Description: application/gzip