On 19.03.2025 11:32, Jan Beulich wrote: > On 18.03.2025 18:35, Roger Pau Monne wrote: >> Relocations are now applied after having moved the trampoline, > > That's two entirely different sets of relocations, isn't it? What we generate > here is what is to be encoded in the PE binary's .reloc section, for the PE > loader to process. And for us to then process again once we move Xen back to > its linked position (by virtue of leaving physical mode). Therefore what > matters here is whether these relocations are still carried out while on the > page tables to boot loader created, or when already on page tables we control. > In the former case any relocation to a non-writable section would be liable > to fault when applied.
And yes - both calls to efi_arch_relocate_image() are ahead of switching page tables. The first call is benign - no writes occur there. The second call would cause #PF though for any relocs applied to .text or .rodata or .init.text or whatever else is non-writable. Jan