forked from pool/grub2
be3181b1eb
- VUL-0: grub2,shim: implement new SBAT method (bsc#1182057) * 0031-util-mkimage-Remove-unused-code-to-add-BSS-section.patch * 0032-util-mkimage-Use-grub_host_to_target32-instead-of-gr.patch * 0033-util-mkimage-Always-use-grub_host_to_target32-to-ini.patch * 0034-util-mkimage-Unify-more-of-the-PE32-and-PE32-header-.patch * 0035-util-mkimage-Reorder-PE-optional-header-fields-set-u.patch * 0036-util-mkimage-Improve-data_size-value-calculation.patch * 0037-util-mkimage-Refactor-section-setup-to-use-a-helper.patch * 0038-util-mkimage-Add-an-option-to-import-SBAT-metadata-i.patch * 0039-grub-install-common-Add-sbat-option.patch - Fix CVE-2021-20225 (bsc#1182262) * 0022-lib-arg-Block-repeated-short-options-that-require-an.patch - Fix CVE-2020-27749 (bsc#1179264) * 0024-kern-parser-Fix-resource-leak-if-argc-0.patch * 0025-kern-parser-Fix-a-memory-leak.patch * 0026-kern-parser-Introduce-process_char-helper.patch * 0027-kern-parser-Introduce-terminate_arg-helper.patch * 0028-kern-parser-Refactor-grub_parser_split_cmdline-clean.patch * 0029-kern-buffer-Add-variable-sized-heap-buffer.patch * 0030-kern-parser-Fix-a-stack-buffer-overflow.patch - Fix CVE-2021-20233 (bsc#1182263) * 0023-commands-menuentry-Fix-quoting-in-setparams_prefix.patch - Fix CVE-2020-25647 (bsc#1177883) * 0021-usb-Avoid-possible-out-of-bound-accesses-caused-by-m.patch - Fix CVE-2020-25632 (bsc#1176711) * 0020-dl-Only-allow-unloading-modules-that-are-not-depende.patch - Fix CVE-2020-27779, CVE-2020-14372 (bsc#1179265) (bsc#1175970) * 0001-include-grub-i386-linux.h-Include-missing-grub-types.patch * 0002-efi-Make-shim_lock-GUID-and-protocol-type-public.patch * 0003-efi-Return-grub_efi_status_t-from-grub_efi_get_varia.patch OBS-URL: https://build.opensuse.org/request/show/876326 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=374
80 lines
3.0 KiB
Diff
80 lines
3.0 KiB
Diff
From 5f2d71f71bc62c5cffbe27a9ee247803a77dc032 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
|
Date: Thu, 3 Dec 2020 16:01:47 +0100
|
|
Subject: [PATCH 04/46] efi: Add a function to read EFI variables with
|
|
attributes
|
|
|
|
It will be used to properly detect and report UEFI Secure Boot status to
|
|
the x86 Linux kernel. The functionality will be added by subsequent patches.
|
|
|
|
Signed-off-by: Ignat Korchagin <ignat@cloudflare.com>
|
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
Signed-off-by: Marco A Benatto <mbenatto@redhat.com>
|
|
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
---
|
|
grub-core/kern/efi/efi.c | 16 +++++++++++++---
|
|
include/grub/efi/efi.h | 5 +++++
|
|
2 files changed, 18 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
|
index 9fd136694..92e99b441 100644
|
|
--- a/grub-core/kern/efi/efi.c
|
|
+++ b/grub-core/kern/efi/efi.c
|
|
@@ -223,8 +223,11 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid,
|
|
}
|
|
|
|
grub_efi_status_t
|
|
-grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
|
- grub_size_t *datasize_out, void **data_out)
|
|
+grub_efi_get_variable_with_attributes (const char *var,
|
|
+ const grub_efi_guid_t *guid,
|
|
+ grub_size_t *datasize_out,
|
|
+ void **data_out,
|
|
+ grub_efi_uint32_t *attributes)
|
|
{
|
|
grub_efi_status_t status;
|
|
grub_efi_uintn_t datasize = 0;
|
|
@@ -261,7 +264,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
|
return GRUB_EFI_OUT_OF_RESOURCES;
|
|
}
|
|
|
|
- status = efi_call_5 (r->get_variable, var16, guid, NULL, &datasize, data);
|
|
+ status = efi_call_5 (r->get_variable, var16, guid, attributes, &datasize, data);
|
|
grub_free (var16);
|
|
|
|
if (status == GRUB_EFI_SUCCESS)
|
|
@@ -303,6 +306,13 @@ grub_efi_secure_boot (void)
|
|
return ret;
|
|
}
|
|
|
|
+grub_efi_status_t
|
|
+grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
|
+ grub_size_t *datasize_out, void **data_out)
|
|
+{
|
|
+ return grub_efi_get_variable_with_attributes (var, guid, datasize_out, data_out, NULL);
|
|
+}
|
|
+
|
|
#pragma GCC diagnostic ignored "-Wcast-align"
|
|
|
|
/* Search the mods section from the PE32/PE32+ image. This code uses
|
|
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
|
|
index f27d3a365..568d80030 100644
|
|
--- a/include/grub/efi/efi.h
|
|
+++ b/include/grub/efi/efi.h
|
|
@@ -77,6 +77,11 @@ grub_err_t EXPORT_FUNC (grub_efi_set_virtual_address_map) (grub_efi_uintn_t memo
|
|
grub_efi_uintn_t descriptor_size,
|
|
grub_efi_uint32_t descriptor_version,
|
|
grub_efi_memory_descriptor_t *virtual_map);
|
|
+grub_efi_status_t EXPORT_FUNC (grub_efi_get_variable_with_attributes) (const char *variable,
|
|
+ const grub_efi_guid_t *guid,
|
|
+ grub_size_t *datasize_out,
|
|
+ void **data_out,
|
|
+ grub_efi_uint32_t *attributes);
|
|
grub_efi_status_t EXPORT_FUNC (grub_efi_get_variable) (const char *variable,
|
|
const grub_efi_guid_t *guid,
|
|
grub_size_t *datasize_out,
|
|
--
|
|
2.26.2
|
|
|