Re: KASLR vs. KASAN on x86

From: Andrey Ryabinin
Date: Mon Mar 13 2023 - 09:40:41 EST


On Mon, Mar 13, 2023 at 10:41 AM Michal Koutný <mkoutny@xxxxxxxx> wrote:
>
> On Wed, Mar 08, 2023 at 06:24:05PM +0100, Andrey Ryabinin <ryabinin.a.a@xxxxxxxxx> wrote:
> > So the vmemmap_base and probably some part of vmalloc could easily end
> > up in KASAN shadow.
>
> Would it help to (conditionally) reduce vaddr_end to the beginning of
> KASAN shadow memory?
> (I'm not that familiar with KASAN, so IOW, would KASAN handle
> randomized: linear mapping (__PAGE_OFFSET), vmalloc (VMALLOC_START) and
> vmemmap (VMEMMAP_START) in that smaller range.)
>

Yes, with the vaddr_end = KASAN_SHADOW_START it should work,
kaslr_memory_enabled() can be removed in favor of just the kaslr_enabled()

> Thanks,
> Michal