gentoo-overlay/sys-kernel/hardened-kernel/files/linux-5.4/9123_0123-zero-extra-regist...

27 lines
971 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Thu, 8 Feb 2018 16:49:38 +0000
Subject: [PATCH] zero extra registers
This for Zero used caller-saved general registers upon function return.
---
arch/x86/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 94df0868804b..083a97af538c 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -216,7 +216,7 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
# Avoid indirect branches in kernel to deal with Spectre
ifdef CONFIG_RETPOLINE
- KBUILD_CFLAGS += $(RETPOLINE_CFLAGS)
+ KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -mzero-caller-saved-regs=used
# Additionally, avoid generating expensive indirect jumps which
# are subject to retpolines for small number of switch cases.
# clang turns off jump table generation by default when under
--
https://clearlinux.org