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.

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 <>
8 files changed