Re: ntsync: absolute MONOTONIC timeout ignores time namespace offset

From: Maoyi Xie

Date: Thu May 21 2026 - 12:37:22 EST


Hi all,

Elizabeth confirmed this bug yesterday. Before I send a fix I would
like to check the export plan with the time namespace folks.

The fix calls timens_ktime_to_host(clock, timeout) on the non-REALTIME
branch in ntsync_schedule(). The helper is an inline in
<linux/time_namespace.h>. It references init_time_ns and
do_timens_ktime_to_host. Neither is exported.

All current users of the inline (timerfd, posix-timers, alarmtimer,
posix-stubs, futex, io_uring) are built-in. ntsync is tristate
(default m), so it is the first module that needs the helper.
Without the exports, modpost reports both symbols unresolved and
ntsync.ko does not load.

I was planning to send:

1/2 time/namespace: export init_time_ns and do_timens_ktime_to_host
2/2 ntsync: honour caller's time namespace for absolute MONOTONIC
timeouts

I also considered these but they look weaker:

- Flip CONFIG_NTSYNC to bool. Breaks module users.
- Add a new exported wrapper that hides init_time_ns. Cleaner
ABI but adds a helper for one caller.

If the export plan is OK I will send the series. If you prefer
something else please let me know and I will follow that.

Thanks for taking a look,
Maoyi