[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 04/19] dl: provide a fake grub_dl_set_persistent for the emu t
From: |
Daniel Axtens |
Subject: |
[PATCH v3 04/19] dl: provide a fake grub_dl_set_persistent for the emu target |
Date: |
Thu, 21 Apr 2022 17:46:59 +1000 |
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>
Reviewed-by: Stefan Berger <stefanb@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 acb4d42327d7..ff1e291243a7 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.32.0
- [PATCH v3 00/19] Appended signature secure boot support, Daniel Axtens, 2022/04/21
- [PATCH v3 01/19] Add suport for signing grub with an appended signature, Daniel Axtens, 2022/04/21
- [PATCH v3 03/19] docs/grub: Document signing grub with an appended signature, Daniel Axtens, 2022/04/21
- [PATCH v3 06/19] crypto: move storage for grub_crypto_pk_* to crypto.c, Daniel Axtens, 2022/04/21
- [PATCH v3 10/19] libtasn1: changes for grub compatibility, Daniel Axtens, 2022/04/21
- [PATCH v3 05/19] pgp: factor out rsa_pad, Daniel Axtens, 2022/04/21
- [PATCH v3 04/19] dl: provide a fake grub_dl_set_persistent for the emu target,
Daniel Axtens <=
- [PATCH v3 07/19] posix_wrap: tweaks in preparation for libtasn1, Daniel Axtens, 2022/04/21
- [PATCH v3 02/19] docs/grub: Document signing grub under UEFI, Daniel Axtens, 2022/04/21
- [PATCH v3 09/19] libtasn1: disable code not needed in grub, Daniel Axtens, 2022/04/21
- [PATCH v3 08/19] libtasn1: import libtasn1-4.18.0, Daniel Axtens, 2022/04/21
- [PATCH v3 13/19] grub-install: support embedding x509 certificates, Daniel Axtens, 2022/04/21
- [PATCH v3 12/19] test_asn1: test module for libtasn1, Daniel Axtens, 2022/04/21
- [PATCH v3 11/19] libtasn1: compile into asn1 module, Daniel Axtens, 2022/04/21
- [PATCH v3 14/19] appended signatures: import GNUTLS's ASN.1 description files, Daniel Axtens, 2022/04/21
- [PATCH v3 16/19] appended signatures: support verifying appended signatures, Daniel Axtens, 2022/04/21
- [PATCH v3 15/19] appended signatures: parse PKCS#7 signedData and X.509 certificates, Daniel Axtens, 2022/04/21