summaryrefslogtreecommitdiffstats
path: root/patches/0028-spec_ctrl-don-t-dereference-struct-module-without-CO.patch
blob: e58e28c0399f601991cca8159193902a18065866 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From e1facb105d21b58caa435cb2bdcef7f7f562eb7c Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Sun, 24 May 2020 19:44:27 -0600
Subject: [PATCH 28/32] spec_ctrl: don't dereference struct module without
 CONFIG_MODULE

This structure isn't defined for !CONFIG_MODULE, so don't try to use it.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 arch/x86/kernel/spec_ctrl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/spec_ctrl.c b/arch/x86/kernel/spec_ctrl.c
index 9b09efcb..6b302522 100644
--- a/arch/x86/kernel/spec_ctrl.c
+++ b/arch/x86/kernel/spec_ctrl.c
@@ -482,9 +482,11 @@ bool spec_ctrl_enable_retpoline_ibrs_user(void)
 
 void spec_ctrl_report_unsafe_module(struct module *mod)
 {
+#ifdef CONFIG_MODULE
 	if (retp_compiler() && !is_skylake_era())
 		pr_warn_once("WARNING: module '%s' built without retpoline-enabled compiler, may affect Spectre v2 mitigation\n",
 			     mod->name);
+#endif
 
 	unsafe_module = true;
 }
-- 
2.27.0