[PATCH 0/2] efi_loader: fix efi_get_next_variable_name_mem()

Ilias Apalodimas ilias.apalodimas at linaro.org
Mon Dec 19 10:19:13 CET 2022


On Sun, 18 Dec 2022 at 08:09, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> The VariableNameSize parameter is in bytes but u16_strnlen() counts u16.
>
> Fix the parameter check for null termination.
> Provide unit test for parameter checks in GetNextVariableName
>
> @Ilias:
> Could you, please, run the unit test against the OP-TEE variable store
> (CONFIG_EFI_MM_COMM_TEE=y)..

Sure, keep in mind there's one test there that fails for StMM (and we
should probably look into fixing it in StMM)
With this hack applied -- which irrelevant to your patch, everything seems ok

diff --git a/lib/efi_selftest/efi_selftest_variables.c
b/lib/efi_selftest/efi_selftest_variables.c
index c7a3fdbaa67d..8254bacd08e1 100644
--- a/lib/efi_selftest/efi_selftest_variables.c
+++ b/lib/efi_selftest/efi_selftest_variables.c
@@ -138,7 +138,7 @@ static int execute(void)
                                    15, v);
        if (ret != EFI_NOT_FOUND) {
                efi_st_error("SetVariable(APPEND_WRITE) with size 0 to
non-existent variable returns wrong code\n");
-               return EFI_ST_FAILURE;
+               //return EFI_ST_FAILURE;
        }
        /* Enumerate variables */



Testing EFI API implementation

Selected test: 'variables'

Setting up 'variables'
Setting up 'variables' succeeded

Executing 'variables'
lib/efi_selftest/efi_selftest_variables.c(140):
ERROR: SetVariable(APPEND_WRITE) with size 0 to non-existent variable
returns wrong code
Executing 'variables' succeeded

Summary: 0 failures


Cheers
/Ilias
>
> Heinrich Schuchardt (2):
>   efi_loader: fix efi_get_next_variable_name_mem()
>   efi_selftest: conformance test for GetNextVariableName
>
>  include/efi_variable.h                    |  3 +-
>  lib/efi_loader/efi_var_mem.c              |  6 ++--
>  lib/efi_selftest/efi_selftest_variables.c | 35 +++++++++++++++++++++++
>  3 files changed, 40 insertions(+), 4 deletions(-)
>
> --
> 2.37.2
>


More information about the U-Boot mailing list