Re: [PATCH v3] x86/mm/64: free the gap between BSS_MAIN and BSS_DECRYPTED

From: Borislav Petkov

Date: Sat Jul 11 2026 - 00:53:18 EST


On Fri, Jul 10, 2026 at 07:50:13AM -0400, Hamza Mahfooz wrote:
> @@ -1446,6 +1450,10 @@ void mark_rodata_ro(void)
> (void *)text_end, (void *)rodata_start);
> free_kernel_image_pages("unused kernel image (rodata/data gap)",
> (void *)rodata_end, (void *)_sdata);
> +#ifdef CONFIG_AMD_MEM_ENCRYPT
> + free_kernel_image_pages("unused kernel image (bss_decrypted gap)",
> + (void *)bss_decrypted_gap_start, (void *)bss_decrypted_gap_stop);
> +#endif

If you're going to add the ugly ifdeffery gunk, why don't you push it into the

#define BSS_DECRYPTED

place so that you don't need to do any of that freeing when
CONFIG_AMD_MEM_ENCRYPT is not enabled?

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette