From: "Bret Barkelew" <bret.barkelew@microsoft.com>
To: "Thomas Abraham" <thomas.abraham@arm.com>,
"Ard Biesheuvel (TianoCore)" <ardb+tianocore@kernel.org>,
"Lindholm, Leif" <leif@nuviainc.com>,
"Laszlo Ersek" <lersek@redhat.com>,
"Marvin Häuser" <mhaeuser@posteo.de>,
"Sami Mujawar" <sami.mujawar@arm.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: nd <nd@arm.com>
Subject: Re: ArmVirt and Self-Updating Code
Date: Thu, 22 Jul 2021 14:54:39 +0000 [thread overview]
Message-ID: <MW4PR21MB190749749FEFB4E5343D2FB9EFE49@MW4PR21MB1907.namprd21.prod.outlook.com> (raw)
In-Reply-To: <DB9PR08MB67464B261E4F1815BCDD7C289D199@DB9PR08MB6746.eurprd08.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 4472 bytes --]
Expanding audience to the full dev list…
See below…
- Bret
From: Thomas Abraham<mailto:thomas.abraham@arm.com>
Sent: Wednesday, July 7, 2021 11:07 PM
To: Bret Barkelew<mailto:Bret.Barkelew@microsoft.com>; Ard Biesheuvel (TianoCore)<mailto:ardb+tianocore@kernel.org>; Lindholm, Leif<mailto:leif@nuviainc.com>; Laszlo Ersek<mailto:lersek@redhat.com>; Marvin Häuser<mailto:mhaeuser@posteo.de>; Sami Mujawar<mailto:sami.mujawar@arm.com>
Cc: nd<mailto:nd@arm.com>
Subject: [EXTERNAL] RE: ArmVirt and Self-Updating Code
+ Sami
From: Bret Barkelew <Bret.Barkelew@microsoft.com>
Sent: Thursday, July 8, 2021 11:05 AM
To: Thomas Abraham <thomas.abraham@arm.com>; Ard Biesheuvel (TianoCore) <ardb+tianocore@kernel.org>; Lindholm, Leif <leif@nuviainc.com>; Laszlo Ersek <lersek@redhat.com>; Marvin Häuser <mhaeuser@posteo.de>
Subject: ArmVirt and Self-Updating Code
All,
Marvin asked me a question on the UEFI Talkbox Discord that’s a little beyond my ken…
“There is self-relocating code in ArmVirtPkg:
https://github.com/tianocore/edk2/blob/17143c4837393d42c484b42d1789b85b2cff1aaf/ArmVirtPkg/PrePi/PrePi.c#L133-L165<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftianocore%2Fedk2%2Fblob%2F17143c4837393d42c484b42d1789b85b2cff1aaf%2FArmVirtPkg%2FPrePi%2FPrePi.c%23L133-L165&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C7f8b266a81d44c853f6108d941d6a804%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637613212486760659%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Qe54pIgdrQiP%2Bb9WNOhSRqbWWsJ8FG4ukaYvjRYGfig%3D&reserved=0>
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: https://github.com/tianocore/edk2/blob/17143c4837393d42c484b42d1789b85b2cff1aaf/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c#L379-L386<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftianocore%2Fedk2%2Fblob%2F17143c4837393d42c484b42d1789b85b2cff1aaf%2FStandaloneMmPkg%2FLibrary%2FStandaloneMmCoreEntryPoint%2FAArch64%2FStandaloneMmCoreEntryPoint.c%23L379-L386&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C7f8b266a81d44c853f6108d941d6a804%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637613212486770613%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=HwixIAI%2FnnBRL4lWtdbooRRwps9gOj%2FEekr55DtXE44%3D&reserved=0>
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:
https://github.com/tianocore/edk2/blob/17143c4837393d42c484b42d1789b85b2cff1aaf/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/SetPermissions.c#L131-L158<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftianocore%2Fedk2%2Fblob%2F17143c4837393d42c484b42d1789b85b2cff1aaf%2FStandaloneMmPkg%2FLibrary%2FStandaloneMmCoreEntryPoint%2FAArch64%2FSetPermissions.c%23L131-L158&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C7f8b266a81d44c853f6108d941d6a804%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637613212486770613%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=YcA%2B9yB8lHvCCSMOK8jbfxLXuO1KReB2zjNn9Jcqmc0%3D&reserved=0>
“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
[-- Attachment #2: Type: text/html, Size: 7803 bytes --]
next parent reply other threads:[~2021-07-22 14:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <MW4PR21MB19074D9D114BBBCC21B53B6FEF199@MW4PR21MB1907.namprd21.prod.outlook.com>
[not found] ` <DB9PR08MB67464B261E4F1815BCDD7C289D199@DB9PR08MB6746.eurprd08.prod.outlook.com>
2021-07-22 14:54 ` Bret Barkelew [this message]
2021-07-22 15:14 ` ArmVirt and Self-Updating Code Ard Biesheuvel
2021-07-23 9:54 ` Marvin Häuser
2021-07-23 10:13 ` Ard Biesheuvel
2021-07-23 10:47 ` Marvin Häuser
2021-07-23 14:09 ` Ard Biesheuvel
2021-07-23 14:27 ` Marvin Häuser
2021-07-23 14:34 ` Ard Biesheuvel
2021-07-31 19:08 ` Marvin Häuser
2021-08-01 16:33 ` Ard Biesheuvel
2021-08-01 21:40 ` [edk2-devel] " Marvin Häuser
2021-08-02 18:05 ` Andrew Fish
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MW4PR21MB190749749FEFB4E5343D2FB9EFE49@MW4PR21MB1907.namprd21.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox