On 10/16/19 5:29 AM, Will Deacon wrote: > From 517d979e84191ae9997c9513a88a5b798af6912f Mon Sep 17 00:00:00 2001 > From: Will Deacon <will@xxxxxxxxxx> > Date: Tue, 15 Oct 2019 21:04:18 -0700 > Subject: [PATCH] arm64: tags: Preserve tags for addresses translated via TTBR1 > > Sign-extending TTBR1 addresses when converting to an untagged address > breaks the documented POSIX semantics for mlock() in some obscure error > cases where we end up returning -EINVAL instead of -ENOMEM as a direct > result of rewriting the upper address bits. > > Rework the untagged_addr() macro to preserve the upper address bits for > TTBR1 addresses and only clear the tag bits for user addresses. This > matches the behaviour of the 'clear_address_tag' assembly macro, so > rename that and align the implementations at the same time so that they > use the same instruction sequences for the tag manipulation. > > Cc: Catalin Marinas <catalin.marinas@xxxxxxx> > Link: https://lore.kernel.org/stable/20191014162651.GF19200@xxxxxxxxxxxxxxxxxxxx/ > Reported-by: Jan Stancek <jstancek@xxxxxxxxxx> > Signed-off-by: Will Deacon <will@xxxxxxxxxx> > --- > arch/arm64/include/asm/asm-uaccess.h | 7 +++---- > arch/arm64/include/asm/memory.h | 10 ++++++++-- > arch/arm64/kernel/entry.S | 4 ++-- > 3 files changed, 13 insertions(+), 8 deletions(-) > Reviewed-by: Vincenzo Frascino <vincenzo.frascino@xxxxxxx> Tested-by: Vincenzo Frascino <vincenzo.frascino@xxxxxxx> -- Regards, Vincenzo