All of lore.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH RFC] mm: add MAP_EXCLUSIVE to create exclusive user mappings
Date: Wed, 30 Oct 2019 02:03:42 +0800	[thread overview]
Message-ID: <201910300153.SHdord0Q%lkp@intel.com> (raw)
In-Reply-To: <1572171452-7958-2-git-send-email-rppt@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 7972 bytes --]

Hi Mike,

[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on mmotm/master]

url:    https://github.com/0day-ci/linux/commits/Mike-Rapoport/mm-add-MAP_EXCLUSIVE-to-create-exclusive-user-mappings/20191029-232454
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: parisc-c3000_defconfig (attached as .config)
compiler: hppa-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
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=parisc 

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

All errors (new ones prefixed by >>):

   mm/mmap.c: In function 'do_mmap':
>> mm/mmap.c:1577:14: error: 'MAP_EXCLUSIVE' undeclared (first use in this function); did you mean 'RMAP_EXCLUSIVE'?
     if (flags & MAP_EXCLUSIVE)
                 ^~~~~~~~~~~~~
                 RMAP_EXCLUSIVE
   mm/mmap.c:1577:14: note: each undeclared identifier is reported only once for each function it appears in
   mm/mmap.c: In function 'ksys_mmap_pgoff':
   mm/mmap.c:1597:14: error: 'MAP_EXCLUSIVE' undeclared (first use in this function); did you mean 'RMAP_EXCLUSIVE'?
     if (flags & MAP_EXCLUSIVE) {
                 ^~~~~~~~~~~~~
                 RMAP_EXCLUSIVE

vim +1577 mm/mmap.c

  1393	
  1394	/*
  1395	 * The caller must hold down_write(&current->mm->mmap_sem).
  1396	 */
  1397	unsigned long do_mmap(struct file *file, unsigned long addr,
  1398				unsigned long len, unsigned long prot,
  1399				unsigned long flags, vm_flags_t vm_flags,
  1400				unsigned long pgoff, unsigned long *populate,
  1401				struct list_head *uf)
  1402	{
  1403		struct mm_struct *mm = current->mm;
  1404		int pkey = 0;
  1405	
  1406		*populate = 0;
  1407	
  1408		if (!len)
  1409			return -EINVAL;
  1410	
  1411		/*
  1412		 * Does the application expect PROT_READ to imply PROT_EXEC?
  1413		 *
  1414		 * (the exception is when the underlying filesystem is noexec
  1415		 *  mounted, in which case we dont add PROT_EXEC.)
  1416		 */
  1417		if ((prot & PROT_READ) && (current->personality & READ_IMPLIES_EXEC))
  1418			if (!(file && path_noexec(&file->f_path)))
  1419				prot |= PROT_EXEC;
  1420	
  1421		/* force arch specific MAP_FIXED handling in get_unmapped_area */
  1422		if (flags & MAP_FIXED_NOREPLACE)
  1423			flags |= MAP_FIXED;
  1424	
  1425		if (!(flags & MAP_FIXED))
  1426			addr = round_hint_to_min(addr);
  1427	
  1428		/* Careful about overflows.. */
  1429		len = PAGE_ALIGN(len);
  1430		if (!len)
  1431			return -ENOMEM;
  1432	
  1433		/* offset overflow? */
  1434		if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
  1435			return -EOVERFLOW;
  1436	
  1437		/* Too many mappings? */
  1438		if (mm->map_count > sysctl_max_map_count)
  1439			return -ENOMEM;
  1440	
  1441		/* Obtain the address to map to. we verify (or select) it and ensure
  1442		 * that it represents a valid section of the address space.
  1443		 */
  1444		addr = get_unmapped_area(file, addr, len, pgoff, flags);
  1445		if (offset_in_page(addr))
  1446			return addr;
  1447	
  1448		if (flags & MAP_FIXED_NOREPLACE) {
  1449			struct vm_area_struct *vma = find_vma(mm, addr);
  1450	
  1451			if (vma && vma->vm_start < addr + len)
  1452				return -EEXIST;
  1453		}
  1454	
  1455		if (prot == PROT_EXEC) {
  1456			pkey = execute_only_pkey(mm);
  1457			if (pkey < 0)
  1458				pkey = 0;
  1459		}
  1460	
  1461		/* Do simple checking here so the lower-level routines won't have
  1462		 * to. we assume access permissions have been handled by the open
  1463		 * of the memory object, so we don't do any here.
  1464		 */
  1465		vm_flags |= calc_vm_prot_bits(prot, pkey) | calc_vm_flag_bits(flags) |
  1466				mm->def_flags | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
  1467	
  1468		if (flags & MAP_LOCKED)
  1469			if (!can_do_mlock())
  1470				return -EPERM;
  1471	
  1472		if (mlock_future_check(mm, vm_flags, len))
  1473			return -EAGAIN;
  1474	
  1475		if (file) {
  1476			struct inode *inode = file_inode(file);
  1477			unsigned long flags_mask;
  1478	
  1479			if (!file_mmap_ok(file, inode, pgoff, len))
  1480				return -EOVERFLOW;
  1481	
  1482			flags_mask = LEGACY_MAP_MASK | file->f_op->mmap_supported_flags;
  1483	
  1484			switch (flags & MAP_TYPE) {
  1485			case MAP_SHARED:
  1486				/*
  1487				 * Force use of MAP_SHARED_VALIDATE with non-legacy
  1488				 * flags. E.g. MAP_SYNC is dangerous to use with
  1489				 * MAP_SHARED as you don't know which consistency model
  1490				 * you will get. We silently ignore unsupported flags
  1491				 * with MAP_SHARED to preserve backward compatibility.
  1492				 */
  1493				flags &= LEGACY_MAP_MASK;
  1494				/* fall through */
  1495			case MAP_SHARED_VALIDATE:
  1496				if (flags & ~flags_mask)
  1497					return -EOPNOTSUPP;
  1498				if (prot & PROT_WRITE) {
  1499					if (!(file->f_mode & FMODE_WRITE))
  1500						return -EACCES;
  1501					if (IS_SWAPFILE(file->f_mapping->host))
  1502						return -ETXTBSY;
  1503				}
  1504	
  1505				/*
  1506				 * Make sure we don't allow writing to an append-only
  1507				 * file..
  1508				 */
  1509				if (IS_APPEND(inode) && (file->f_mode & FMODE_WRITE))
  1510					return -EACCES;
  1511	
  1512				/*
  1513				 * Make sure there are no mandatory locks on the file.
  1514				 */
  1515				if (locks_verify_locked(file))
  1516					return -EAGAIN;
  1517	
  1518				vm_flags |= VM_SHARED | VM_MAYSHARE;
  1519				if (!(file->f_mode & FMODE_WRITE))
  1520					vm_flags &= ~(VM_MAYWRITE | VM_SHARED);
  1521	
  1522				/* fall through */
  1523			case MAP_PRIVATE:
  1524				if (!(file->f_mode & FMODE_READ))
  1525					return -EACCES;
  1526				if (path_noexec(&file->f_path)) {
  1527					if (vm_flags & VM_EXEC)
  1528						return -EPERM;
  1529					vm_flags &= ~VM_MAYEXEC;
  1530				}
  1531	
  1532				if (!file->f_op->mmap)
  1533					return -ENODEV;
  1534				if (vm_flags & (VM_GROWSDOWN|VM_GROWSUP))
  1535					return -EINVAL;
  1536				break;
  1537	
  1538			default:
  1539				return -EINVAL;
  1540			}
  1541		} else {
  1542			switch (flags & MAP_TYPE) {
  1543			case MAP_SHARED:
  1544				if (vm_flags & (VM_GROWSDOWN|VM_GROWSUP))
  1545					return -EINVAL;
  1546				/*
  1547				 * Ignore pgoff.
  1548				 */
  1549				pgoff = 0;
  1550				vm_flags |= VM_SHARED | VM_MAYSHARE;
  1551				break;
  1552			case MAP_PRIVATE:
  1553				/*
  1554				 * Set pgoff according to addr for anon_vma.
  1555				 */
  1556				pgoff = addr >> PAGE_SHIFT;
  1557				break;
  1558			default:
  1559				return -EINVAL;
  1560			}
  1561		}
  1562	
  1563		/*
  1564		 * Set 'VM_NORESERVE' if we should not account for the
  1565		 * memory use of this mapping.
  1566		 */
  1567		if (flags & MAP_NORESERVE) {
  1568			/* We honor MAP_NORESERVE if allowed to overcommit */
  1569			if (sysctl_overcommit_memory != OVERCOMMIT_NEVER)
  1570				vm_flags |= VM_NORESERVE;
  1571	
  1572			/* hugetlb applies strict overcommit unless MAP_NORESERVE */
  1573			if (file && is_file_hugepages(file))
  1574				vm_flags |= VM_NORESERVE;
  1575		}
  1576	
> 1577		if (flags & MAP_EXCLUSIVE)
  1578			vm_flags |= VM_EXCLUSIVE;
  1579	
  1580		addr = mmap_region(file, addr, len, vm_flags, pgoff, uf);
  1581		if (!IS_ERR_VALUE(addr) &&
  1582		    ((vm_flags & VM_LOCKED) ||
  1583		     (flags & (MAP_POPULATE | MAP_NONBLOCK)) == MAP_POPULATE))
  1584			*populate = len;
  1585		return addr;
  1586	}
  1587	

---
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: 15724 bytes --]

  parent reply	other threads:[~2019-10-29 18:03 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-27 10:17 [PATCH RFC] mm: add MAP_EXCLUSIVE to create exclusive user mappings Mike Rapoport
2019-10-27 10:17 ` Mike Rapoport
2019-10-28 12:31   ` Kirill A. Shutemov
2019-10-28 13:00     ` Mike Rapoport
2019-10-28 13:16       ` Kirill A. Shutemov
2019-10-28 13:55         ` Peter Zijlstra
2019-10-28 19:59           ` Edgecombe, Rick P
2019-10-28 21:00             ` Peter Zijlstra
2019-10-28 21:00               ` Peter Zijlstra
2019-10-29 17:27               ` Edgecombe, Rick P
2019-10-29 17:27                 ` Edgecombe, Rick P
2019-10-30 10:04                 ` Peter Zijlstra
2019-10-30 10:04                   ` Peter Zijlstra
2019-10-30 15:35                   ` Alexei Starovoitov
2019-10-30 15:35                     ` Alexei Starovoitov
2019-10-30 18:39                     ` Peter Zijlstra
2019-10-30 18:39                       ` Peter Zijlstra
2019-10-30 18:52                       ` Alexei Starovoitov
2019-10-30 18:52                         ` Alexei Starovoitov
2019-10-30 17:48                   ` Edgecombe, Rick P
2019-10-30 17:48                     ` Edgecombe, Rick P
2019-10-30 17:58                     ` Dave Hansen
2019-10-30 17:58                       ` Dave Hansen
2019-10-30 18:01                       ` Dave Hansen
2019-10-30 18:01                         ` Dave Hansen
2019-10-29  5:43         ` Dan Williams
2019-10-29  6:43           ` Kirill A. Shutemov
2019-10-29  8:56             ` Peter Zijlstra
2019-10-29 11:00               ` Kirill A. Shutemov
2019-10-29 12:39                 ` AMD TLB errata, (Was: [PATCH RFC] mm: add MAP_EXCLUSIVE to create exclusive user mappings) Peter Zijlstra
2019-11-15 14:12                   ` Tom Lendacky
2019-11-15 14:31                     ` Peter Zijlstra
2019-10-29 19:43             ` [PATCH RFC] mm: add MAP_EXCLUSIVE to create exclusive user mappings Dan Williams
2019-10-29 20:07               ` Dave Hansen
2019-10-29  7:08         ` Christopher Lameter
2019-10-29  8:55           ` Mike Rapoport
2019-10-29 10:12             ` Christopher Lameter
2019-10-30  7:11               ` Mike Rapoport
2019-10-30 12:09                 ` Christopher Lameter
2019-10-28 14:55   ` David Hildenbrand
2019-10-28 17:12   ` Dave Hansen
2019-10-28 17:32     ` Sean Christopherson
2019-10-28 18:08     ` Matthew Wilcox
2019-10-29  9:28       ` Mike Rapoport
2019-10-29  9:19     ` Mike Rapoport
2019-10-28 18:02   ` Andy Lutomirski
2019-10-29 11:02   ` David Hildenbrand
2019-10-30  8:15     ` Mike Rapoport
2019-10-30  8:19       ` David Hildenbrand
2019-10-31 19:16         ` Mike Rapoport
2019-10-31 21:52           ` Dan Williams
2019-10-29 18:03   ` kbuild test robot [this message]
2019-10-27 10:30 ` Florian Weimer
2019-10-27 11:00   ` Mike Rapoport
2019-10-27 11:00     ` Mike Rapoport
2019-10-28 20:23     ` Florian Weimer
2019-10-29  9:01       ` Mike Rapoport
2019-10-28 20:44 ` Andy Lutomirski
2019-10-29  9:32   ` Mike Rapoport
2019-10-29 17:00     ` Andy Lutomirski
2019-10-30  8:40       ` Mike Rapoport
2019-10-30 21:28         ` Andy Lutomirski
2019-10-31  7:21           ` Mike Rapoport
2019-12-05 15:34           ` Mike Rapoport
2019-12-05 15:34             ` Mike Rapoport
2019-12-08 14:10             ` [PATCH] mm: extend memfd with ability to create secret memory kbuild test robot
2019-12-08 14:10               ` kbuild test robot
2019-12-08 14:10               ` kbuild test robot
2019-10-29 11:25 ` [PATCH RFC] mm: add MAP_EXCLUSIVE to create exclusive user mappings Reshetova, Elena
2019-10-29 15:13   ` Tycho Andersen
2019-10-29 17:03   ` Andy Lutomirski
2019-10-29 17:03     ` Andy Lutomirski
2019-10-29 17:37     ` Alan Cox
2019-10-29 17:43     ` James Bottomley
2019-10-29 18:10       ` Andy Lutomirski
2019-10-29 18:10         ` Andy Lutomirski

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=201910300153.SHdord0Q%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.