Re: ArmVirt and Self-Updating Code

Bret Barkelew

Expanding audience to the full dev list…

See below…


- Bret


From: Thomas Abraham
Sent: Wednesday, July 7, 2021 11:07 PM
To: Bret Barkelew; Ard Biesheuvel (TianoCore); Lindholm, Leif; Laszlo Ersek; Marvin Häuser; Sami Mujawar
Cc: nd
Subject: [EXTERNAL] RE: ArmVirt and Self-Updating Code


+ Sami


From: Bret Barkelew <Bret.Barkelew@...>
Sent: Thursday, July 8, 2021 11:05 AM
To: Thomas Abraham <thomas.abraham@...>; Ard Biesheuvel (TianoCore) <ardb+tianocore@...>; Lindholm, Leif <leif@...>; Laszlo Ersek <lersek@...>; Marvin Häuser <mhaeuser@...>
Subject: ArmVirt and Self-Updating Code




Marvin asked me a question on the UEFI Talkbox Discord that’s a little beyond my ken…


“There is self-relocating code in ArmVirtPkg:

According to comments in the ASM, it seems like this is for Linux-based RAM boot (I saw further stuff for KVM, so it makes sense I guess?). It seems unfortunate it cannot be mapped into a known address range so that self-relocation is not necessary, but that's out of my scope to understand.


“Now, StandaloneMmPkg has similar (self-)relocation code too:

Because I cannot find such elsewhere, I assume it must be for the same ARM virtualised environment as above. The binary it applies the Relocations to is documented to be the Standalone MM core, but in fact SecCore is located:


“This yields the following questions to me:

1) What even invokes Standalone MM on ARM? It is documented it is spawned during SEC, but I could not find any actual invocation.

2) Why does Standalone MM (self-)relocation locate SecCore? Should it not already have been relocated with the code from ArmPlatformPkg? Is Standalone MM embedded into ARM SecCore?

3) Why is SecCore the only module relocated? Are all others guaranteed to be "properly" loaded?

4) Is there maybe some high-level documented about the ARM boot flow? It seems to be significantly different from the x86 routes quite vastly.”


Hoping that one of you could get me closer to an answer for him. Also happy to take this to the greater mailing list, but thought I’d avoid churn.


Thanks in advance!

- Bret



Join to automatically receive all group messages.