[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cae90aa0-9fa6-4066-bbc0-ba391f908fb2@arm.com>
Date: Wed, 13 Aug 2025 15:48:32 +0100
From: Ada Couprie Diaz <ada.coupriediaz@....com>
To: Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>
Cc: nathan@...nel.org, arnd@...db.de, broonie@...nel.org,
Liam.Howlett@...cle.com, urezki@...il.com, will@...nel.org,
kaleshsingh@...gle.com, rppt@...nel.org, leitao@...ian.org, coxu@...hat.com,
surenb@...gle.com, akpm@...ux-foundation.org, luto@...nel.org,
jpoimboe@...nel.org, changyuanl@...gle.com, hpa@...or.com,
dvyukov@...gle.com, kas@...nel.org, corbet@....net,
vincenzo.frascino@....com, smostafa@...gle.com,
nick.desaulniers+lkml@...il.com, morbo@...gle.com, andreyknvl@...il.com,
alexander.shishkin@...ux.intel.com, thiago.bauermann@...aro.org,
catalin.marinas@....com, ryabinin.a.a@...il.com, jan.kiszka@...mens.com,
jbohac@...e.cz, dan.j.williams@...el.com, joel.granados@...nel.org,
baohua@...nel.org, kevin.brodsky@....com, nicolas.schier@...ux.dev,
pcc@...gle.com, andriy.shevchenko@...ux.intel.com, wei.liu@...nel.org,
bp@...en8.de, xin@...or.com, pankaj.gupta@....com, vbabka@...e.cz,
glider@...gle.com, jgross@...e.com, kees@...nel.org, jhubbard@...dia.com,
joey.gouly@....com, ardb@...nel.org, thuth@...hat.com,
pasha.tatashin@...een.com, kristina.martsenko@....com,
bigeasy@...utronix.de, lorenzo.stoakes@...cle.com, jason.andryuk@....com,
david@...hat.com, graf@...zon.com, wangkefeng.wang@...wei.com,
ziy@...dia.com, mark.rutland@....com, dave.hansen@...ux.intel.com,
samuel.holland@...ive.com, kbingham@...nel.org, trintaeoitogc@...il.com,
scott@...amperecomputing.com, justinstitt@...gle.com,
kuan-ying.lee@...onical.com, maz@...nel.org, tglx@...utronix.de,
samitolvanen@...gle.com, mhocko@...e.com, nunodasneves@...ux.microsoft.com,
brgerst@...il.com, willy@...radead.org, ubizjak@...il.com,
peterz@...radead.org, mingo@...hat.com, sohil.mehta@...el.com,
linux-mm@...ck.org, linux-kbuild@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, x86@...nel.org, llvm@...ts.linux.dev,
kasan-dev@...glegroups.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, Ada Couprie Diaz <ada.coupriediaz@....com>
Subject: Re: [PATCH v4 02/18] kasan: sw_tags: Support tag widths less than 8
bits
Hi,
On 12/08/2025 14:23, Maciej Wieczor-Retman wrote:
> From: Samuel Holland <samuel.holland@...ive.com>
>
> Allow architectures to override KASAN_TAG_KERNEL in asm/kasan.h. This
> is needed on RISC-V, which supports 57-bit virtual addresses and 7-bit
> pointer tags. For consistency, move the arm64 MTE definition of
> KASAN_TAG_MIN to asm/kasan.h, since it is also architecture-dependent;
> RISC-V's equivalent extension is expected to support 7-bit hardware
> memory tags.
>
> Reviewed-by: Andrey Konovalov <andreyknvl@...il.com>
> Signed-off-by: Samuel Holland <samuel.holland@...ive.com>
> Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>
> ---
> arch/arm64/include/asm/kasan.h | 6 ++++--
> arch/arm64/include/asm/uaccess.h | 1 +
> include/linux/kasan-tags.h | 13 ++++++++-----
> 3 files changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm64/include/asm/kasan.h b/arch/arm64/include/asm/kasan.h
> index e1b57c13f8a4..4ab419df8b93 100644
> --- a/arch/arm64/include/asm/kasan.h
> +++ b/arch/arm64/include/asm/kasan.h
> @@ -6,8 +6,10 @@
>
> #include <linux/linkage.h>
> #include <asm/memory.h>
> -#include <asm/mte-kasan.h>
> -#include <asm/pgtable-types.h>
> +
> +#ifdef CONFIG_KASAN_HW_TAGS
> +#define KASAN_TAG_MIN 0xF0 /* minimum value for random tags */
> +#endif
Building CONFIG_KASAN_HW_TAGS with -Werror on arm64 fails here
due to a warning about KASAN_TAG_MIN being redefined.
On my side the error got triggered when compiling
arch/arm64/kernel/asm-offsets.c due to the ordering of some includes :
from <asm/processor.h>, <linux/kasan-tags.h> ends up being included
(by <asm/cpufeatures.h> including <asm/sysreg.h>) before <asm/kasan.h>.
(Build trace at the end for reference)
Adding `#undef KASAN_TAG_MIN` before redefining the arch version
allows building CONFIG_KASAN_HW_TAGS on arm64 without
further issues, but I don't know if this is most appropriate fix.Thanks,
Ada ---
CC arch/arm64/kernel/asm-offsets.s
In file included from ./arch/arm64/include/asm/processor.h:42,
from ./include/asm-generic/qrwlock.h:18,
from ./arch/arm64/include/generated/asm/qrwlock.h:1,
from ./arch/arm64/include/asm/spinlock.h:9,
from ./include/linux/spinlock.h:95,
from ./include/linux/mmzone.h:8,
from ./include/linux/gfp.h:7,
from ./include/linux/slab.h:16,
from ./include/linux/resource_ext.h:11,
from ./include/linux/acpi.h:13,
from ./include/acpi/apei.h:9,
from ./include/acpi/ghes.h:5,
from ./include/linux/arm_sdei.h:8,
from ./arch/arm64/kernel/asm-offsets.c:10:
./arch/arm64/include/asm/kasan.h:11: error: "KASAN_TAG_MIN" redefined [-Werror]
11 | #define KASAN_TAG_MIN 0xF0 /* minimum value for random tags */
|
In file included from ./arch/arm64/include/asm/sysreg.h:14,
from ./arch/arm64/include/asm/cputype.h:250,
from ./arch/arm64/include/asm/cache.h:43,
from ./include/vdso/cache.h:5,
from ./include/linux/cache.h:6,
from ./include/linux/slab.h:15:
./include/linux/kasan-tags.h:23: note: this is the location of the previous definition
23 | #define KASAN_TAG_MIN 0x00 /* minimum value for random tags */
|
Powered by blists - more mailing lists