Re: [PATCH v5 08/22] x86/virt/seamldr: Allocate and populate a module update request

From: Chao Gao

Date: Thu Mar 19 2026 - 03:28:21 EST


On Wed, Mar 18, 2026 at 10:58:44AM +0000, Kiryl Shutsemau wrote:
>On Wed, Mar 18, 2026 at 04:50:34PM +0800, Chao Gao wrote:
>> >> + ptr = sig;
>> >> + for (i = 0; i < sig_size / SZ_4K; i++) {
>> >> + /*
>> >> + * Don't assume @sig is page-aligned although it is 4KB-aligned.
>> >> + * Always add the in-page offset to get the physical address.
>> >> + */
>> >
>> >I don't follow this. If @sig is 4k aligned in VA, it is page aligned.
>>
>> Dan's concern was that PAGE_SIZE is not guaranteed to be 4096.
>>
>> I agree that PAGE_SIZE is 4K on x86 today. But to address that concern, I saw
>> two options:
>>
>> 1. Add WARN_ON_ONCE(PAGE_SIZE != SZ_4K), or
>> 2. Handle it as in the code above.
>>
>> I didn't find existing code using option 1 in x86, so I chose option 2.
>
>Please, make it clear in the comment that you are talking about PAGE_SIZE != SZ_4K.

Sure. How about:

/*
* @sig is 4KB-aligned, but that does not imply PAGE_SIZE
* alignment when PAGE_SIZE != SZ_4K. Always include the
* in-page offset.
*/