Re: [PATCH v5 04/19] x86: Add arch specific kasan functions
From: Andrey Ryabinin
Date: Thu Sep 18 2025 - 11:52:49 EST
On 8/25/25 10:24 PM, Maciej Wieczor-Retman wrote:
> +static inline void *__tag_set(const void *__addr, u8 tag)
> +{
> + u64 addr = (u64)__addr;
> +
> + addr &= ~__tag_shifted(KASAN_TAG_MASK);
> + addr |= __tag_shifted(tag);
> +
> + return (void *)addr;
> +}
> +
This requires some ifdef magic to avoid getting this into vdso32 image build process,
otherwise we'll get this warning:
CC arch/x86/entry/vdso/vdso32/vclock_gettime.o
In file included from ../arch/x86/include/asm/page.h:10,
from ../arch/x86/include/asm/processor.h:20,
from ../arch/x86/include/asm/timex.h:5,
from ../include/linux/timex.h:67,
from ../include/linux/time32.h:13,
from ../include/linux/time.h:60,
from ../arch/x86/entry/vdso/vdso32/../vclock_gettime.c:11,
from ../arch/x86/entry/vdso/vdso32/vclock_gettime.c:4:
../arch/x86/include/asm/kasan.h: In function ‘__tag_set’:
../arch/x86/include/asm/kasan.h:81:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
81 | u64 addr = (u64)__addr;
| ^
../arch/x86/include/asm/kasan.h:86:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
86 | return (void *)addr;
| ^