On Wed, Oct 16, 2019 at 05:29:33AM +0100, 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> Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx> Tested-by: Catalin Marinas <catalin.marinas@xxxxxxx>