]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
modules: Make .module_license read-only
authorPeter Jones <pjones@redhat.com>
Wed, 9 Oct 2024 08:16:36 +0000 (09:16 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 10 Oct 2024 11:15:17 +0000 (13:15 +0200)
Currently .module_license is set writable, that is, the section has the
SHF_WRITE flag set, in the module's ELF headers. This probably never
actually matters but it can't possibly be correct. The patch sets that
data as "const" which causes that flag not to be set.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Jan Setje-Eilers <jan.setjeeilers@oracle.com>
Signed-off-by: Mate Kukri <mate.kukri@canonical.com>
Reviewed-By: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
include/grub/dl.h

index cd1f46c8bada16040d27506d651134bd2279db0a..750fc8d3d8f5f507bc26f9e50ece52e8f875b79f 100644 (file)
@@ -119,7 +119,7 @@ grub_mod_fini (void)
 #define ATTRIBUTE_USED __unused__
 #endif
 #define GRUB_MOD_LICENSE(license)      \
-  static char grub_module_license[] __attribute__ ((section (GRUB_MOD_SECTION (module_license)), ATTRIBUTE_USED)) = "LICENSE=" license;
+  static const char grub_module_license[] __attribute__ ((section (GRUB_MOD_SECTION (module_license)), ATTRIBUTE_USED)) = "LICENSE=" license;
 #define GRUB_MOD_DEP(name)     \
 static const char grub_module_depend_##name[] \
  __attribute__((section(GRUB_MOD_SECTION(moddeps)), ATTRIBUTE_USED)) = #name