nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0235-Fix-getroot.c-s-trampolines.patch

d9d99f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d9d99f
From: Peter Jones <pjones@redhat.com>
d9d99f
Date: Fri, 28 Sep 2018 15:42:19 -0400
d9d99f
Subject: [PATCH] Fix getroot.c's trampolines.
d9d99f
d9d99f
This makes the stack executable on most of the grub utilities, which is
d9d99f
bad, and rpmdiff complains about it.
d9d99f
d9d99f
Related: rhbz#1633646
d9d99f
d9d99f
Signed-off-by: Peter Jones <pjones@redhat.com>
d9d99f
---
d9d99f
 grub-core/osdep/linux/getroot.c | 16 +++++++---------
d9d99f
 1 file changed, 7 insertions(+), 9 deletions(-)
d9d99f
d9d99f
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
b71686
index 4c5a13022..388a0f706 100644
d9d99f
--- a/grub-core/osdep/linux/getroot.c
d9d99f
+++ b/grub-core/osdep/linux/getroot.c
d9d99f
@@ -1264,22 +1264,20 @@ grub_util_get_grub_dev_os (const char *os_dev)
d9d99f
   return grub_dev;
d9d99f
 }
d9d99f
 
d9d99f
+static void *mp = NULL;
d9d99f
+static void
d9d99f
+btrfs_mount_path_hook(const char *m)
d9d99f
+{
d9d99f
+  mp = strdup (m);
d9d99f
+}
d9d99f
 
d9d99f
 char *
d9d99f
 grub_util_get_btrfs_subvol (const char *path, char **mount_path)
d9d99f
 {
d9d99f
-  char *mp = NULL;
d9d99f
-
d9d99f
   if (mount_path)
d9d99f
     *mount_path = NULL;
d9d99f
 
d9d99f
-  auto void
d9d99f
-  mount_path_hook (const char *m)
d9d99f
-  {
d9d99f
-    mp = strdup (m);
d9d99f
-  }
d9d99f
-
d9d99f
-  grub_find_root_btrfs_mount_path_hook = mount_path_hook;
d9d99f
+  grub_find_root_btrfs_mount_path_hook = btrfs_mount_path_hook;
d9d99f
   grub_free (grub_find_root_devices_from_mountinfo (path, NULL));
d9d99f
   grub_find_root_btrfs_mount_path_hook = NULL;
d9d99f