SmmSwDispatch2Protocol - Registering an SMI - Can't find protocol with OVMF
Simon McMillan
Hi,
Trying to register a SMI in my custom SMM module I'm running into issues. Before registering the SMI, the code looks for the specific protocol this way: Status = gSmst->SmmLocateProtocol( &gEfiSmmSwDispatch2ProtocolGuid, NULL, (VOID**)&SwDispatch ); DEBUG ( (EFI_D_INFO, "SmmSwDispatch2Protocol Status: 0x%x\n", Status) ); ASSERT_EFI_ERROR(Status); Unfortunately, while starting OVMF, boot hangs and the following message appears: SmmSwDispatch2Protocol Status: 0xE ASSERT_EFI_ERROR (Status = Not Found) Adding gEfiSmmSwDispatch2ProtocolGuid to the Depex section of my INF file doesn't solve the issue, in fact it prevents the custom code from being loaded at all. For info in OVMF, I simply added a reference to the inf file in the DSC file, so that my custom code is built along OVMF: custom_code/custom_code.inf OVMF is built with the following options: build -DSMM_REQUIRE Then the SMM module is converted to the right format and injected manually with UEFITool. Would anyone be of help with this situation? Or could give me an advice of what would be wrong or missing?
|
|
SmmSwDispatch2Protocol - Registering an SMI - Can't find protocol with OVMF
smcmillan000@...
Hi,
Trying to register a SMI in my custom SMM module here, and I'm running into an issue. Before registering the SMI, the code looks for the specific protocol this way: Status = gSmst->SmmLocateProtocol( &gEfiSmmSwDispatch2ProtocolGuid, NULL, (VOID**)&SwDispatch ); DEBUG ( (EFI_D_INFO, "SmmSwDispatch2Protocol Status: 0x%x\n", Status) ); ASSERT_EFI_ERROR(Status); Unfortunately, while starting OVMF, boot hangs and the following message appears: SmmSwDispatch2Protocol Status: 0xE ASSERT_EFI_ERROR (Status = Not Found) Adding gEfiSmmSwDispatch2ProtocolGuid to the Depex section of my INF file doesn't solve the issue, in fact it prevents the custom code from being loaded at all. For info in OVMF, I simply added a reference to the inf file in the DSC file, so that my custom code is built along OVMF: custom_code/custom_code.inf OVMF is built with the following options: build -DSMM_REQUIRE Then the SMM module is converted to the right format and injected manually with UEFITool. Would anyone be of help with this situation? Or could give me an advice of what would be wrong or missing?
|
|
Re: Request for help understanding MemoryOverwriteRequestControl
Martyn Welch <martyn.welch@...>
On Tue, 2020-09-29 at 15:06 +0200, Laszlo Ersek wrote:
+Jiewen, comments belowYeah, I don't think this platform has any fancy way of doing this. Ah! Awesome, this was the bit I was missing!We have "CONFIG_RESET_ATTACK_MITIGATION" set in the Linux kernelYes, see commit ccc829ba3624 ("efi/libstub: Enable reset attack I suspect this is exactly what we are seeing.My understanding is that we should be seeing both these EFIMore precisely, the valid cases are: Since this board is in our LAVA farm and used by a few differentOne of the boards in our LAVA instance was initially only exposingThis seems vaguely consistent with the OS kernel being buggy too things, I guess there's a reasonable chance that one of these ran a kernel of a sufficient vintage to have triggered the buggy behaviour. Based on the behaviour I'm seeing, I believe the latest offering on theAny help/pointers would be much appreciated.I would suggest: Intel site, released in Aug 2019, doesn't include these changes. It also reports as `UEFI v2.60 (EDK II, 0x00010000)`. I'm unsure exactly how the versioning in EDK2 is managed, but the `EFI_SYSTEM_TABLE_REVISION` that I think is used here was changed to `2.70` in Dec 2017, so I guess that minnowboard firmware is based on an old tree. Now that I know this is probably a bug, I can live with it to be honest. (2) Make sure your kernel does not *create* MOR Control under anyThe one I really care about is currently a 5.7.x stable release, so should be good there. (3) Either remove CONFIG_RESET_ATTACK_MITIGATION from your kernelYes, this is looking like it may be the best way to handle this. Thanks for your help, Martyn
|
|
Re: how to fix compile warning: cannot find entry symbol _ModuleEntryPoint
Andrew Fish
Wenyi,
toggle quoted messageShow quoted text
If you look under the Build results <Platform>/<DEBUG/RELEASE>_<COMPILER>/AArch64/Edk2/ArmPkg/Drivers/ArmGic/ (hopefully I got that right) and go down a little bit you will see the build generated GNUmakefile. You might want to take a look at that to try and figure out what is going on? Thanks, Andrew Fish
On Sep 29, 2020, at 7:23 AM, wenyi,xie via groups.io <xiewenyi2@...> wrote:
|
|
Re: Request for help understanding MemoryOverwriteRequestControl
Yao, Jiewen
Thanks Laszlo to explain that.
toggle quoted messageShow quoted text
One minor comments: TCG adopted Secure MOR in latest MOR 1.1 spec in 2019 - https://trustedcomputinggroup.org/resource/pc-client-work-group-platform-reset-attack-mitigation-specification/ So it is a TCG standard now. Thank you Yao Jiewen
-----Original Message-----
|
|
Re: Request for help understanding MemoryOverwriteRequestControl
Laszlo Ersek
On 09/29/20 15:57, Yao, Jiewen wrote:
Thanks Laszlo to explain that.Ah, thanks. :) I'll have to refresh my local PDF then! Laszlo
|
|
Re: ESRT in OVMF
Tomas Pilar (tpilar)
Hi Sandeep,
You should probably discuss on this list what you want to add to the main tree before sending patches, you might get good pointers. Otherwise, there is a good guide as to how it works here: https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers . Cheers, Tom On Tue, Sep 22, 2020 at 6:23 AM Sandeep Dhanvada < sandeep.dhanvada@...> wrote: Hi,
|
|
Re: how to fix compile warning: cannot find entry symbol _ModuleEntryPoint
wenyi,xie
Thanks, Andrew, Laszlo and liming, with your help I find the module which really own the warning.
toggle quoted messageShow quoted text
As the compile is multithreading, the order in compile log is not right. The module which cause warning is written by ourselves. In this module's inf file, MODULE_TYPE is set as USER_DEFINED, and UefiDriverEntryPoint is not set in [LibraryClasses].
On 2020/9/30 0:00, Andrew Fish wrote:
Wenyi,
|
|
Re: how to fix compile warning: cannot find entry symbol _ModuleEntryPoint
wenyi,xie
I checked my platform DSC and there's UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf in the section [LibraryClasses.common].
toggle quoted messageShow quoted text
I'm not sure why _ModuleEntryPoint can't be found when link the object. Regards Wenyi
On 2020/9/29 2:21, Laszlo Ersek wrote:
On 09/28/20 10:57, wenyi,xie via groups.io wrote:Hi, allThe UefiDriverEntryPoint lib class in the [Sources] section in
|
|
Re: Request for help understanding MemoryOverwriteRequestControl
Laszlo Ersek
+Jiewen, comments below
On 09/24/20 11:36, Martyn Welch wrote: Hi,Side comment: Wow! I very much suspected that the memory overwrite is performed on physical platforms via proprietary DIMM or board access, not via plain RAM writes. The above "MRC" reference confirms it. Yes, see commit ccc829ba3624 ("efi/libstub: Enable reset attack mitigation", 2017-08-26). (Side comment regarding historical Fedora kernels: <https://bugzilla.redhat.com/show_bug.cgi?id=1498159>.) The config knob's documentation was later extended in commit a5c03c31af22 ("x86/efi: Clarify that reset attack mitigation needs appropriate userspace", 2018-01-19). MemoryOverwriteRequestControlLock is a Microsoft- (not TCG-) originated hardening: https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/device-guard-requirements It's been a while since I last thought about it, but basically it's a way to prevent the attacker from even attempting to clear the MOR bit in the original MemoryOverwriteRequestControl variable, before they'd force a platform reset. The situation where you see MOR Control Lock variable but not the MOR Control variable, was a bug in edk2. It has been fixed under https://bugzilla.tianocore.org/show_bug.cgi?id=727 (We first encountered this issue in <https://bugzilla.redhat.com/show_bug.cgi?id=1496170>.) My understanding is that we should be seeing both these EFI variablesMore precisely, the valid cases are: - none of them present (= system doesn't support the Platform Reset Attack Mitigation from the TCG) - MOR Control is present, but MOR Control Lock is not (= the TCG spec is supported, but the Microsoft-defined hardening is not) - both MOR Control and MOR Control Lock are present (= both specs are supported) Yes, with the bug present, the firmware would re-create MOR Control Lock. See TianoCore#727 (link above). One of the boards in our LAVA instance was initially only exposing theThis seems vaguely consistent with the OS kernel being buggy too (that is, <https://bugzilla.redhat.com/show_bug.cgi?id=1498159>), *or else* with your Linux userspace not clearing the MOR bit in the MOR Control variable, as a part of the controlled OS shutdown. Any help/pointers would be much appreciated.I would suggest: (1) Upgrade the platform firmware to a version that contains the edk2 commit range fixing TianoCore#727 (namely 35ac962b5473..fda8f631edbb). This prevents the out-of-spec situation where only MOR Control Lock exists. (While that situation is not your acute problem now, it's best to get it solved too.) (2) Make sure your kernel does not *create* MOR Control under any circumstances, only modifies it if it exists. (3) Either remove CONFIG_RESET_ATTACK_MITIGATION from your kernel config, or verify that your userspace clears the MOR bit in MOR Control before a controlled OS shutdown. (To be honest, I don't know what Linux distributions satisfy the userspace requirement, as CONFIG_RESET_ATTACK_MITIGATION is not enabled in RHEL8 for example, as far as I can see.) Thanks Laszlo
|
|
Re: How to Add an USB device to the Emulator?
Guomin Jiang
Which emulator? Ovmf?
toggle quoted messageShow quoted text
Which USB? Real or Virtual? Thanks, Guomin
-----Original Message-----
|
|
Request for help understanding MemoryOverwriteRequestControl
Martyn Welch <martyn.welch@...>
Hi,
We have a number of MinnowBoards (both Turbot and Max variants) here that are used for various Linux development purposes, including having a number that are used in our LAVA farm which among other things runs Linux KernelCI jobs. The firmware on these devices is currently "MNW2MAX1.X64.0101.R01.1908071815" as downloaded from the Intel site: https://software.intel.com/content/www/us/en/develop/articles/minnowboard-maxturbot-uefi-firmware.html We are seeing the following message during boot on *some* of the boards, but not others: Clear memory in MRC per MOR request Start, Please wait for some minutes... We have "CONFIG_RESET_ATTACK_MITIGATION" set in the Linux kernel configuration, which I understand will cause the "MemoryOverwriteRequest" bit to be set during boot and hence trigger this behaviour (unless explicitly cleared before the board is reset). Some of our boards seem to only be exposing the related "MemoryOverwriteRequestControlLock" EFI variable: Shell> dmpstore -guid e20939be-32d4-41be-a150-897f85d49829 dmpstore: No matching variables found. Guid E20939BE-32D4-41BE- A150-897F85D49829 Shell> dmpstore -guid bb983ccf-151d-40e1-a07b-4a17be168292 Variable NV+RT+BS 'BB983CCF-151D-40E1-A07B- 4A17BE168292:MemoryOverwriteRequestControlLock' DataSize = 0x01 00000000: 00 *.* Thus this behaviour isn't triggered. Others expose both "MemoryOverwriteRequestControl" and "MemoryOverwriteRequestControlLock": Shell> dmpstore -guid e20939be-32d4-41be-a150-897f85d49829 Variable NV+RT+BS 'E20939BE-32D4-41BE-A150- 897F85D49829:MemoryOverwriteRequestControl' DataSize = 0x01 00000000: 01 *.* Shell> dmpstore -guid bb983ccf-151d-40e1-a07b-4a17be168292 Variable NV+RT+BS 'BB983CCF-151D-40E1-A07B- 4A17BE168292:MemoryOverwriteRequestControlLock' DataSize = 0x01 00000000: 00 *.* My understanding is that we should be seeing both these EFI variables being exposed. I'm rather unfamiliar with the EDK codebase and have not been able to work out how I would end up with "MemoryOverwriteRequestControlLock" and not "MemoryOverwriteRequestControl". I've tried using `J7` to reset the NVRAM on a board just exposing "MemoryOverwriteRequestControlLock", following the process described here to see if it would have an effect and it hasn't: https://uchan.hateblo.jp/entry/2018/01/09/075230 One of the boards in our LAVA instance was initially only exposing the lock variable, but then seemingly randomly started to expose the other variable and perform the erase at boot. I've not been able to determine what triggered this change in behaviour. Any help/pointers would be much appreciated. Thanks in advance, Martyn
|
|
Re: 答复: About edk2-platforms release
wanghuiqiang <wanghuiqiang@...>
Hi Leif,
Just want to make sure you received my previous mail, do you have any comments for the edk2-platform formal release? Waiting for you reply. Thanks! -----邮件原件----- 发件人: wanghuiqiang 发送时间: 2020年9月2日 13:54 收件人: Leif Lindholm <leif@...> 抄送: Michael D Kinney <michael.d.kinney@...>; discuss@edk2.groups.io; ard.biesheuvel@...; Songdongkuang <songdongkuang@...>; Lidongzhan <lidongzhan@...>; qiuliangen <qiuliangen@...>; Shenlimei <shenlimei@...>; John Garry <john.garry@...>; Tangxingjiang <tangxingjiang@...> 主题: 答复: About edk2-platforms release Hi Leif, Do you think that we have formal release version for edk2-platform? just like Linux and other open source software. Thanks! -----邮件原件----- 发件人: Huangming (Mark) 发送时间: 2020年6月30日 20:50 收件人: Leif Lindholm <leif@...> 抄送: Michael D Kinney <michael.d.kinney@...>; discuss@edk2.groups.io; ard.biesheuvel@...; Songdongkuang <songdongkuang@...>; Lidongzhan <lidongzhan@...>; wanghuiqiang <wanghuiqiang@...>; qiuliangen <qiuliangen@...>; Shenlimei <shenlimei@...>; John Garry <john.garry@...> 主题: Re: About edk2-platforms release 在 2020/6/30 19:56, Leif Lindholm 写道: Hi Ming, (+Mike, -Martin)As almost all of open source projects have release version, if possible we wish edk2-platforms can have released version for 2020.11. Thanks, Ming
|
|
How to Add an USB device to the Emulator?
Rocky Liao <rjliao@...>
Hi,
I am wondering is there a way to expose an USB device to the emulator and develop the usb driver over the emulator?
|
|
回复: [edk2-discuss] how to fix compile warning: cannot find entry symbol _ModuleEntryPoint
gaoliming
ModuleEntryPoint is provided by EntryPointLib. This driver links MdePkg\Library\UefiDriverEntryPoint. Please check.
toggle quoted messageShow quoted text
-----邮件原件-----
|
|
回复: [edk2-discuss] GCD initialization and memory allocation HOBs
gaoliming
Jeff:
-----邮件原件-----You mean the memory range specified by PHIT resource hob is selected by CoreInitializeMemoryServices(). This memory range includes PEI memory and the allocated memory. So, there is no free memory in this memory range. After CoreInitializeMemoryServices(), do you meet with memory allocation failure? Can you attach the failure boot log for further analysis? Thanks Liming We can easily work around this particular issue by splitting the system
|
|
Re: how to fix compile warning: cannot find entry symbol _ModuleEntryPoint
Laszlo Ersek
On 09/28/20 10:57, wenyi,xie via groups.io wrote:
Hi, allThe UefiDriverEntryPoint lib class in the [Sources] section in "ArmPkg/Drivers/ArmGic/ArmGicDxe.inf" should be resolved by your platform DSC to "MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf". That's where the definition of _ModuleEntryPoint() should come from (see "MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c"). Thanks Laszlo
|
|
Re: compile warning from BaseTools
Laszlo Ersek
On 09/28/20 16:10, wenyi,xie via groups.io wrote:
Hi all,I think I've always just ignored these... Laszlo
|
|
compile warning from BaseTools
wenyi,xie
Hi all,
I meet some compile warning in BaseTools,the version of EDK2 is edk2-stable201903, as I am not familiar with Antlr grammer, I don't know how to fix it. Could someone give me a hand, thanks! VfrSyntax.g, line 2018: warning: predicate: LT(i) missing, bad, or with i=0; assuming i=1 VfrSyntax.g, line 2023: warning: predicate: LT(i) missing, bad, or with i=0; assuming i=1 VfrSyntax.g, line 3651: warning: alts 1 and 2 of {..} ambiguous upon ( ";" RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf Default GrayOutIf ) VfrSyntax.g, line 3660: warning: alts 1 and 2 of {..} ambiguous upon ( ";" RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf Default GrayOutIf ) VfrSyntax.g, line 3669: warning: alts 1 and 2 of {..} ambiguous upon ( ";" RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf Default GrayOutIf ) VfrSyntax.g, line 3679: warning: alts 1 and 2 of {..} ambiguous upon ( ";" RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf Default GrayOutIf ) VfrSyntax.g, line 3709: warning: alts 1 and 2 of {..} ambiguous upon ( ";" RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf Default GrayOutIf ) VfrSyntax.g, line 3718: warning: alts 1 and 2 of {..} ambiguous upon ( ";" RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf Default GrayOutIf )
|
|
how to fix compile warning: cannot find entry symbol _ModuleEntryPoint
wenyi,xie
Hi, all
I use edk2-stable201903 in my project and meet a compile warning like below, /opt/buildtools/gcc-linaro-7.4.1-2019.02/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.4.1/../../../../aarch64-linux-gnu/bin/ld: warning: cannot find entry symbol _ModuleEntryPoint; not setting start address It seems like the warning happens when building EDKII/Edk2/ArmPkg/Drivers/ArmGic/ArmGicDxe.inf does anyone know how to fix it? If need more info, please contact me, thanks! here's some of my build option, Architecture(s) = AARCH64 Build target = RELEASE Toolchain = GCC5
|
|