Re: [PATCH 1/2] x86/build: only align ENTRY_TEXT to PMD_SIZE if necessary
From: Hamza Mahfooz
Date: Wed Jul 16 2025 - 17:20:12 EST
On Thu, Jul 10, 2025 at 06:14:20AM -0700, Dave Hansen wrote:
> On 7/9/25 13:16, Hamza Mahfooz wrote:
> > PTI requires the begin and end of ENTRY_TEXT be aligned to PMD_SIZE.
> > SRSO requires srso_alias_untrain_ret to be 2M aligned. This costs
> > between 2-4 MiB of RAM (depending on the size of the preceding section).
> > So, only align when PTI is enabled or SRSO is enabled.
>
> This seems so utterly random.
>
> I don't think I was even aware of the SRSO restriction here. Looking
> over it now, I do see the vmlinux.lds.S changes and this does make sense.
>
> But I'm really worried that we've grown more dependencies on this
> alignment. Let's say, for instance, that you forgot to address SRSO in
> this patch and the mitigation got broken. Would we have ever known?
>
> I'd like to hear a lot more from you about why 2-4 MiB of RAM is
> important and what the environment is where you presumably know that
> there are no Meltdown or SRSO vulnerable CPUs.
We are using it to run a stripped down kernel (see [1]) on top of
HyperV for OpenHCL. It is only intended to run OpenVMM ([2]).
1. https://raw.githubusercontent.com/microsoft/OHCL-Linux-Kernel/refs/heads/product/hcl-main/6.12/Microsoft/hcl-x64.config
2. https://github.com/microsoft/OpenVMM