Skip to content
Commit 5126575e authored by Vincenzo Frascino's avatar Vincenzo Frascino
Browse files

arm64: mte: Introduce arch specific read_word_at_a_time()



When we invoke strscpy() with a maximum size of N bytes, it assumes
that:
- It can always read N bytes from the source.
- It always write N bytes (zero-padded) to the destination.

On aarch64 with Memory Tagging Extension enabled if we pass an N that is
bigger then the source buffer, it triggers an MTE fault.

strscpy() implementation is based on read_word_at_a_time().

Introduce an arch specific version of read_word_at_a_time() that enables
TCO before the address dereference and disables it after.

This prevents triggering of an MTE fault when N is bigger then the
source buffer.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Vincenzo Frascino's avatarVincenzo Frascino <vincenzo.frascino@arm.com>
parent a18588d3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment