]> Git Repo - linux.git/commitdiff
mm: untag user pointers in mmap/munmap/mremap/brk
authorCatalin Marinas <[email protected]>
Wed, 25 Sep 2019 23:49:04 +0000 (16:49 -0700)
committerLinus Torvalds <[email protected]>
Thu, 26 Sep 2019 00:51:41 +0000 (17:51 -0700)
There isn't a good reason to differentiate between the user address space
layout modification syscalls and the other memory permission/attributes
ones (e.g.  mprotect, madvise) w.r.t.  the tagged address ABI.  Untag the
user addresses on entry to these functions.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Catalin Marinas <[email protected]>
Acked-by: Will Deacon <[email protected]>
Acked-by: Andrey Konovalov <[email protected]>
Cc: Vincenzo Frascino <[email protected]>
Cc: Szabolcs Nagy <[email protected]>
Cc: Kevin Brodsky <[email protected]>
Cc: Dave P Martin <[email protected]>
Cc: Dave Hansen <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/mmap.c
mm/mremap.c

index 14b7da317ec044500fe9e8c33c0758ecc6b9c575..a7d8c84d19b7127aef8680ac0dd7cbca0e03041f 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -201,6 +201,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
        bool downgraded = false;
        LIST_HEAD(uf);
 
+       brk = untagged_addr(brk);
+
        if (down_write_killable(&mm->mmap_sem))
                return -EINTR;
 
@@ -1587,6 +1589,8 @@ unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len,
        struct file *file = NULL;
        unsigned long retval;
 
+       addr = untagged_addr(addr);
+
        if (!(flags & MAP_ANONYMOUS)) {
                audit_mmap_fd(fd, flags);
                file = fget(fd);
@@ -2885,6 +2889,7 @@ EXPORT_SYMBOL(vm_munmap);
 
 SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
 {
+       addr = untagged_addr(addr);
        profile_munmap(addr);
        return __vm_munmap(addr, len, true);
 }
index 64c9a3b8be0aa2c8f5b1472b8cbb21f20b1c754f..1fc8a29fbe3f44a7ecbee35eb67cbebc815f78ad 100644 (file)
@@ -606,12 +606,8 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
        LIST_HEAD(uf_unmap_early);
        LIST_HEAD(uf_unmap);
 
-       /*
-        * Architectures may interpret the tag passed to mmap as a background
-        * colour for the corresponding vma. For mremap we don't allow tagged
-        * new_addr to preserve similar behaviour to mmap.
-        */
        addr = untagged_addr(addr);
+       new_addr = untagged_addr(new_addr);
 
        if (flags & ~(MREMAP_FIXED | MREMAP_MAYMOVE))
                return ret;
This page took 0.063529 seconds and 4 git commands to generate.