tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: d47175169c28eedd2cc2ab8c01f38764cb0269cc commit: 2c9d6ff6cb31c96c407ef6000b5ddcbf7169f087 [13885/13946] mm: untag user pointers in mmap/munmap/mremap/brk config: sparc64-allmodconfig (attached as .config) compiler: sparc64-linux-gcc (GCC) 7.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 2c9d6ff6cb31c96c407ef6000b5ddcbf7169f087 # save the attached .config to linux build tree GCC_VERSION=7.4.0 make.cross ARCH=sparc64 If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@xxxxxxxxx> All error/warnings (new ones prefixed by >>): mm/mmap.c: In function '__do_sys_brk': >> mm/mmap.c:204:26: error: expected ')' before ';' token brk = untagged_addr(brk); ^ >> mm/mmap.c:292:1: error: expected ';' before '}' token } ^ mm/mmap.c:201:7: warning: unused variable 'downgraded' [-Wunused-variable] bool downgraded = false; ^~~~~~~~~~ mm/mmap.c:200:7: warning: unused variable 'populate' [-Wunused-variable] bool populate; ^~~~~~~~ mm/mmap.c:199:16: warning: unused variable 'min_brk' [-Wunused-variable] unsigned long min_brk; ^~~~~~~ mm/mmap.c:198:25: warning: unused variable 'next' [-Wunused-variable] struct vm_area_struct *next; ^~~~ mm/mmap.c:197:20: warning: unused variable 'mm' [-Wunused-variable] struct mm_struct *mm = current->mm; ^~ mm/mmap.c:196:32: warning: unused variable 'origbrk' [-Wunused-variable] unsigned long newbrk, oldbrk, origbrk; ^~~~~~~ mm/mmap.c:196:24: warning: unused variable 'oldbrk' [-Wunused-variable] unsigned long newbrk, oldbrk, origbrk; ^~~~~~ mm/mmap.c:196:16: warning: unused variable 'newbrk' [-Wunused-variable] unsigned long newbrk, oldbrk, origbrk; ^~~~~~ mm/mmap.c:195:16: warning: unused variable 'retval' [-Wunused-variable] unsigned long retval; ^~~~~~ >> mm/mmap.c:292:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ mm/mmap.c: In function 'ksys_mmap_pgoff': mm/mmap.c:1592:28: error: expected ')' before ';' token addr = untagged_addr(addr); ^ mm/mmap.c:1634:1: error: expected ';' before '}' token } ^ mm/mmap.c:1590:16: warning: unused variable 'retval' [-Wunused-variable] unsigned long retval; ^~~~~~ mm/mmap.c:1589:15: warning: unused variable 'file' [-Wunused-variable] struct file *file = NULL; ^~~~ mm/mmap.c: In function '__do_sys_munmap': mm/mmap.c:2892:28: error: expected ')' before ';' token addr = untagged_addr(addr); ^ mm/mmap.c:2895:1: error: expected ';' before '}' token } ^ mm/mmap.c:2895:1: warning: no return statement in function returning non-void [-Wreturn-type] mm/mmap.c: In function 'ksys_mmap_pgoff': >> mm/mmap.c:1634:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ -- mm/mremap.c: In function '__do_sys_mremap': mm/mremap.c:609:28: error: expected ')' before ';' token addr = untagged_addr(addr); ^ >> mm/mremap.c:732:1: error: expected declaration or statement at end of input } ^ mm/mremap.c:605:28: warning: unused variable 'uf' [-Wunused-variable] struct vm_userfaultfd_ctx uf = NULL_VM_UFFD_CTX; ^~ mm/mremap.c:604:7: warning: unused variable 'downgraded' [-Wunused-variable] bool downgraded = false; ^~~~~~~~~~ mm/mremap.c:603:7: warning: unused variable 'locked' [-Wunused-variable] bool locked = false; ^~~~~~ mm/mremap.c:602:16: warning: unused variable 'charged' [-Wunused-variable] unsigned long charged = 0; ^~~~~~~ mm/mremap.c:601:16: warning: unused variable 'ret' [-Wunused-variable] unsigned long ret = -EINVAL; ^~~ mm/mremap.c:600:25: warning: unused variable 'vma' [-Wunused-variable] struct vm_area_struct *vma; ^~~ mm/mremap.c:599:20: warning: unused variable 'mm' [-Wunused-variable] struct mm_struct *mm = current->mm; ^~ mm/mremap.c:732:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ At top level: mm/mremap.c:575:12: warning: 'vma_expandable' defined but not used [-Wunused-function] static int vma_expandable(struct vm_area_struct *vma, unsigned long delta) ^~~~~~~~~~~~~~ mm/mremap.c:498:22: warning: 'mremap_to' defined but not used [-Wunused-function] static unsigned long mremap_to(unsigned long addr, unsigned long old_len, ^~~~~~~~~ vim +204 mm/mmap.c 190 191 static int do_brk_flags(unsigned long addr, unsigned long request, unsigned long flags, 192 struct list_head *uf); 193 SYSCALL_DEFINE1(brk, unsigned long, brk) 194 { 195 unsigned long retval; > 196 unsigned long newbrk, oldbrk, origbrk; 197 struct mm_struct *mm = current->mm; 198 struct vm_area_struct *next; 199 unsigned long min_brk; 200 bool populate; 201 bool downgraded = false; 202 LIST_HEAD(uf); 203 > 204 brk = untagged_addr(brk); 205 206 if (down_write_killable(&mm->mmap_sem)) 207 return -EINTR; 208 209 origbrk = mm->brk; 210 211 #ifdef CONFIG_COMPAT_BRK 212 /* 213 * CONFIG_COMPAT_BRK can still be overridden by setting 214 * randomize_va_space to 2, which will still cause mm->start_brk 215 * to be arbitrarily shifted 216 */ 217 if (current->brk_randomized) 218 min_brk = mm->start_brk; 219 else 220 min_brk = mm->end_data; 221 #else 222 min_brk = mm->start_brk; 223 #endif 224 if (brk < min_brk) 225 goto out; 226 227 /* 228 * Check against rlimit here. If this check is done later after the test 229 * of oldbrk with newbrk then it can escape the test and let the data 230 * segment grow beyond its set limit the in case where the limit is 231 * not page aligned -Ram Gupta 232 */ 233 if (check_data_rlimit(rlimit(RLIMIT_DATA), brk, mm->start_brk, 234 mm->end_data, mm->start_data)) 235 goto out; 236 237 newbrk = PAGE_ALIGN(brk); 238 oldbrk = PAGE_ALIGN(mm->brk); 239 if (oldbrk == newbrk) { 240 mm->brk = brk; 241 goto success; 242 } 243 244 /* 245 * Always allow shrinking brk. 246 * __do_munmap() may downgrade mmap_sem to read. 247 */ 248 if (brk <= mm->brk) { 249 int ret; 250 251 /* 252 * mm->brk must to be protected by write mmap_sem so update it 253 * before downgrading mmap_sem. When __do_munmap() fails, 254 * mm->brk will be restored from origbrk. 255 */ 256 mm->brk = brk; 257 ret = __do_munmap(mm, newbrk, oldbrk-newbrk, &uf, true); 258 if (ret < 0) { 259 mm->brk = origbrk; 260 goto out; 261 } else if (ret == 1) { 262 downgraded = true; 263 } 264 goto success; 265 } 266 267 /* Check against existing mmap mappings. */ 268 next = find_vma(mm, oldbrk); 269 if (next && newbrk + PAGE_SIZE > vm_start_gap(next)) 270 goto out; 271 272 /* Ok, looks good - let it rip. */ 273 if (do_brk_flags(oldbrk, newbrk-oldbrk, 0, &uf) < 0) 274 goto out; 275 mm->brk = brk; 276 277 success: 278 populate = newbrk > oldbrk && (mm->def_flags & VM_LOCKED) != 0; 279 if (downgraded) 280 up_read(&mm->mmap_sem); 281 else 282 up_write(&mm->mmap_sem); 283 userfaultfd_unmap_complete(mm, &uf); 284 if (populate) 285 mm_populate(oldbrk, newbrk - oldbrk); 286 return brk; 287 288 out: 289 retval = origbrk; 290 up_write(&mm->mmap_sem); 291 return retval; > 292 } 293 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip