nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0539-modules-make-.module_license-read-only.patch

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