From: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
To: devel@openvz.org
Subject: [Devel] [PATCH RK VZ9/VZ10] kpatch: pin current livepatch module
Date: Tue, 3 Nov 2026 21:24:07 +0100 [thread overview]
Message-ID: <20261103202407.738340-1-vladimir.riabchun@virtuozzo.com> (raw)
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
next reply other threads:[~2026-11-03 20:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 20:24 Vladimir Riabchun [this message]
2026-11-03 20:29 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103202407.738340-1-vladimir.riabchun@virtuozzo.com \
--to=vladimir.riabchun@virtuozzo.com \
--cc=devel@openvz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox