tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: d47175169c28eedd2cc2ab8c01f38764cb0269cc commit: aeb71ff8cfaf27810add3cef8068233cfc08ad2a [13877/13946] mm: untag user pointers in get_vaddr_frames 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 aeb71ff8cfaf27810add3cef8068233cfc08ad2a # 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/frame_vector.c: In function 'get_vaddr_frames': >> mm/frame_vector.c:49:30: error: expected ')' before ';' token start = untagged_addr(start); ^ >> mm/frame_vector.c:111:1: error: expected ';' before '}' token } ^ mm/frame_vector.c:41:6: warning: unused variable 'locked' [-Wunused-variable] int locked; ^~~~~~ mm/frame_vector.c:40:6: warning: unused variable 'err' [-Wunused-variable] int err; ^~~ mm/frame_vector.c:39:6: warning: unused variable 'ret' [-Wunused-variable] int ret = 0; ^~~ mm/frame_vector.c:38:25: warning: unused variable 'vma' [-Wunused-variable] struct vm_area_struct *vma; ^~~ mm/frame_vector.c:37:20: warning: unused variable 'mm' [-Wunused-variable] struct mm_struct *mm = current->mm; ^~ >> mm/frame_vector.c:111:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ vim +49 mm/frame_vector.c 10 11 /** 12 * get_vaddr_frames() - map virtual addresses to pfns 13 * @start: starting user address 14 * @nr_frames: number of pages / pfns from start to map 15 * @gup_flags: flags modifying lookup behaviour 16 * @vec: structure which receives pages / pfns of the addresses mapped. 17 * It should have space for at least nr_frames entries. 18 * 19 * This function maps virtual addresses from @start and fills @vec structure 20 * with page frame numbers or page pointers to corresponding pages (choice 21 * depends on the type of the vma underlying the virtual address). If @start 22 * belongs to a normal vma, the function grabs reference to each of the pages 23 * to pin them in memory. If @start belongs to VM_IO | VM_PFNMAP vma, we don't 24 * touch page structures and the caller must make sure pfns aren't reused for 25 * anything else while he is using them. 26 * 27 * The function returns number of pages mapped which may be less than 28 * @nr_frames. In particular we stop mapping if there are more vmas of 29 * different type underlying the specified range of virtual addresses. 30 * When the function isn't able to map a single page, it returns error. 31 * 32 * This function takes care of grabbing mmap_sem as necessary. 33 */ 34 int get_vaddr_frames(unsigned long start, unsigned int nr_frames, 35 unsigned int gup_flags, struct frame_vector *vec) 36 { 37 struct mm_struct *mm = current->mm; 38 struct vm_area_struct *vma; > 39 int ret = 0; 40 int err; 41 int locked; 42 43 if (nr_frames == 0) 44 return 0; 45 46 if (WARN_ON_ONCE(nr_frames > vec->nr_allocated)) 47 nr_frames = vec->nr_allocated; 48 > 49 start = untagged_addr(start); 50 51 down_read(&mm->mmap_sem); 52 locked = 1; 53 vma = find_vma_intersection(mm, start, start + 1); 54 if (!vma) { 55 ret = -EFAULT; 56 goto out; 57 } 58 59 /* 60 * While get_vaddr_frames() could be used for transient (kernel 61 * controlled lifetime) pinning of memory pages all current 62 * users establish long term (userspace controlled lifetime) 63 * page pinning. Treat get_vaddr_frames() like 64 * get_user_pages_longterm() and disallow it for filesystem-dax 65 * mappings. 66 */ 67 if (vma_is_fsdax(vma)) { 68 ret = -EOPNOTSUPP; 69 goto out; 70 } 71 72 if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) { 73 vec->got_ref = true; 74 vec->is_pfns = false; 75 ret = get_user_pages_locked(start, nr_frames, 76 gup_flags, (struct page **)(vec->ptrs), &locked); 77 goto out; 78 } 79 80 vec->got_ref = false; 81 vec->is_pfns = true; 82 do { 83 unsigned long *nums = frame_vector_pfns(vec); 84 85 while (ret < nr_frames && start + PAGE_SIZE <= vma->vm_end) { 86 err = follow_pfn(vma, start, &nums[ret]); 87 if (err) { 88 if (ret == 0) 89 ret = err; 90 goto out; 91 } 92 start += PAGE_SIZE; 93 ret++; 94 } 95 /* 96 * We stop if we have enough pages or if VMA doesn't completely 97 * cover the tail page. 98 */ 99 if (ret >= nr_frames || start < vma->vm_end) 100 break; 101 vma = find_vma_intersection(mm, start, start + 1); 102 } while (vma && vma->vm_flags & (VM_IO | VM_PFNMAP)); 103 out: 104 if (locked) 105 up_read(&mm->mmap_sem); 106 if (!ret) 107 ret = -EFAULT; 108 if (ret > 0) 109 vec->nr_frames = ret; 110 return ret; > 111 } 112 EXPORT_SYMBOL(get_vaddr_frames); 113 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip