Re: [PATCH] mm: do not grant +x by default in memfd_create()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dima,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.1-rc7 next-20190503]
[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/Dima-Krasner/mm-do-not-grant-x-by-default-in-memfd_create/20190505-060301
config: i386-randconfig-x070-201918 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

   mm/memfd.c: In function '__do_sys_memfd_create':
>> mm/memfd.c:300:10: error: too many arguments to function 'hugetlb_file_setup'
      file = hugetlb_file_setup(name, 0, VM_NORESERVE, &user,
             ^~~~~~~~~~~~~~~~~~
   In file included from mm/memfd.c:18:0:
   include/linux/hugetlb.h:326:1: note: declared here
    hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag,
    ^~~~~~~~~~~~~~~~~~
--
   ipc/shm.c: In function 'newseg':
>> ipc/shm.c:652:10: error: too many arguments to function 'hugetlb_file_setup'
      file = hugetlb_file_setup(name, hugesize, acctflag,
             ^~~~~~~~~~~~~~~~~~
   In file included from ipc/shm.c:30:0:
   include/linux/hugetlb.h:326:1: note: declared here
    hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag,
    ^~~~~~~~~~~~~~~~~~

vim +/hugetlb_file_setup +300 mm/memfd.c

5d752600 Mike Kravetz 2018-06-07  247  
5d752600 Mike Kravetz 2018-06-07  248  SYSCALL_DEFINE2(memfd_create,
5d752600 Mike Kravetz 2018-06-07  249  		const char __user *, uname,
5d752600 Mike Kravetz 2018-06-07  250  		unsigned int, flags)
5d752600 Mike Kravetz 2018-06-07  251  {
5d752600 Mike Kravetz 2018-06-07  252  	unsigned int *file_seals;
5d752600 Mike Kravetz 2018-06-07  253  	struct file *file;
5d752600 Mike Kravetz 2018-06-07  254  	int fd, error;
5d752600 Mike Kravetz 2018-06-07  255  	char *name;
5d752600 Mike Kravetz 2018-06-07  256  	long len;
5d752600 Mike Kravetz 2018-06-07  257  
5d752600 Mike Kravetz 2018-06-07  258  	if (!(flags & MFD_HUGETLB)) {
5d752600 Mike Kravetz 2018-06-07  259  		if (flags & ~(unsigned int)MFD_ALL_FLAGS)
5d752600 Mike Kravetz 2018-06-07  260  			return -EINVAL;
5d752600 Mike Kravetz 2018-06-07  261  	} else {
5d752600 Mike Kravetz 2018-06-07  262  		/* Allow huge page size encoding in flags. */
5d752600 Mike Kravetz 2018-06-07  263  		if (flags & ~(unsigned int)(MFD_ALL_FLAGS |
5d752600 Mike Kravetz 2018-06-07  264  				(MFD_HUGE_MASK << MFD_HUGE_SHIFT)))
5d752600 Mike Kravetz 2018-06-07  265  			return -EINVAL;
5d752600 Mike Kravetz 2018-06-07  266  	}
5d752600 Mike Kravetz 2018-06-07  267  
5d752600 Mike Kravetz 2018-06-07  268  	/* length includes terminating zero */
5d752600 Mike Kravetz 2018-06-07  269  	len = strnlen_user(uname, MFD_NAME_MAX_LEN + 1);
5d752600 Mike Kravetz 2018-06-07  270  	if (len <= 0)
5d752600 Mike Kravetz 2018-06-07  271  		return -EFAULT;
5d752600 Mike Kravetz 2018-06-07  272  	if (len > MFD_NAME_MAX_LEN + 1)
5d752600 Mike Kravetz 2018-06-07  273  		return -EINVAL;
5d752600 Mike Kravetz 2018-06-07  274  
5d752600 Mike Kravetz 2018-06-07  275  	name = kmalloc(len + MFD_NAME_PREFIX_LEN, GFP_KERNEL);
5d752600 Mike Kravetz 2018-06-07  276  	if (!name)
5d752600 Mike Kravetz 2018-06-07  277  		return -ENOMEM;
5d752600 Mike Kravetz 2018-06-07  278  
5d752600 Mike Kravetz 2018-06-07  279  	strcpy(name, MFD_NAME_PREFIX);
5d752600 Mike Kravetz 2018-06-07  280  	if (copy_from_user(&name[MFD_NAME_PREFIX_LEN], uname, len)) {
5d752600 Mike Kravetz 2018-06-07  281  		error = -EFAULT;
5d752600 Mike Kravetz 2018-06-07  282  		goto err_name;
5d752600 Mike Kravetz 2018-06-07  283  	}
5d752600 Mike Kravetz 2018-06-07  284  
5d752600 Mike Kravetz 2018-06-07  285  	/* terminating-zero may have changed after strnlen_user() returned */
5d752600 Mike Kravetz 2018-06-07  286  	if (name[len + MFD_NAME_PREFIX_LEN - 1]) {
5d752600 Mike Kravetz 2018-06-07  287  		error = -EFAULT;
5d752600 Mike Kravetz 2018-06-07  288  		goto err_name;
5d752600 Mike Kravetz 2018-06-07  289  	}
5d752600 Mike Kravetz 2018-06-07  290  
5d752600 Mike Kravetz 2018-06-07  291  	fd = get_unused_fd_flags((flags & MFD_CLOEXEC) ? O_CLOEXEC : 0);
5d752600 Mike Kravetz 2018-06-07  292  	if (fd < 0) {
5d752600 Mike Kravetz 2018-06-07  293  		error = fd;
5d752600 Mike Kravetz 2018-06-07  294  		goto err_name;
5d752600 Mike Kravetz 2018-06-07  295  	}
5d752600 Mike Kravetz 2018-06-07  296  
5d752600 Mike Kravetz 2018-06-07  297  	if (flags & MFD_HUGETLB) {
5d752600 Mike Kravetz 2018-06-07  298  		struct user_struct *user = NULL;
5d752600 Mike Kravetz 2018-06-07  299  
5d752600 Mike Kravetz 2018-06-07 @300  		file = hugetlb_file_setup(name, 0, VM_NORESERVE, &user,

:::::: The code at line 300 was first introduced by commit
:::::: 5d752600a8c373382264392f5b573b2fc9c0e8ea mm: restructure memfd code

:::::: TO: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux