f0ad2aa
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f0ad2aa
From: Peter Jones <pjones@redhat.com>
f0ad2aa
Date: Thu, 24 Feb 2022 16:32:51 -0500
f0ad2aa
Subject: [PATCH] modules: make .module_license read-only
f0ad2aa
f0ad2aa
Currently .module_license is set writable (that is, the section has the
f0ad2aa
SHF_WRITE flag set) in the module's ELF headers.  This probably never
f0ad2aa
actually matters, but it can't possibly be correct.
f0ad2aa
f0ad2aa
This patch sets that data as "const", which causes that flag not to be
f0ad2aa
set.
f0ad2aa
f0ad2aa
Signed-off-by: Peter Jones <pjones@redhat.com>
f0ad2aa
---
f0ad2aa
 include/grub/dl.h | 2 +-
f0ad2aa
 1 file changed, 1 insertion(+), 1 deletion(-)
f0ad2aa
f0ad2aa
diff --git a/include/grub/dl.h b/include/grub/dl.h
f0ad2aa
index 20d870f2a4..618ae6f474 100644
f0ad2aa
--- a/include/grub/dl.h
f0ad2aa
+++ b/include/grub/dl.h
f0ad2aa
@@ -121,7 +121,7 @@ grub_mod_fini (void)
f0ad2aa
 #define ATTRIBUTE_USED __unused__
f0ad2aa
 #endif
f0ad2aa
 #define GRUB_MOD_LICENSE(license)	\
f0ad2aa
-  static char grub_module_license[] __attribute__ ((section (GRUB_MOD_SECTION (module_license)), ATTRIBUTE_USED)) = "LICENSE=" license;
f0ad2aa
+  static const char grub_module_license[] __attribute__ ((section (GRUB_MOD_SECTION (module_license)), ATTRIBUTE_USED)) = "LICENSE=" license;
f0ad2aa
 #define GRUB_MOD_DEP(name)	\
f0ad2aa
 static const char grub_module_depend_##name[] \
f0ad2aa
  __attribute__((section(GRUB_MOD_SECTION(moddeps)), ATTRIBUTE_USED)) = #name