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 <vincenzo.frascino@arm.com>
Loading
Please register or sign in to comment