Re: [PATCH v2 14/14] x86: Make software tag-based kasan available
From: Andrey Konovalov
Date: Sat Feb 22 2025 - 10:06:55 EST
On Fri, Feb 21, 2025 at 3:45 PM Maciej Wieczor-Retman
<maciej.wieczor-retman@xxxxxxxxx> wrote:
>
> >What's the purpose of this config option? I think we can just change
> >the value of the KASAN_SHADOW_SCALE_SHIFT define when KASAN_SW_TAGS is
> >enabled.
>
> Well, I was aiming at later adding the "default 5 if KASAN_SW_TAGS_DENSE", and
> this way it would look much cleaner than the:
>
> if KASAN_SW_TAGS
> if KASAN_SW_TAGS_DENSE
> KASAN_SHADOW_SCALE_SHIFT = 5
> else
> KASAN_SHADOW_SCALE_SHIFT = 4
> else
> KASAN_SHADOW_SCALE_SHIFT = 3
I think this is fine. It's still better than adding a non-configurable
config option.
> But now that I think of it, it should be possible to overwrite the
> KASAN_SHADOW_SCALE_SHIFT from non-arch code if dense mode is enabled.
This should also work. Especially since the dense mode will probably
work for arm64 as well.
But let's keep this series self-contained.
> That's a topic for the next series but I'd imagine all architectures would
> normally use the 16 memory bytes / shadow byte and if they'd care for the dense
> mode they'd go for 32 memory bytes / shadow byte. Or do you think that's a
> faulty assumption?
Probably, but for sure I don't know, not that many architectures that
care about memory tagging yet :)