From: kbuild test robot <lkp@intel.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: kbuild-all@01.org, Oscar Salvador <osalvador@techadventures.net>,
Zi Yan <zi.yan@cs.rutgers.edu>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
syzbot <syzbot+5dcb560fe12aa5091c06@syzkaller.appspotmail.com>,
akpm@linux-foundation.org, aneesh.kumar@linux.vnet.ibm.com,
dan.j.williams@intel.com, kirill.shutemov@linux.intel.com,
linux-mm@kvack.org, mst@redhat.com,
syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk,
ying.huang@intel.com
Subject: Re: [PATCH] mm: do not bug_on on incorrect lenght in __mm_populate
Date: Fri, 6 Jul 2018 15:50:53 +0800 [thread overview]
Message-ID: <201807061427.cYcp5ef9%fengguang.wu@intel.com> (raw)
In-Reply-To: <20180706053545.GD32658@dhcp22.suse.cz>
[-- Attachment #1: Type: text/plain, Size: 8053 bytes --]
Hi Michal,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.18-rc3 next-20180705]
[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/Michal-Hocko/mm-do-not-bug_on-on-incorrect-lenght-in-__mm_populate/20180706-134850
config: x86_64-randconfig-x015-201826 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
mm/mmap.c: In function 'do_brk_flags':
>> mm/mmap.c:2936:16: error: 'len' redeclared as different kind of symbol
unsigned long len;
^~~
mm/mmap.c:2932:59: note: previous definition of 'len' was here
static int do_brk_flags(unsigned long addr, unsigned long len, unsigned long flags, struct list_head *uf)
^~~
vim +/len +2936 mm/mmap.c
^1da177e4 Linus Torvalds 2005-04-16 2926
^1da177e4 Linus Torvalds 2005-04-16 2927 /*
^1da177e4 Linus Torvalds 2005-04-16 2928 * this is really a simplified "do_mmap". it only handles
^1da177e4 Linus Torvalds 2005-04-16 2929 * anonymous maps. eventually we may be able to do some
^1da177e4 Linus Torvalds 2005-04-16 2930 * brk-specific accounting here.
^1da177e4 Linus Torvalds 2005-04-16 2931 */
e3049e198 Michal Hocko 2018-07-06 2932 static int do_brk_flags(unsigned long addr, unsigned long len, unsigned long flags, struct list_head *uf)
^1da177e4 Linus Torvalds 2005-04-16 2933 {
^1da177e4 Linus Torvalds 2005-04-16 2934 struct mm_struct *mm = current->mm;
^1da177e4 Linus Torvalds 2005-04-16 2935 struct vm_area_struct *vma, *prev;
16e72e9b3 Denys Vlasenko 2017-02-22 @2936 unsigned long len;
^1da177e4 Linus Torvalds 2005-04-16 2937 struct rb_node **rb_link, *rb_parent;
^1da177e4 Linus Torvalds 2005-04-16 2938 pgoff_t pgoff = addr >> PAGE_SHIFT;
3a4597568 Kirill Korotaev 2006-09-07 2939 int error;
^1da177e4 Linus Torvalds 2005-04-16 2940
16e72e9b3 Denys Vlasenko 2017-02-22 2941 /* Until we need other flags, refuse anything except VM_EXEC. */
16e72e9b3 Denys Vlasenko 2017-02-22 2942 if ((flags & (~VM_EXEC)) != 0)
16e72e9b3 Denys Vlasenko 2017-02-22 2943 return -EINVAL;
16e72e9b3 Denys Vlasenko 2017-02-22 2944 flags |= VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
3a4597568 Kirill Korotaev 2006-09-07 2945
2c6a10161 Al Viro 2009-12-03 2946 error = get_unmapped_area(NULL, addr, len, 0, MAP_FIXED);
de1741a13 Alexander Kuleshov 2015-11-05 2947 if (offset_in_page(error))
3a4597568 Kirill Korotaev 2006-09-07 2948 return error;
3a4597568 Kirill Korotaev 2006-09-07 2949
363ee17f0 Davidlohr Bueso 2014-01-21 2950 error = mlock_future_check(mm, mm->def_flags, len);
363ee17f0 Davidlohr Bueso 2014-01-21 2951 if (error)
363ee17f0 Davidlohr Bueso 2014-01-21 2952 return error;
^1da177e4 Linus Torvalds 2005-04-16 2953
^1da177e4 Linus Torvalds 2005-04-16 2954 /*
^1da177e4 Linus Torvalds 2005-04-16 2955 * mm->mmap_sem is required to protect against another thread
^1da177e4 Linus Torvalds 2005-04-16 2956 * changing the mappings in case we sleep.
^1da177e4 Linus Torvalds 2005-04-16 2957 */
^1da177e4 Linus Torvalds 2005-04-16 2958 verify_mm_writelocked(mm);
^1da177e4 Linus Torvalds 2005-04-16 2959
^1da177e4 Linus Torvalds 2005-04-16 2960 /*
^1da177e4 Linus Torvalds 2005-04-16 2961 * Clear old maps. this also does some error checking for us
^1da177e4 Linus Torvalds 2005-04-16 2962 */
9fcd14571 Rasmus Villemoes 2015-04-15 2963 while (find_vma_links(mm, addr, addr + len, &prev, &rb_link,
9fcd14571 Rasmus Villemoes 2015-04-15 2964 &rb_parent)) {
897ab3e0c Mike Rapoport 2017-02-24 2965 if (do_munmap(mm, addr, len, uf))
^1da177e4 Linus Torvalds 2005-04-16 2966 return -ENOMEM;
^1da177e4 Linus Torvalds 2005-04-16 2967 }
^1da177e4 Linus Torvalds 2005-04-16 2968
^1da177e4 Linus Torvalds 2005-04-16 2969 /* Check against address space limits *after* clearing old maps... */
846383359 Konstantin Khlebnikov 2016-01-14 2970 if (!may_expand_vm(mm, flags, len >> PAGE_SHIFT))
^1da177e4 Linus Torvalds 2005-04-16 2971 return -ENOMEM;
^1da177e4 Linus Torvalds 2005-04-16 2972
^1da177e4 Linus Torvalds 2005-04-16 2973 if (mm->map_count > sysctl_max_map_count)
^1da177e4 Linus Torvalds 2005-04-16 2974 return -ENOMEM;
^1da177e4 Linus Torvalds 2005-04-16 2975
191c54244 Al Viro 2012-02-13 2976 if (security_vm_enough_memory_mm(mm, len >> PAGE_SHIFT))
^1da177e4 Linus Torvalds 2005-04-16 2977 return -ENOMEM;
^1da177e4 Linus Torvalds 2005-04-16 2978
^1da177e4 Linus Torvalds 2005-04-16 2979 /* Can we just expand an old private anonymous mapping? */
ba470de43 Rik van Riel 2008-10-18 2980 vma = vma_merge(mm, prev, addr, addr + len, flags,
19a809afe Andrea Arcangeli 2015-09-04 2981 NULL, NULL, pgoff, NULL, NULL_VM_UFFD_CTX);
ba470de43 Rik van Riel 2008-10-18 2982 if (vma)
^1da177e4 Linus Torvalds 2005-04-16 2983 goto out;
^1da177e4 Linus Torvalds 2005-04-16 2984
^1da177e4 Linus Torvalds 2005-04-16 2985 /*
^1da177e4 Linus Torvalds 2005-04-16 2986 * create a vma struct for an anonymous mapping
^1da177e4 Linus Torvalds 2005-04-16 2987 */
c5e3b83e9 Pekka Enberg 2006-03-25 2988 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
^1da177e4 Linus Torvalds 2005-04-16 2989 if (!vma) {
^1da177e4 Linus Torvalds 2005-04-16 2990 vm_unacct_memory(len >> PAGE_SHIFT);
^1da177e4 Linus Torvalds 2005-04-16 2991 return -ENOMEM;
^1da177e4 Linus Torvalds 2005-04-16 2992 }
^1da177e4 Linus Torvalds 2005-04-16 2993
5beb49305 Rik van Riel 2010-03-05 2994 INIT_LIST_HEAD(&vma->anon_vma_chain);
^1da177e4 Linus Torvalds 2005-04-16 2995 vma->vm_mm = mm;
^1da177e4 Linus Torvalds 2005-04-16 2996 vma->vm_start = addr;
^1da177e4 Linus Torvalds 2005-04-16 2997 vma->vm_end = addr + len;
^1da177e4 Linus Torvalds 2005-04-16 2998 vma->vm_pgoff = pgoff;
^1da177e4 Linus Torvalds 2005-04-16 2999 vma->vm_flags = flags;
3ed75eb8f Coly Li 2007-10-18 3000 vma->vm_page_prot = vm_get_page_prot(flags);
^1da177e4 Linus Torvalds 2005-04-16 3001 vma_link(mm, vma, prev, rb_link, rb_parent);
^1da177e4 Linus Torvalds 2005-04-16 3002 out:
3af9e8592 Eric B Munson 2010-05-18 3003 perf_event_mmap(vma);
^1da177e4 Linus Torvalds 2005-04-16 3004 mm->total_vm += len >> PAGE_SHIFT;
846383359 Konstantin Khlebnikov 2016-01-14 3005 mm->data_vm += len >> PAGE_SHIFT;
128557ffe Michel Lespinasse 2013-02-22 3006 if (flags & VM_LOCKED)
ba470de43 Rik van Riel 2008-10-18 3007 mm->locked_vm += (len >> PAGE_SHIFT);
d9104d1ca Cyrill Gorcunov 2013-09-11 3008 vma->vm_flags |= VM_SOFTDIRTY;
5d22fc25d Linus Torvalds 2016-05-27 3009 return 0;
^1da177e4 Linus Torvalds 2005-04-16 3010 }
^1da177e4 Linus Torvalds 2005-04-16 3011
:::::: The code at line 2936 was first introduced by commit
:::::: 16e72e9b30986ee15f17fbb68189ca842c32af58 powerpc: do not make the entire heap executable
:::::: TO: Denys Vlasenko <dvlasenk@redhat.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29269 bytes --]
next prev parent reply other threads:[~2018-07-06 7:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-04 4:19 kernel BUG at mm/gup.c:LINE! syzbot
2018-07-04 10:01 ` Tetsuo Handa
2018-07-04 11:17 ` Michal Hocko
2018-07-04 11:48 ` Zi Yan
2018-07-04 12:11 ` Michal Hocko
2018-07-04 15:15 ` Oscar Salvador
2018-07-05 0:35 ` Tetsuo Handa
2018-07-05 7:18 ` Oscar Salvador
2018-07-05 11:40 ` Oscar Salvador
2018-07-05 6:44 ` Michal Hocko
2018-07-05 7:18 ` Oscar Salvador
2018-07-05 12:30 ` Oscar Salvador
2018-07-05 13:40 ` Tetsuo Handa
2018-07-06 5:35 ` Michal Hocko
2018-07-06 7:40 ` Oscar Salvador
2018-07-06 7:50 ` kbuild test robot [this message]
2018-07-06 8:23 ` [PATCH] mm: do not bug_on on incorrect lenght in __mm_populate Oscar Salvador
2018-07-06 9:02 ` Michal Hocko
2018-07-04 12:12 ` kernel BUG at mm/gup.c:LINE! Oscar Salvador
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201807061427.cYcp5ef9%fengguang.wu@intel.com \
--to=lkp@intel.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=dan.j.williams@intel.com \
--cc=kbuild-all@01.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mst@redhat.com \
--cc=osalvador@techadventures.net \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=syzbot+5dcb560fe12aa5091c06@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=viro@zeniv.linux.org.uk \
--cc=ying.huang@intel.com \
--cc=zi.yan@cs.rutgers.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).