Re: [PATCH v7 08/22] x86/virt/seamldr: Allocate and populate a module update request
From: Chao Gao
Date: Wed Apr 01 2026 - 04:34:22 EST
On Tue, Mar 31, 2026 at 08:44:36AM -0700, Dave Hansen wrote:
>On 3/31/26 05:41, Chao Gao wrote:
>> + ptr = sig;
>> + for (i = 0; i < sig_size / SZ_4K; i++) {
>> + /*
>> + * @sig is 4KB-aligned, but that does not imply PAGE_SIZE
>> + * alignment when PAGE_SIZE != SZ_4K. Always include the
>> + * in-page offset.
>> + */
>> + params->sigstruct_pa[i] = (vmalloc_to_pfn(ptr) << PAGE_SHIFT) +
>> + ((unsigned long)ptr & ~PAGE_MASK);
>> + ptr += SZ_4K;
>> + }
>
>There are a billion things the mainline kernel _could_ do. Like a 32-bit
>4/4 split or a non-4k PAGE_SIZE on x86. But the mainline kernel doesn't
>*do* this.
>
>Why add complexity to deal with something that doesn't exist?
The intent was to avoid sprinkling subtle assumptions that PAGE_SIZE == SZ_4K.
But I agree that on x86 that's not a realistic concern today. I will just
assume 4KB page size.
And I assume we don't need WARN_ON_ONCE(PAGE_SIZE != SZ_4K) since this is
unlikely to break soon and shouldn't be very hard to debug and fix if it
does.