[RFC 2/7] debug/libstub: cheats to step around some boot service

Pingfan Liu piliu at redhat.com
Thu Jul 18 01:57:52 PDT 2024


For POC, step around these four function, hence the corresponding boot services.
Later those services should be implemented and this patch should be
drop.

Signed-off-by: Pingfan Liu <piliu at redhat.com>
Cc: Ard Biesheuvel <ardb at kernel.org>
Cc: Jan Hendrik Farr <kernel at jfarr.cc>
Cc: Philipp Rudo <prudo at redhat.com>
Cc: Lennart Poettering <mzxreary at 0pointer.de>
Cc: Jarkko Sakkinen <jarkko at kernel.org>
Cc: Baoquan He <bhe at redhat.com>
Cc: Dave Young <dyoung at redhat.com>
Cc: Mark Rutland <mark.rutland at arm.com>
Cc: Will Deacon <will at kernel.org>
Cc: Catalin Marinas <catalin.marinas at arm.com>
To: linux-arm-kernel at lists.infradead.org
To: kexec at lists.infradead.org
To: linux-efi at vger.kernel.org
---
 drivers/firmware/efi/libstub/efi-stub-helper.c | 3 +++
 drivers/firmware/efi/libstub/efi-stub.c        | 2 ++
 drivers/firmware/efi/libstub/random.c          | 2 ++
 drivers/firmware/efi/libstub/tpm.c             | 4 ++++
 4 files changed, 11 insertions(+)

diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
index de659f6a815fd..19b31a4c7fcea 100644
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -615,6 +615,9 @@ efi_status_t efi_load_initrd(efi_loaded_image_t *image,
 	efi_status_t status = EFI_SUCCESS;
 	struct linux_efi_initrd initrd, *tbl;
 
+	efi_info("cheat in efi_load_initrd()\n");
+	return EFI_SUCCESS;
+
 	if (!IS_ENABLED(CONFIG_BLK_DEV_INITRD) || efi_noinitrd)
 		return EFI_SUCCESS;
 
diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c
index 958a680e0660d..190d280e634e9 100644
--- a/drivers/firmware/efi/libstub/efi-stub.c
+++ b/drivers/firmware/efi/libstub/efi-stub.c
@@ -59,6 +59,8 @@ static struct screen_info *setup_graphics(void)
 	void **gop_handle = NULL;
 	struct screen_info *si = NULL;
 
+	efi_info("cheat in setup_graphics\n");
+	return NULL;
 	size = 0;
 	status = efi_bs_call(locate_handle, EFI_LOCATE_BY_PROTOCOL,
 			     &gop_proto, NULL, &size, gop_handle);
diff --git a/drivers/firmware/efi/libstub/random.c b/drivers/firmware/efi/libstub/random.c
index 7109b8a2dcba8..3a647fea2fdd3 100644
--- a/drivers/firmware/efi/libstub/random.c
+++ b/drivers/firmware/efi/libstub/random.c
@@ -73,6 +73,8 @@ efi_status_t efi_random_get_seed(void)
 	efi_rng_protocol_t *rng = NULL;
 	efi_status_t status;
 
+	efi_info("cheat in efi_random_get_seed\n");
+	return EFI_UNSUPPORTED;
 	status = efi_bs_call(locate_protocol, &rng_proto, NULL, (void **)&rng);
 	if (status != EFI_SUCCESS)
 		seed_size = 0;
diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c
index df3182f2e63a5..0c585466c0b85 100644
--- a/drivers/firmware/efi/libstub/tpm.c
+++ b/drivers/firmware/efi/libstub/tpm.c
@@ -33,6 +33,8 @@ void efi_enable_reset_attack_mitigation(void)
 	efi_status_t status;
 	unsigned long datasize = 0;
 
+	efi_info("cheat in efi_enable_reset_attack_mitigation\n");
+	return;
 	status = get_efi_var(efi_MemoryOverWriteRequest_name, &var_guid,
 			     NULL, &datasize, NULL);
 
@@ -155,6 +157,8 @@ void efi_retrieve_eventlog(void)
 	efi_bool_t truncated;
 	efi_status_t status;
 
+	efi_info("cheat in efi_retrieve_eventlog\n");
+	return;
 	status = efi_bs_call(locate_protocol, &tpm2_guid, NULL, (void **)&tpm2);
 	if (status == EFI_SUCCESS) {
 		status = efi_call_proto(tpm2, get_event_log, version, &log_location,
-- 
2.41.0




More information about the kexec mailing list