Re: [PATCH v7 14/18] x86/boot: make sure KASLR does not step over KHO preserved memory

Dave Hansen
2025-05-02T21:36:31Z

On 5/2/25 14:16, Mike Rapoport wrote:
>>> +/*
>>> + * If KHO is active, only process its scratch areas to ensure we are not
>>> + * stepping onto preserved memory.
>>> + */
>>> +#ifdef CONFIG_KEXEC_HANDOVER
>>> +static bool process_kho_entries(unsigned long minimum, unsigned long image_size)
>>> +{
>> I thought we agreed to rework this to unconditionally define the
>> kho_scratch structures so the #ifdef can go away?
> It's either #ifdef or double casting and my understanding was that your
> preference was to get rid of the double casting.

Looking back at the other message... Sorry, you did make it clear there
and it just didn't penetrate my thick skull.

The double cast is goofy, but it does seem to be the normal way of doing
things. There are lots of examples of it. So, grudgingly, I prefer the
double cast over the #ifdef.

BTW, _please_ changelog this stuff. It would have saved this round of
back-and-forth. The changelog is the perfect place to say something like:

This looks goofy out of context, but it is unfortunately the way
that this is handled across the tree. There are at least a dozen
instances of casting like this.

This series is generally a bit sparse in the changelog and comment
departments.