[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 04/21] dl: provide a fake grub_dl_set_persistent for the emu t
From: |
Sudhakar Kuppusamy |
Subject: |
[PATCH v1 04/21] dl: provide a fake grub_dl_set_persistent for the emu target |
Date: |
Wed, 18 Dec 2024 20:26:30 +0530 |
From: Daniel Axtens <dja@axtens.net>
Trying to start grub-emu with a module that calls grub_dl_set_persistent
will crash because grub-emu fakes modules and passes NULL to the module
init function.
Provide an empty function for the emu case.
Fixes: ee7808e2197c (dl: Add support for persistent modules)
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
---
include/grub/dl.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/grub/dl.h b/include/grub/dl.h
index 750fc8d3d..fb4476797 100644
--- a/include/grub/dl.h
+++ b/include/grub/dl.h
@@ -242,11 +242,22 @@ grub_dl_get (const char *name)
return 0;
}
+#ifdef GRUB_MACHINE_EMU
+/*
+ * Under grub-emu, modules are faked and NULL is passed to GRUB_MOD_INIT.
+ * So we fake this out to avoid a NULL deref.
+ */
+static inline void
+grub_dl_set_persistent (grub_dl_t mod __attribute__((unused)))
+{
+}
+#else
static inline void
grub_dl_set_persistent (grub_dl_t mod)
{
mod->persistent = 1;
}
+#endif
static inline int
grub_dl_is_persistent (grub_dl_t mod)
--
2.43.5
- [PATCH v1 00/21] Appended Signature Secure Boot Support for PowerPC, Sudhakar Kuppusamy, 2024/12/18
- [PATCH v1 01/21] powerpc-ieee1275: Add support for signing grub with an appended signature, Sudhakar Kuppusamy, 2024/12/18
- [PATCH v1 02/21] docs/grub: Document signing grub under UEFI, Sudhakar Kuppusamy, 2024/12/18
- [PATCH v1 03/21] docs/grub: Document signing grub with an appended signature, Sudhakar Kuppusamy, 2024/12/18
- [PATCH v1 04/21] dl: provide a fake grub_dl_set_persistent for the emu target,
Sudhakar Kuppusamy <=
- [PATCH v1 05/21] pgp: factor out rsa_pad, Sudhakar Kuppusamy, 2024/12/18
- [PATCH v1 06/21] crypto: move storage for grub_crypto_pk_* to crypto.c, Sudhakar Kuppusamy, 2024/12/18
- [PATCH v1 07/21] grub-install: support embedding x509 certificates, Sudhakar Kuppusamy, 2024/12/18
- [PATCH v1 09/21] appended signatures: parse PKCS#7 signedData and X.509 certificates, Sudhakar Kuppusamy, 2024/12/18
- [PATCH v1 08/21] appended signatures: import GNUTLS's ASN.1 description files, Sudhakar Kuppusamy, 2024/12/18
- [PATCH v1 14/21] ieee1275: Platform Keystore (PKS) Support, Sudhakar Kuppusamy, 2024/12/18
- [PATCH v1 15/21] ieee1275: Read the DB and DBX secure boot variables, Sudhakar Kuppusamy, 2024/12/18
- [PATCH v1 10/21] appended signatures: support verifying appended signatures, Sudhakar Kuppusamy, 2024/12/18
- [PATCH v1 12/21] appended signatures: documentation, Sudhakar Kuppusamy, 2024/12/18
- [PATCH v1 11/21] appended signatures: verification tests, Sudhakar Kuppusamy, 2024/12/18