On 29/04/2026 16:46, Ard Biesheuvel wrote: >>> @@ -1155,7 +1157,11 @@ static void __init map_mem(void) >>> * of the region accessible to subsystems such as hibernate, >>> * but protects it from inadvertent modification or execution. >>> */ >>> - __map_memblock(kernel_start, kernel_end, pgprot_tagged(PAGE_KERNEL), >>> + __map_memblock(kernel_start, init_begin, pgprot_tagged(PAGE_KERNEL), >>> + flags); >>> + >>> + /* Map the kernel data/bss so it can be remapped later */ >>> + __map_memblock(init_end, kernel_end, pgprot_tagged(PAGE_KERNEL), >> Maybe I'm missing something obvious, but considering patch 3/4 couldn't >> we directly map the range RO here? >> > After 3/4, __map_memblock() will no longer combine new mappings with existing > ones into block mappings or contiguous ranges. However, it will still set the > requested type and permission attributes on the entire range, and so the > second > invocation is needed to restore the read-only bit. > > IOW, we could also map it read-only twice, the result would be the same, but > the > second call is still needed.
Got it, thanks. - Kevin

