On Wed, 23 Nov 2022 at 12:09, Borislav Petkov <bp@xxxxxxxxx> wrote: > > On Wed, Nov 23, 2022 at 11:52:32AM +0100, Ard Biesheuvel wrote: > > The patch moves it from .data to .bss inadvertently, and I am not > > convinced Tom's analysis is entirely accurate: we may simply have > > garbage in image_offset if we access it before .bss gets cleared. > > That should not be too hard to find out: add an endless loop in asm in > the guest right after the first image_offset access: > > 1: > jmp 1b > > and then dump its value. > > Or Tom might have an even better solution. > > But looking at the code, BSS clearing happens later, at .Lrelocated and > the EFI stub comes before it. AFAICT. > Indeed. And moving it back into .data makes the most sense in any case - the point of the patch is to drop the duplicate definitions from asm code, not to move it into a different section. The reason I hadn't spotted this is because my boot chain always sets the value of image_offset during the boot, and does not rely on the statically initialized value at all.