Re: [PATCH v5 1/4] x86, boot: Refactor KASLR entropy functions
From: kbuild test robot
Date: Thu May 12 2016 - 16:20:13 EST
Hi,
[auto build test WARNING on next-20160512]
[cannot apply to tip/x86/core v4.6-rc7 v4.6-rc6 v4.6-rc5 v4.6-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Thomas-Garnier/x86-boot-KASLR-memory-randomization/20160513-033333
config: i386-randconfig-i1-05121127 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
arch/x86/boot/compressed/kaslr.c: In function 'find_random_virt_addr':
>> arch/x86/boot/compressed/kaslr.c:390:16: warning: implicit declaration of function 'get_random_long' [-Wimplicit-function-declaration]
random_addr = get_random_long("Virtual") % slots;
^~~~~~~~~~~~~~~
vim +/get_random_long +390 arch/x86/boot/compressed/kaslr.c
071a7493 Baoquan He 2016-05-09 374 {
071a7493 Baoquan He 2016-05-09 375 unsigned long slots, random_addr;
071a7493 Baoquan He 2016-05-09 376
071a7493 Baoquan He 2016-05-09 377 /* Make sure minimum is aligned. */
071a7493 Baoquan He 2016-05-09 378 minimum = ALIGN(minimum, CONFIG_PHYSICAL_ALIGN);
071a7493 Baoquan He 2016-05-09 379 /* Align image_size for easy slot calculations. */
071a7493 Baoquan He 2016-05-09 380 image_size = ALIGN(image_size, CONFIG_PHYSICAL_ALIGN);
071a7493 Baoquan He 2016-05-09 381
071a7493 Baoquan He 2016-05-09 382 /*
071a7493 Baoquan He 2016-05-09 383 * There are how many CONFIG_PHYSICAL_ALIGN-sized slots
071a7493 Baoquan He 2016-05-09 384 * that can hold image_size within the range of minimum to
071a7493 Baoquan He 2016-05-09 385 * KERNEL_IMAGE_SIZE?
071a7493 Baoquan He 2016-05-09 386 */
071a7493 Baoquan He 2016-05-09 387 slots = (KERNEL_IMAGE_SIZE - minimum - image_size) /
071a7493 Baoquan He 2016-05-09 388 CONFIG_PHYSICAL_ALIGN + 1;
071a7493 Baoquan He 2016-05-09 389
d2d3462f Kees Cook 2016-05-09 @390 random_addr = get_random_long("Virtual") % slots;
071a7493 Baoquan He 2016-05-09 391
071a7493 Baoquan He 2016-05-09 392 return random_addr * CONFIG_PHYSICAL_ALIGN + minimum;
071a7493 Baoquan He 2016-05-09 393 }
071a7493 Baoquan He 2016-05-09 394
549f90db Borislav Petkov 2016-05-06 395 /*
549f90db Borislav Petkov 2016-05-06 396 * Since this function examines addresses much more numerically,
549f90db Borislav Petkov 2016-05-06 397 * it takes the input and output pointers as 'unsigned long'.
549f90db Borislav Petkov 2016-05-06 398 */
:::::: The code at line 390 was first introduced by commit
:::::: d2d3462f9f08da364c8fbd41e8e32229d610d49d x86/KASLR: Clarify purpose of each get_random_long()
:::::: TO: Kees Cook <keescook@xxxxxxxxxxxx>
:::::: CC: Ingo Molnar <mingo@xxxxxxxxxx>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: Binary data