Created
August 10, 2019 01:36
-
-
Save 0x7f454c46/48cc81a0ddebaab3743d7e6d1ddf597b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From c78ddc9d6285cc751b2dfb3ec4cfdabf9c38948d Mon Sep 17 00:00:00 2001 | |
From: Dmitry Safonov <dima@arista.com> | |
Date: Sat, 10 Aug 2019 02:00:51 +0100 | |
Subject: [PATCH] rh/vz: Let it compile without CONFIG_MODULES set | |
Signed-off-by: Dmitry Safonov <dima@arista.com> | |
--- | |
arch/x86/kernel/spec_ctrl.c | 2 ++ | |
include/linux/kmod.h | 2 +- | |
include/linux/moduleloader.h | 4 ++++ | |
kernel/rh_taint.c | 2 ++ | |
4 files changed, 9 insertions(+), 1 deletion(-) | |
diff --git a/arch/x86/kernel/spec_ctrl.c b/arch/x86/kernel/spec_ctrl.c | |
index 86c756707a8d..f9bc3e80d74a 100644 | |
--- a/arch/x86/kernel/spec_ctrl.c | |
+++ b/arch/x86/kernel/spec_ctrl.c | |
@@ -457,6 +457,7 @@ bool spec_ctrl_enable_retpoline_ibrs_user(void) | |
return true; | |
} | |
+#ifdef CONFIG_MODULES | |
void spec_ctrl_report_unsafe_module(struct module *mod) | |
{ | |
if (retp_compiler() && !is_skylake_era()) | |
@@ -465,6 +466,7 @@ void spec_ctrl_report_unsafe_module(struct module *mod) | |
unsafe_module = true; | |
} | |
+#endif | |
enum spectre_v2_mitigation spec_ctrl_get_mitigation(void) | |
{ | |
diff --git a/include/linux/kmod.h b/include/linux/kmod.h | |
index cc9b9551a940..dad0bdd7dee7 100644 | |
--- a/include/linux/kmod.h | |
+++ b/include/linux/kmod.h | |
@@ -44,7 +44,7 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; | |
#define try_then_request_module(x, mod...) (x) | |
#endif | |
-#ifdef CONFIG_VE_IPTABLES | |
+#if defined(CONFIG_VE_IPTABLES) && defined(CONFIG_MODULES) | |
extern bool module_payload_allowed(const char *module); | |
#else | |
static inline bool module_payload_allowed(const char *module) { return true; } | |
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h | |
index 84057690fbfd..3cd721a9e46b 100644 | |
--- a/include/linux/moduleloader.h | |
+++ b/include/linux/moduleloader.h | |
@@ -45,7 +45,9 @@ static inline int apply_relocate(Elf_Shdr *sechdrs, | |
unsigned int relsec, | |
struct module *me) | |
{ | |
+#ifdef CONFIG_MODULES | |
printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name); | |
+#endif | |
return -ENOEXEC; | |
} | |
#endif | |
@@ -67,7 +69,9 @@ static inline int apply_relocate_add(Elf_Shdr *sechdrs, | |
unsigned int relsec, | |
struct module *me) | |
{ | |
+#ifdef CONFIG_MODULES | |
printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name); | |
+#endif | |
return -ENOEXEC; | |
} | |
#endif | |
diff --git a/kernel/rh_taint.c b/kernel/rh_taint.c | |
index 22f032431c96..41ebb6a58e15 100644 | |
--- a/kernel/rh_taint.c | |
+++ b/kernel/rh_taint.c | |
@@ -57,6 +57,7 @@ EXPORT_SYMBOL(mark_hardware_deprecated); | |
*/ | |
void mark_tech_preview(const char *msg, struct module *mod) | |
{ | |
+#ifdef CONFIG_MODULES | |
const char *str = NULL; | |
if (msg) | |
@@ -70,5 +71,6 @@ void mark_tech_preview(const char *msg, struct module *mod) | |
add_taint(TAINT_TECH_PREVIEW, LOCKDEP_STILL_OK); | |
if (mod) | |
mod->taints |= (1U << TAINT_TECH_PREVIEW); | |
+#endif | |
} | |
EXPORT_SYMBOL(mark_tech_preview); | |
-- | |
2.22.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment