Re: [PATCH RFC v2 16/29] mm: asi: Map kernel text and static data as nonsensitive

From: Brendan Jackman
Date: Fri Jan 17 2025 - 06:23:58 EST


On Fri, 10 Jan 2025 at 19:41, Brendan Jackman <jackmanb@xxxxxxxxxx> wrote:
> + asi_clone_pgd(asi_global_nonsensitive_pgd, init_mm.pgd, VMEMMAP_START);
> + asi_clone_pgd(asi_global_nonsensitive_pgd, init_mm.pgd,
> + VMEMMAP_START + (1UL << PGDIR_SHIFT));

There's a bug here that Yosry has fixed in our internal version, I
neglected to incorporate that here.

Under KASLR, vmemmap is not necessarily exactly 2 PGDs like this is
assuming. In fact it can share a PGD entry with the vmalloc area. So
to be correct this cloning logic needs to actually look at the
alignment and then navigate the page table hierarchy appropriately.

To be fixed for the next version.

As Yosry noted internally we also need to think about vmmemap getting
updated under memory hotplug.