[PATCH] arm64: fix strlen() with CONFIG_KASAN_HW_TAGS

Catalin Marinas catalin.marinas at arm.com
Mon Jul 12 04:38:31 PDT 2021


On Mon, Jul 12, 2021 at 10:00:43AM +0100, Mark Rutland wrote:
> diff --git a/arch/arm64/lib/strlen.S b/arch/arm64/lib/strlen.S
> index 35fbdb7d6e1a..1648790e91b3 100644
> --- a/arch/arm64/lib/strlen.S
> +++ b/arch/arm64/lib/strlen.S
> @@ -8,6 +8,7 @@
>  
>  #include <linux/linkage.h>
>  #include <asm/assembler.h>
> +#include <asm/mte-def.h>
>  
>  /* Assumptions:
>   *
> @@ -42,7 +43,16 @@
>  #define REP8_7f 0x7f7f7f7f7f7f7f7f
>  #define REP8_80 0x8080808080808080
>  
> +/*
> + * When KASAN_HW_TAGS is in use, memory is checked at MTE_GRANULE_SIZE
> + * (16-byte) granularity, and we must ensure that no access straddles this
> + * alignment boundary.
> + */
> +#ifdef CONFIG_KASAN_HW_TAGS
> +#define MIN_PAGE_SIZE MTE_GRANULE_SIZE
> +#else
>  #define MIN_PAGE_SIZE 4096
> +#endif

Reviewed-by: Catalin Marinas <catalin.marinas at arm.com>



More information about the linux-arm-kernel mailing list