[PATCH] arm64: mte: Document that user PSTATE.TCO is ignored by kernel uaccess
Vincenzo Frascino
vincenzo.frascino at arm.com
Mon Oct 26 08:26:16 EDT 2020
On 10/26/20 12:16 PM, Catalin Marinas wrote:
> On exception entry, the kernel explicitly resets the PSTATE.TCO (tag
> check override) so that any kernel memory accesses will be checked (the
> bit is restored on exception return). This has the side-effect that the
> uaccess routines will not honour the PSTATE.TCO that may have been set
> by the user prior to a syscall.
>
> There is no issue in practice since PSTATE.TCO is expected to be used
> only for brief periods in specific routines (e.g. garbage collection).
> To control the tag checking mode of the uaccess routines, the user will
> have to invoke a corresponding prctl() call.
>
> Document the kernel behaviour w.r.t. PSTATE.TCO accordingly.
>
> Signed-off-by: Catalin Marinas <catalin.marinas at arm.com>
> Fixes: df9d7a22dd21 ("arm64: mte: Add Memory Tagging Extension documentation")
> Cc: Will Deacon <will at kernel.org>
> Cc: Szabolcs Nagy <szabolcs.nagy at arm.com>
It is a good thing that we are documenting this explicitly since it might be
confusing to the user why the kernel behaves in a certain way.
Reviewed-by: Vincenzo Frascino <vincenzo.frascino at arm.com>
> ---
> Documentation/arm64/memory-tagging-extension.rst | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/arm64/memory-tagging-extension.rst b/Documentation/arm64/memory-tagging-extension.rst
> index 034d37c605e8..648f8e8d480b 100644
> --- a/Documentation/arm64/memory-tagging-extension.rst
> +++ b/Documentation/arm64/memory-tagging-extension.rst
> @@ -102,7 +102,9 @@ applications.
> system call) are not checked if the user thread tag checking mode is
> ``PR_MTE_TCF_NONE`` or ``PR_MTE_TCF_ASYNC``. If the tag checking mode is
> ``PR_MTE_TCF_SYNC``, the kernel makes a best effort to check its user
> -address accesses, however it cannot always guarantee it.
> +address accesses, however it cannot always guarantee it. The user
> +``PSTATE.TCO`` bit is ignored by the kernel accesses to user addresses,
> +its value assumed 0.
>
> Excluding Tags in the ``IRG``, ``ADDG`` and ``SUBG`` instructions
> -----------------------------------------------------------------
>
--
Regards,
Vincenzo
More information about the linux-arm-kernel
mailing list