Blob Blame History Raw
From 8ef16112414c6077057c50817a61b9f5e7e20e4a Mon Sep 17 00:00:00 2001
From: Miroslav Benes <mbenes@suse.cz>
Date: Thu, 21 Dec 2017 18:01:00 +0100
Subject: [PATCH] livepatch: Mark the kernel unsupported when disabling a live
 patch
Patch-mainline: Never, SLE specific
References: fate#323487

Disabling of a live patch is not supported in SUSE Linux Enterprise.

Adapted from SLE12.

Signed-off-by: Miroslav Benes <mbenes@suse.cz>
---
 kernel/livepatch/core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index de9e45dca70f..2eb849e393b5 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -278,6 +278,15 @@ static int klp_write_object_relocations(struct module *pmod,
 	return ret;
 }
 
+static void klp_taint_kernel(const struct klp_patch *patch)
+{
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
+	pr_warn("attempt to disable live patch %s, setting NO_SUPPORT taint flag\n",
+			patch->mod->name);
+	add_taint(TAINT_NO_SUPPORT, LOCKDEP_STILL_OK);
+#endif
+}
+
 static int __klp_disable_patch(struct klp_patch *patch)
 {
 	struct klp_object *obj;
@@ -293,6 +302,8 @@ static int __klp_disable_patch(struct klp_patch *patch)
 	    list_next_entry(patch, list)->enabled)
 		return -EBUSY;
 
+	klp_taint_kernel(patch);
+
 	klp_init_transition(patch, KLP_UNPATCHED);
 
 	klp_for_each_object(patch, obj)
-- 
2.15.1