grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 07/22] dl: provide a fake grub_dl_set_persistent for the e


From: Stefan Berger
Subject: Re: [PATCH v2 07/22] dl: provide a fake grub_dl_set_persistent for the emu target
Date: Mon, 12 Jul 2021 08:48:01 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0


On 6/30/21 4:40 AM, Daniel Axtens wrote:
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 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]