5593c8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
5593c8
From: Peter Jones <pjones@redhat.com>
5593c8
Date: Fri, 12 Jul 2019 10:06:50 +0200
5593c8
Subject: [PATCH] Do not allow stack trampolines, anywhere.
5593c8
5593c8
Signed-off-by: Peter Jones <pjones@redhat.com>
5593c8
---
5593c8
 configure.ac         | 3 +++
5593c8
 conf/Makefile.common | 2 +-
5593c8
 2 files changed, 4 insertions(+), 1 deletion(-)
5593c8
5593c8
diff --git a/configure.ac b/configure.ac
fd0330
index 490353713a..a02d40a05b 100644
5593c8
--- a/configure.ac
5593c8
+++ b/configure.ac
fd0330
@@ -1998,6 +1998,9 @@ if test x"$enable_wextra" != xno ; then
5593c8
   HOST_CFLAGS="$HOST_CFLAGS -Wextra"
5593c8
 fi
5593c8
 
5593c8
+TARGET_CFLAGS="$TARGET_CFLAGS -Werror=trampolines -fno-trampolines"
5593c8
+HOST_CFLAGS="$HOST_CFLAGS -Werror=trampolines -fno-trampolines"
5593c8
+
5593c8
 TARGET_CPP="$TARGET_CC -E"
5593c8
 TARGET_CCAS=$TARGET_CC
5593c8
 
5593c8
diff --git a/conf/Makefile.common b/conf/Makefile.common
fd0330
index 35e14ff017..0647c53b91 100644
5593c8
--- a/conf/Makefile.common
5593c8
+++ b/conf/Makefile.common
5593c8
@@ -66,7 +66,7 @@ grubconfdir = $(sysconfdir)/grub.d
5593c8
 platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
5593c8
 starfielddir = $(pkgdatadir)/themes/starfield
5593c8
 
5593c8
-CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code
5593c8
+CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Werror=trampolines -fno-trampolines
5593c8
 CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib -I$(top_srcdir)/grub-core/lib/gnulib
5593c8
 
5593c8
 CFLAGS_POSIX = -fno-builtin