Commit ce18d171 authored by Catalin Marinas's avatar Catalin Marinas Committed by Linus Torvalds
Browse files

mm: untag user pointers in mmap/munmap/mremap/brk

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.


Signed-off-by: Catalin Marinas's avatarCatalin Marinas <>
Acked-by: default avatarWill Deacon <>
Acked-by: default avatarAndrey Konovalov <>
Cc: Vincenzo Frascino <>
Cc: Szabolcs Nagy <>
Cc: Kevin Brodsky <>
Cc: Dave P Martin <>
Cc: Dave Hansen <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 6cf5354c
......@@ -201,6 +201,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
bool downgraded = false;
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);
return __vm_munmap(addr, len, true);
......@@ -606,12 +606,8 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
* 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);
return ret;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment