All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
* [Devel] [PATCH RK VZ9/VZ10] kpatch: pin current livepatch module
@ 2026-11-03 20:24 Vladimir Riabchun
  2026-11-03 20:29 ` no-reply
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Riabchun @ 2026-11-03 20:24 UTC (permalink / raw)
  To: devel

We want to avoid module unload without disabling unpatch functionality.
Do this by grabbing one extra reference to livepatch module.

RK_BUG: VSTOR-151484
RK_CHANGELOG: Pin livepatch module to prevent unloading

Signed-off-by: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
---
 kernel/time/namespace.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c
index e85f947d4063..bf57ce079d15 100644
--- a/kernel/time/namespace.c
+++ b/kernel/time/namespace.c
@@ -485,3 +485,14 @@ struct time_namespace init_time_ns = {
 	.ns.ops		= &timens_operations,
 	.frozen_offsets	= true,
 };
+
+#include <linux/livepatch_helpers.h>
+
+static void kpatch_pin_self(struct klp_object *obj)
+{
+	struct module *mod = container_of(obj->kobj.parent, struct klp_patch, kobj)->mod;
+
+	__module_get(mod);
+	pr_warn("Livepatch module %s is pinned and cannot be unloaded\n", module_name(mod));
+}
+KLP_POST_PATCH_CALLBACK(kpatch_pin_self);
-- 
2.52.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-03 20:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 20:24 [Devel] [PATCH RK VZ9/VZ10] kpatch: pin current livepatch module Vladimir Riabchun
2026-11-03 20:29 ` no-reply

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.