path: root/mm/msync.c
diff options
authorAndrey Konovalov <>2019-09-25 16:48:30 -0700
committerLinus Torvalds <>2019-09-25 17:51:41 -0700
commit057d3389108eda8a20c7f496f011846932680d88 (patch)
tree53fc307c262ac97bf27c7c529806bb31321de04c /mm/msync.c
parent903f433f8f7a33e292a319259483adece8cc6674 (diff)
mm: untag user pointers passed to memory syscalls
This patch is a part of a series that extends kernel ABI to allow to pass tagged user pointers (with the top byte set to something else other than 0x00) as syscall arguments. This patch allows tagged pointers to be passed to the following memory syscalls: get_mempolicy, madvise, mbind, mincore, mlock, mlock2, mprotect, mremap, msync, munlock, move_pages. The mmap and mremap syscalls do not currently accept tagged addresses. Architectures may interpret the tag as a background colour for the corresponding vma. Link: Signed-off-by: Andrey Konovalov <> Reviewed-by: Khalid Aziz <> Reviewed-by: Vincenzo Frascino <> Reviewed-by: Catalin Marinas <> Reviewed-by: Kees Cook <> Cc: Al Viro <> Cc: Dave Hansen <> Cc: Eric Auger <> Cc: Felix Kuehling <> Cc: Jens Wiklander <> Cc: Mauro Carvalho Chehab <> Cc: Mike Rapoport <> Cc: Will Deacon <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/msync.c')
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/msync.c b/mm/msync.c
index ef30a429623a..c3bd3e75f687 100644
--- a/mm/msync.c
+++ b/mm/msync.c
@@ -37,6 +37,8 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags)
int unmapped_error = 0;
int error = -EINVAL;
+ start = untagged_addr(start);
if (flags & ~(MS_ASYNC | MS_INVALIDATE | MS_SYNC))
goto out;
if (offset_in_page(start))