mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
UPSTREAM: mm: untag user pointers in mmap/munmap/mremap/brk
(Upstream commit ce18d171cb).
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/20190821164730.47450-2-catalin.marinas@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Will Deacon <will@kernel.org>
Acked-by: Andrey Konovalov <andreyknvl@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Szabolcs Nagy <szabolcs.nagy@arm.com>
Cc: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: Dave P Martin <Dave.Martin@arm.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Bug: 135692346
Change-Id: If6a7be6d5f39f411bd65c49100088d0ceae530ee
This commit is contained in:
committed by
Alistair Delva
parent
46850ae936
commit
13daec4d70
@@ -199,6 +199,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
|
||||
bool populate;
|
||||
LIST_HEAD(uf);
|
||||
|
||||
brk = untagged_addr(brk);
|
||||
|
||||
if (down_write_killable(&mm->mmap_sem))
|
||||
return -EINTR;
|
||||
|
||||
@@ -1557,6 +1559,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);
|
||||
@@ -2819,6 +2823,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);
|
||||
}
|
||||
|
||||
@@ -525,12 +525,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;
|
||||
|
||||
Reference in New Issue
Block a user