[Devel] [PATCH hci-8.1 v5 4/5] ms/timens: Remove dependency on the vDSO

no-reply at sashiko.virtuozzo.com no-reply at sashiko.virtuozzo.com
Wed Oct 21 07:16:02 MSK 2026


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] timens: frozen_offsets never set when TIME_NS=y and GENERIC_GETTIMEOFDAY=n
--

commit 8205eb8956867db8592649aad1330d2fd6faffba
Author: Eva Kurchatova <eva.kurchatova at virtuozzo.com>

ms/timens: Remove dependency on the vDSO

This commit drops the "depends on GENERIC_GETTIMEOFDAY" line from
TIME_NS, so time namespaces can be enabled without the generic vDSO.
It adds a TIME_NS_VDSO symbol, and the vvar page handling and
timens_commit() are compiled only when that symbol is set.

Link: https://patch.msgid.link/20260326-vdso-timens-decoupling-v2-2-c82693a7775f@linutronix.de

> diff --git a/include/linux/time_namespace.h b/include/linux/time_namespace.h
> --- a/include/linux/time_namespace.h
> +++ b/include/linux/time_namespace.h

[ ... ]

> +#ifdef CONFIG_TIME_NS_VDSO
> +extern void timens_commit(struct task_struct *tsk, struct time_namespace *ns);
> +struct page *find_timens_vvar_page(struct vm_area_struct *vma);
> +#else /* !CONFIG_TIME_NS_VDSO */
> +static inline void timens_commit(struct task_struct *tsk, struct time_namespace *ns)
> +{
> +}

[Severity: Medium]
With TIME_NS=y and GENERIC_GETTIMEOFDAY=n, this empty timens_commit()
stub is what runs when a task joins a time namespace.  The only place
that sets the freeze flag is timens_set_vvar_page() in namespace_vdso.c:

    ns->frozen_offsets = true;

That function is reached only through timens_commit(), and
namespace_vdso.c is now built only under CONFIG_TIME_NS_VDSO.

As a result, frozen_offsets stays false after tasks have joined the
namespace.  The guard in proc_timens_set_offset() in namespace.c never
triggers on these configurations:

    if (time_ns->frozen_offsets) {
        err = -EACCES;
        goto out_unlock;
    }

Can this let the monotonic and boottime offsets be rewritten through
/proc/<pid>/timens_offsets after tasks have entered the namespace?

Readers such as timens_ktime_to_host() read ns->offsets without
timens_offset_lock.  Could they then see offsets that change while tasks
are running, or torn timespec64 values?

Should the freeze be done outside the vDSO-only path, for example from
the !CONFIG_TIME_NS_VDSO timens_commit() stub?

The only follow-up patch in the series (b20653c3) just adds
CONFIG_TIME_NS_VDSO=y to config.vz10.minimal and does not change this.
The upstream commit has the same behaviour.

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261021040939.2103947-1-eva.kurchatova@virtuozzo.com?part=4



More information about the Devel mailing list