hw/uefi: three small bug fixes.
cover hw/uefi: three small bug fixes.
Gerd Hoffmann (3):
hw/uefi: return success for notifications
hw/uefi: check access for first variable
hw/uefi: open json file in binary mode
hw/uefi/var-service-json.c | 2 +- hw/uefi/var-service-vars.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
Signature · 1 line
2.50.1
PATCH 1/3 hw/uefi: return success for notifications
Set status to SUCCESS for ready-to-boot and exit-boot-services notification calls.
--- hw/uefi/var-service-vars.c | 2 ++ 1 file changed, 2 insertions(+)
hw/uefi/var-service-vars.c +2 -0
@@ -702,12 +702,14 @@ uint32_t uefi_vars_mm_vars_proto(uefi_vars_state *uv)case SMM_VARIABLE_FUNCTION_READY_TO_BOOT :trace_uefi_event ("ready-to-boot" ); uv->ready_to_boot = true; + mvar->status =EFI_SUCCESS ; length =0 ;break ;case SMM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE :trace_uefi_event ("exit-boot-service" ); uv->exit_boot_service = true; + mvar->status =EFI_SUCCESS ; length =0 ;break ;
Signature · 1 line
2.50.1
Re: [PATCH 1/3] hw/uefi: return success for notifications
Quoted 7 lines · Gerd Hoffmann
Set status to SUCCESS for ready-to-boot and exit-boot-services notification calls.
Signed-off-by Gerd Hoffmann <[email protected]>--- hw/uefi/var-service-vars.c | 2 ++ 1 file changed, 2 insertions(+)
PATCH 2/3 hw/uefi: check access for first variable
In reply to Gerd HoffmannWhen listing variables (via get-next-variable-name) only the names of variables which can be accessed will be returned. That check was missing for the first variable though. Add it.
--- hw/uefi/var-service-vars.c | 3 +++ 1 file changed, 3 insertions(+)
hw/uefi/var-service-vars.c +3 -0
@@ -357,6 +357,9 @@ uefi_vars_mm_get_next_variable(uefi_vars_state *uv, mm_header *mhdr,if (uefi_strlen (name, nv->name_size) ==0 ) {/* empty string -> first */ var =QTAILQ_FIRST (&uv->variables); +while (var && !check_access (uv, var)) { + var =QTAILQ_NEXT (var, next); + }if (!var) {return uefi_vars_mm_error (mhdr, mvar,EFI_NOT_FOUND ); }
Signature · 1 line
2.50.1
Re: [PATCH 2/3] hw/uefi: check access for first variable
Quoted 8 lines · Gerd Hoffmann
When listing variables (via get-next-variable-name) only the names of variables which can be accessed will be returned. That check was missing for the first variable though. Add it.
Signed-off-by Gerd Hoffmann <[email protected]>--- hw/uefi/var-service-vars.c | 3 +++ 1 file changed, 3 insertions(+)
PATCH 3/3 hw/uefi: open json file in binary mode
In reply to Gerd HoffmannFixes file length discrepancies due to line ending conversions on windows hosts.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3058
--- hw/uefi/var-service-json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/uefi/var-service-json.c +1 -1
@@ -172,7 +172,7 @@ static GString *uefi_vars_to_json(uefi_vars_state *uv)void uefi_vars_json_init (uefi_vars_state *uv,Error **errp) {if (uv->jsonfile) { - uv->jsonfd =qemu_create (uv->jsonfile,O_RDWR ,0666 , errp); + uv->jsonfd =qemu_create (uv->jsonfile,O_RDWR |O_BINARY ,0666 , errp); } }
Signature · 1 line
2.50.1
Re: [PATCH 3/3] hw/uefi: open json file in binary mode
Quoted 8 lines · Gerd Hoffmann
Fixes file length discrepancies due to line ending conversions on windows hosts.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3058
Signed-off-by Gerd Hoffmann <[email protected]>--- hw/uefi/var-service-json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)