[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 07/22] dl: provide a fake grub_dl_set_persistent for the emu t
From: |
Daniel Axtens |
Subject: |
[PATCH v2 07/22] dl: provide a fake grub_dl_set_persistent for the emu target |
Date: |
Wed, 30 Jun 2021 18:40:16 +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>
---
include/grub/dl.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/grub/dl.h b/include/grub/dl.h
index b3753c9ca262..5decbe2f2fb9 100644
--- a/include/grub/dl.h
+++ b/include/grub/dl.h
@@ -243,11 +243,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.30.2
- [PATCH v2 00/22] appended signature secure boot support, Daniel Axtens, 2021/06/30
- [PATCH v2 01/22] ieee1275: drop HEAP_MAX_ADDR, HEAP_MIN_SIZE, Daniel Axtens, 2021/06/30
- [PATCH v2 02/22] ieee1275: claim more memory, Daniel Axtens, 2021/06/30
- [PATCH v2 03/22] ieee1275: request memory with ibm, client-architecture-support, Daniel Axtens, 2021/06/30
- [PATCH v2 04/22] Add suport for signing grub with an appended signature, Daniel Axtens, 2021/06/30
- [PATCH v2 05/22] docs/grub: Document signing grub under UEFI, Daniel Axtens, 2021/06/30
- [PATCH v2 06/22] docs/grub: Document signing grub with an appended signature, Daniel Axtens, 2021/06/30
- [PATCH v2 07/22] dl: provide a fake grub_dl_set_persistent for the emu target,
Daniel Axtens <=
- [PATCH v2 08/22] pgp: factor out rsa_pad, Daniel Axtens, 2021/06/30
- [PATCH v2 09/22] crypto: move storage for grub_crypto_pk_* to crypto.c, Daniel Axtens, 2021/06/30
- [PATCH v2 10/22] posix_wrap: tweaks in preparation for libtasn1, Daniel Axtens, 2021/06/30
- [PATCH v2 11/22] libtasn1: import libtasn1-4.16.0, Daniel Axtens, 2021/06/30
- [PATCH v2 12/22] libtasn1: disable code not needed in grub, Daniel Axtens, 2021/06/30
- [PATCH v2 13/22] libtasn1: changes for grub compatibility, Daniel Axtens, 2021/06/30
- [PATCH v2 14/22] libtasn1: compile into asn1 module, Daniel Axtens, 2021/06/30
- [PATCH v2 16/22] grub-install: support embedding x509 certificates, Daniel Axtens, 2021/06/30
- [PATCH v2 15/22] test_asn1: test module for libtasn1, Daniel Axtens, 2021/06/30
- [PATCH v2 17/22] appended signatures: import GNUTLS's ASN.1 description files, Daniel Axtens, 2021/06/30