Hi Rick, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v4.19-rc3 next-20180913] [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/Rick-Edgecombe/KASLR-feature-to-randomize-each-loadable-module/20180913-172302 config: openrisc-allyesconfig (attached as .config) compiler: or1k-linux-gcc (GCC) 6.0.0 20160327 (experimental) reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=openrisc All errors (new ones prefixed by >>): lib/test_mod_alloc.c: In function 'do_check': >> lib/test_mod_alloc.c:129:15: error: 'MODULES_VADDR' undeclared (first use in this function) if (start < MODULES_VADDR || ^~~~~~~~~~~~~ lib/test_mod_alloc.c:129:15: note: each undeclared identifier is reported only once for each function it appears in >> lib/test_mod_alloc.c:130:26: error: 'MODULES_LEN' undeclared (first use in this function) end > MODULES_VADDR + MODULES_LEN) { ^~~~~~~~~~~ lib/test_mod_alloc.c: In function 'device_file_write': lib/test_mod_alloc.c:404:2: warning: ignoring return value of 'copy_from_user', declared with attribute warn_unused_result [-Wunused-result] copy_from_user(buf, user_buf, count); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ lib/test_mod_alloc.c:407:3: warning: ignoring return value of 'kstrtol', declared with attribute warn_unused_result [-Wunused-result] kstrtol(buf+1, 10, &new_mod_cnt); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ lib/test_mod_alloc.c:422:3: warning: ignoring return value of 'kstrtol', declared with attribute warn_unused_result [-Wunused-result] kstrtol(buf + 1, 10, &iter); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ vim +/MODULES_VADDR +129 lib/test_mod_alloc.c 89 90 static int do_check(void *ptr, unsigned long size) 91 { 92 int i; 93 unsigned long start = (unsigned long) ptr; 94 unsigned long end = calc_end(ptr, size); 95 unsigned long sum = 0; 96 unsigned long addr; 97 98 if (!start) 99 return 1; 100 101 for (i = 0; i < check_alloc_cnt; i++) { 102 struct check_alloc *cur_alloc = &(check_allocs[i]); 103 104 /* overlap end */ 105 if (start >= cur_alloc->start && start < cur_alloc->vm_end) { 106 pr_info("overlap end\n"); 107 return 1; 108 } 109 110 /* overlap start */ 111 if (end >= cur_alloc->start && end < cur_alloc->start) { 112 pr_info("overlap start\n"); 113 return 1; 114 } 115 116 /* overlap whole thing */ 117 if (start <= cur_alloc->start && end > cur_alloc->vm_end) { 118 pr_info("overlap whole thing\n"); 119 return 1; 120 } 121 122 /* inside */ 123 if (start >= cur_alloc->start && end < cur_alloc->vm_end) { 124 pr_info("inside\n"); 125 return 1; 126 } 127 128 /* bounds */ > 129 if (start < MODULES_VADDR || > 130 end > MODULES_VADDR + MODULES_LEN) { 131 pr_info("out of bounds\n"); 132 return 1; 133 } 134 for (addr = cur_alloc->start; 135 addr < cur_alloc->real_end; 136 addr += PAGE_SIZE) { 137 sum += *((unsigned long *) addr); 138 } 139 if (sum != 0) 140 pr_info("Memory was not zeroed\n"); 141 142 kasan_check_read((void *)cur_alloc->start, 143 cur_alloc->vm_end - cur_alloc->start - PAGE_SIZE); 144 } 145 return 0; 146 } 147 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip