[PATCH 1/2] time/namespace: export init_time_ns and do_timens_ktime_to_host
From: Maoyi Xie
Date: Thu May 28 2026 - 02:37:10 EST
The inline timens_ktime_to_host() in <linux/time_namespace.h> compares
the current time namespace against init_time_ns for the fast path. It
calls do_timens_ktime_to_host() for the offset case. Both symbols are
needed at link time by any caller of the inline.
All current callers are in the kernel itself (timerfd, posix-timers,
alarmtimer, posix-stubs, futex, io_uring). The next caller is a module
(ntsync), which fails to load because neither symbol is exported.
Export both with EXPORT_SYMBOL_GPL. The header already declares
init_time_ns extern, so this only makes the symbols linkable from
modules.
Signed-off-by: Maoyi Xie <maoyixie.tju@xxxxxxxxx>
---
kernel/time/namespace.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c
index 4bca3f78c8ea..5fa0af66cf3f 100644
--- a/kernel/time/namespace.c
+++ b/kernel/time/namespace.c
@@ -57,6 +57,7 @@ ktime_t do_timens_ktime_to_host(clockid_t clockid, ktime_t tim,
return tim;
}
+EXPORT_SYMBOL_GPL(do_timens_ktime_to_host);
static struct ucounts *inc_time_namespaces(struct user_namespace *ns)
{
@@ -351,6 +352,7 @@ struct time_namespace init_time_ns = {
.user_ns = &init_user_ns,
.frozen_offsets = true,
};
+EXPORT_SYMBOL_GPL(init_time_ns);
void __init time_ns_init(void)
{
--
2.34.1