summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-06-10 22:25:18 +0300
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-06-16 07:45:19 +0300
commita61e6ad76914a30a562ac01339c5d21f3283def8 (patch)
tree658db5d9d6e11dcc31579567d41ad61b5590b2a6 /lib
parent12858ab216a2f3faf7e37fb5c292b64afff673cf (diff)
downloadu-boot-a61e6ad76914a30a562ac01339c5d21f3283def8.tar.xz
efi_selftest: ReinstallProtocolInterface test
Test ReinstallProtocolInterface() more rigorously. Replacing the sole installed protocol interface must not result in deleting the handle and creating a new one. Check which interface is actually installed before and after ReinstallProtocolInterface(). Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_selftest/efi_selftest_register_notify.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/efi_selftest/efi_selftest_register_notify.c b/lib/efi_selftest/efi_selftest_register_notify.c
index ad4bcce1a1..adf5dd00a1 100644
--- a/lib/efi_selftest/efi_selftest_register_notify.c
+++ b/lib/efi_selftest/efi_selftest_register_notify.c
@@ -124,6 +124,7 @@ static int execute(void)
{
efi_status_t ret;
efi_handle_t handle1 = NULL, handle2 = NULL;
+ struct interface *interface;
struct interface interface1, interface2;
ret = boottime->install_protocol_interface(&handle1, &guid1,
@@ -145,6 +146,18 @@ static int execute(void)
efi_st_error("LocateHandle failed\n");
return EFI_ST_FAILURE;
}
+ interface = NULL;
+ ret = boottime->open_protocol(handle1, &guid1, (void**)&interface,
+ NULL, NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ if (ret != EFI_SUCCESS) {
+ efi_st_error("Cannot find installed protocol on handle\n");
+ return EFI_ST_FAILURE;
+ }
+ if (interface != &interface1) {
+ efi_st_error("Wrong interface after install\n");
+ return EFI_ST_FAILURE;
+ }
ret = boottime->free_pool(context.handles);
if (ret != EFI_SUCCESS) {
efi_st_error("FreePool failed\n");
@@ -186,6 +199,18 @@ static int execute(void)
efi_st_error("FreePool failed\n");
return EFI_ST_FAILURE;
}
+ interface = NULL;
+ ret = boottime->open_protocol(handle1, &guid1, (void**)&interface,
+ NULL, NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ if (ret != EFI_SUCCESS) {
+ efi_st_error("Cannot find reinstalled protocol on handle\n");
+ return EFI_ST_FAILURE;
+ }
+ if (interface != &interface2) {
+ efi_st_error("Wrong interface after reinstall\n");
+ return EFI_ST_FAILURE;
+ }
context.notify_count = 0;
ret = boottime->install_protocol_interface(&handle2, &guid1,
EFI_NATIVE_INTERFACE,