Does the Ovmf debug lib work at runtime?


Hantke, Florian <florian.hantke@...>
 

Great, thank you,I will try it out later.

Best
Florian


Laszlo Ersek
 

On 06/14/20 21:23, Hantke, Florian wrote:
Hello everyone,

I am trying some runtime things and I was wondering if the Ovmf debug
lib (with Qemu) works at runtime?
Yes. For example, the following patch:

diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 1e71fc642c76..ab77e023d63f 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -2353,6 +2353,8 @@ VariableServiceGetVariable (
VARIABLE_POINTER_TRACK Variable;
UINTN VarDataSize;

+ DEBUG ((DEBUG_INFO, "%a:%d\n", __FUNCTION__, __LINE__));
+
if (VariableName == NULL || VendorGuid == NULL || DataSize == NULL) {
return EFI_INVALID_PARAMETER;
}

generates a bunch of output lines (on the QEMU debug console) every time I run "efibootmgr" in the guest.

Thanks
Laszlo


I put some debug functions in MdePkg/Library/UefiRuntimeLib/RuntimeLib.c
and in the exit_boot_services/virtual_address_change events of my basic
runtime driver.
Looking at the debug output I can see that the last message is my debug
from virtual_address_change.
Running a Ubuntu 20.04 in the VM I would expect some output from the
runtimeLib when the system runs, for instance getVariable.
At least in this blog post [1] Ubuntu called the runtimeLib.

Could it be that I mistake something or that my approach is wrong?

Thank you for your help and all the best
Florian

[1] http://blog.frizk.net/2017/01/attacking-uefi-and-linux.html



florian.hantke@...
 

Hello everyone,

I am trying some runtime things and I was wondering if the Ovmf debug lib (with Qemu) works at runtime?
I put some debug functions in MdePkg/Library/UefiRuntimeLib/RuntimeLib.c and in the exit_boot_services/virtual_address_change events of my basic runtime driver.
Looking at the debug output I can see that the last message is my debug from virtual_address_change.
Running a Ubuntu 20.04 in the VM I would expect some output from the runtimeLib when the system runs, for instance getVariable.
At least in this blog post [1] Ubuntu called the runtimeLib.

Could it be that I mistake something or that my approach is wrong?

Thank you for your help and all the best
Florian

[1] http://blog.frizk.net/2017/01/attacking-uefi-and-linux.html