OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO
@ 2026-10-21  4:08 Eva Kurchatova
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 1/5] timens: make offset_lock private to namespace.c again Eva Kurchatova
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Eva Kurchatova @ 2026-10-21  4:08 UTC (permalink / raw)
  To: khorenko; +Cc: devel

Changes in v3:

- Drop offset_lock extern declaration, so that the picks apply clean.
- Mainline commits are git cherry-pick -x of mainline, with the conflict
  resolution described in a rebase note where the patch differs.
- Drop the freeze fix from the series: Low priority, the same issue
  exists in mainline, and not exploitable. Goes mainline first.
- Drop the sparc config workaround: VZKernel doesn't target sparc, will
  be fixed if ever needed by a newer kernel import.
  
Link to v2: http://lore.virtuozzo.com/kernel/20261019000649.1371025-1-eva.kurchatova@virtuozzo.com/T/#t

Link to v1: http://lore.virtuozzo.com/kernel/20261009135929.3274885-1-eva.kurchatova@virtuozzo.com/T/#t

Eva Kurchatova (5):
  timens: make offset_lock private to namespace.c again
  ms/vdso: Drop Kconfig GENERIC_VDSO_TIME_NS
  ms/vdso/timens: Move functions to new file
  ms/timens: Remove dependency on the vDSO
  config: follow the TIME_NS Kconfig change in config.vz10.minimal

 MAINTAINERS                          |   2 +
 arch/arm64/Kconfig                   |   1 -
 arch/loongarch/Kconfig               |   1 -
 arch/powerpc/Kconfig                 |   1 -
 arch/riscv/Kconfig                   |   1 -
 arch/s390/Kconfig                    |   1 -
 arch/x86/Kconfig                     |   1 -
 config.vz10.minimal                  |   2 +-
 include/linux/time_namespace.h       |  38 +++----
 init/Kconfig                         |   4 +-
 kernel/time/Makefile                 |   1 +
 kernel/time/namespace.c              | 127 ++--------------------
 kernel/time/namespace_internal.h     |  28 +++++
 kernel/time/namespace_vdso.c         | 155 +++++++++++++++++++++++++++
 lib/vdso/Kconfig                     |   6 --
 lib/vdso/datastore.c                 |  25 -----
 tools/testing/selftests/pidfd/config |   1 -
 17 files changed, 214 insertions(+), 181 deletions(-)
 create mode 100644 kernel/time/namespace_internal.h
 create mode 100644 kernel/time/namespace_vdso.c

-- 
2.56.0

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

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

* [Devel] [PATCH hci-8.1 v5 1/5] timens: make offset_lock private to namespace.c again
  2026-10-21  4:08 [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO Eva Kurchatova
@ 2026-10-21  4:08 ` Eva Kurchatova
  2026-10-21  4:13   ` no-reply
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 2/5] ms/vdso: Drop Kconfig GENERIC_VDSO_TIME_NS Eva Kurchatova
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Eva Kurchatova @ 2026-10-21  4:08 UTC (permalink / raw)
  To: khorenko; +Cc: devel

51a228b021a0 ("ve: Add interface for ve::clock_[monotonic|bootbased]
adjustment") exported the lock for the ve code, and nothing took it
up, then or since: the only users are in namespace.c. Put it back the
way mainline has it, so that the mainline changes to this file apply
as they are.

https://virtuozzo.atlassian.net/browse/VSTOR-148112
Feature: fix ms/timens

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 include/linux/time_namespace.h | 2 --
 kernel/time/namespace.c        | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/linux/time_namespace.h b/include/linux/time_namespace.h
index 3d3b529c5a98..bb2c52f4fc94 100644
--- a/include/linux/time_namespace.h
+++ b/include/linux/time_namespace.h
@@ -32,8 +32,6 @@ struct time_namespace {
 
 extern struct time_namespace init_time_ns;
 
-extern struct mutex offset_lock;
-
 #ifdef CONFIG_TIME_NS
 extern int vdso_join_timens(struct task_struct *task,
 			    struct time_namespace *ns);
diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c
index e85f947d4063..e3642278df43 100644
--- a/kernel/time/namespace.c
+++ b/kernel/time/namespace.c
@@ -214,7 +214,7 @@ struct page *find_timens_vvar_page(struct vm_area_struct *vma)
  * Protects possibly multiple offsets writers racing each other
  * and tasks entering the namespace.
  */
-DEFINE_MUTEX(offset_lock);
+static DEFINE_MUTEX(offset_lock);
 
 static void timens_set_vvar_page(struct task_struct *task,
 				struct time_namespace *ns)
-- 
2.56.0

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

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

* [Devel] [PATCH hci-8.1 v5 2/5] ms/vdso: Drop Kconfig GENERIC_VDSO_TIME_NS
  2026-10-21  4:08 [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO Eva Kurchatova
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 1/5] timens: make offset_lock private to namespace.c again Eva Kurchatova
@ 2026-10-21  4:08 ` Eva Kurchatova
  2026-10-21  4:14   ` no-reply
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 3/5] ms/vdso/timens: Move functions to new file Eva Kurchatova
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Eva Kurchatova @ 2026-10-21  4:08 UTC (permalink / raw)
  To: khorenko; +Cc: devel

All architectures implementing time-related functionality in the vDSO are
using the generic vDSO library which handles time namespaces properly.

Remove the now unnecessary Kconfig symbol.

Enables the use of time namespaces on architectures, which use the
generic vDSO but did not enable GENERIC_VDSO_TIME_NS, namely MIPS and arm.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/all/20250826-vdso-cleanups-v1-10-d9b65750e49f@linutronix.de
(cherry picked from commit bad53ae2dc4296acb8cbcee385e0238cea484100)

Rebase note: the select lines sit in other context in the six arch
Kconfigs and lib/vdso/Kconfig, and riscv's reads "if HAVE_GENERIC_VDSO"
here; the change is the same.

https://virtuozzo.atlassian.net/browse/VSTOR-148112
Feature: fix ms/timens

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 arch/arm64/Kconfig                   | 1 -
 arch/loongarch/Kconfig               | 1 -
 arch/powerpc/Kconfig                 | 1 -
 arch/riscv/Kconfig                   | 1 -
 arch/s390/Kconfig                    | 1 -
 arch/x86/Kconfig                     | 1 -
 init/Kconfig                         | 2 +-
 lib/vdso/Kconfig                     | 6 ------
 tools/testing/selftests/pidfd/config | 1 -
 9 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 49506a73e5f1..744b39ed11f2 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -164,7 +164,6 @@ config ARM64
 	select GENERIC_TIME_VSYSCALL
 	select GENERIC_GETTIMEOFDAY
 	select GENERIC_VDSO_DATA_STORE
-	select GENERIC_VDSO_TIME_NS
 	select HARDIRQS_SW_RESEND
 	select HAS_IOPORT
 	select HAVE_MOVE_PMD
diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index 45c4096955c5..eeafe6fd62c0 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -104,7 +104,6 @@ config LOONGARCH
 	select GENERIC_SMP_IDLE_THREAD
 	select GENERIC_TIME_VSYSCALL
 	select GENERIC_VDSO_DATA_STORE
-	select GENERIC_VDSO_TIME_NS
 	select GPIOLIB
 	select HAS_IOPORT
 	select HAVE_ARCH_AUDITSYSCALL
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 74884b887203..fd64957b54ab 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -213,7 +213,6 @@ config PPC
 	select GENERIC_SMP_IDLE_THREAD
 	select GENERIC_TIME_VSYSCALL
 	select GENERIC_VDSO_DATA_STORE
-	select GENERIC_VDSO_TIME_NS
 	select HAS_IOPORT			if PCI
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_HUGE_VMALLOC		if HAVE_ARCH_HUGE_VMAP
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 5c6013a34fb8..3675962b601f 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -115,7 +115,6 @@ config RISCV
 	select GENERIC_SMP_IDLE_THREAD
 	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
 	select GENERIC_VDSO_DATA_STORE if MMU
-	select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
 	select HARDIRQS_SW_RESEND
 	select HAS_IOPORT if MMU
 	select HAVE_ARCH_AUDITSYSCALL
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 44bfff6c5e88..81532dad4d36 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -153,7 +153,6 @@ config S390
 	select GENERIC_SMP_IDLE_THREAD
 	select GENERIC_TIME_VSYSCALL
 	select GENERIC_VDSO_DATA_STORE
-	select GENERIC_VDSO_TIME_NS
 	select GENERIC_IOREMAP if PCI
 	select HAVE_ALIGNED_STRUCT_PAGE
 	select HAVE_ARCH_AUDITSYSCALL
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 7bd57bc01adb..04f4bcc0d59f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -180,7 +180,6 @@ config X86
 	select GENERIC_TIME_VSYSCALL
 	select GENERIC_GETTIMEOFDAY
 	select GENERIC_VDSO_DATA_STORE
-	select GENERIC_VDSO_TIME_NS
 	select GENERIC_VDSO_OVERFLOW_PROTECT
 	select GUP_GET_PXX_LOW_HIGH		if X86_PAE
 	select HARDIRQS_SW_RESEND
diff --git a/init/Kconfig b/init/Kconfig
index a9d90db6ed36..f0ad3790a93a 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1306,7 +1306,7 @@ config UTS_NS
 
 config TIME_NS
 	bool "TIME namespace"
-	depends on GENERIC_VDSO_TIME_NS
+	depends on GENERIC_GETTIMEOFDAY
 	default y
 	help
 	  In this namespace boottime and monotonic clocks can be set.
diff --git a/lib/vdso/Kconfig b/lib/vdso/Kconfig
index 45df764b49ad..a1cc90133cb9 100644
--- a/lib/vdso/Kconfig
+++ b/lib/vdso/Kconfig
@@ -24,12 +24,6 @@ config GENERIC_COMPAT_VDSO
 	help
 	  This config option enables the compat VDSO layer.
 
-config GENERIC_VDSO_TIME_NS
-	bool
-	help
-	  Selected by architectures which support time namespaces in the
-	  VDSO
-
 config GENERIC_VDSO_OVERFLOW_PROTECT
 	bool
 	help
diff --git a/tools/testing/selftests/pidfd/config b/tools/testing/selftests/pidfd/config
index 6133524710f7..cf7cc0ce0248 100644
--- a/tools/testing/selftests/pidfd/config
+++ b/tools/testing/selftests/pidfd/config
@@ -4,6 +4,5 @@ CONFIG_USER_NS=y
 CONFIG_PID_NS=y
 CONFIG_NET_NS=y
 CONFIG_TIME_NS=y
-CONFIG_GENERIC_VDSO_TIME_NS=y
 CONFIG_CGROUPS=y
 CONFIG_CHECKPOINT_RESTORE=y
-- 
2.56.0

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

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

* [Devel] [PATCH hci-8.1 v5 3/5] ms/vdso/timens: Move functions to new file
  2026-10-21  4:08 [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO Eva Kurchatova
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 1/5] timens: make offset_lock private to namespace.c again Eva Kurchatova
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 2/5] ms/vdso: Drop Kconfig GENERIC_VDSO_TIME_NS Eva Kurchatova
@ 2026-10-21  4:08 ` Eva Kurchatova
  2026-10-21  4:15   ` no-reply
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 4/5] ms/timens: Remove dependency on the vDSO Eva Kurchatova
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Eva Kurchatova @ 2026-10-21  4:08 UTC (permalink / raw)
  To: khorenko; +Cc: devel

As a preparation of the untangling of time namespaces and the vDSO, move
the glue functions between those subsystems into a new file.

While at it, switch the mutex lock and mmap_read_lock() in the vDSO
namespace code to guard().

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260326-vdso-timens-decoupling-v2-1-c82693a7775f@linutronix.de
(cherry picked from commit 5dc9cf835aba73c882348aa4f99be83b6e45ad9b)

Rebase note: this kernel has no auxiliary clocks, so the moved
timens_set_vvar_page() has no aux_clock_data to set up; and the header
hunk sits next to to_time_ns() and time_ns_init(), which this kernel
does not have in the header.

https://virtuozzo.atlassian.net/browse/VSTOR-148112
Feature: fix ms/timens

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 MAINTAINERS                      |   2 +
 include/linux/time_namespace.h   |   8 --
 kernel/time/Makefile             |   2 +-
 kernel/time/namespace.c          | 119 +-------------------------
 kernel/time/namespace_internal.h |  13 +++
 kernel/time/namespace_vdso.c     | 141 +++++++++++++++++++++++++++++++
 lib/vdso/datastore.c             |  25 ------
 7 files changed, 161 insertions(+), 149 deletions(-)
 create mode 100644 kernel/time/namespace_internal.h
 create mode 100644 kernel/time/namespace_vdso.c

diff --git a/MAINTAINERS b/MAINTAINERS
index f0f955907fd7..0cb210fe36a0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9684,6 +9684,7 @@ S:	Maintained
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso
 F:	include/asm-generic/vdso/vsyscall.h
 F:	include/vdso/
+F:	kernel/time/namespace_vdso.c
 F:	kernel/time/vsyscall.c
 F:	lib/vdso/
 F:	tools/testing/selftests/vDSO/
@@ -18577,6 +18578,7 @@ F:	include/trace/events/timer*
 F:	kernel/time/itimer.c
 F:	kernel/time/posix-*
 F:	kernel/time/namespace.c
+F:	kernel/time/namespace_vdso.c
 
 POWER MANAGEMENT CORE
 M:	"Rafael J. Wysocki" <rafael@kernel.org>
diff --git a/include/linux/time_namespace.h b/include/linux/time_namespace.h
index bb2c52f4fc94..63d0051927f1 100644
--- a/include/linux/time_namespace.h
+++ b/include/linux/time_namespace.h
@@ -33,8 +33,6 @@ struct time_namespace {
 extern struct time_namespace init_time_ns;
 
 #ifdef CONFIG_TIME_NS
-extern int vdso_join_timens(struct task_struct *task,
-			    struct time_namespace *ns);
 extern void timens_commit(struct task_struct *tsk, struct time_namespace *ns);
 
 static inline struct time_namespace *get_time_ns(struct time_namespace *ns)
@@ -108,12 +106,6 @@ static inline ktime_t timens_ktime_to_host(clockid_t clockid, ktime_t tim)
 }
 
 #else
-static inline int vdso_join_timens(struct task_struct *task,
-				   struct time_namespace *ns)
-{
-	return 0;
-}
-
 static inline void timens_commit(struct task_struct *tsk,
 				 struct time_namespace *ns)
 {
diff --git a/kernel/time/Makefile b/kernel/time/Makefile
index fe0ae82124fe..494bd4e41781 100644
--- a/kernel/time/Makefile
+++ b/kernel/time/Makefile
@@ -23,6 +23,6 @@ endif
 obj-$(CONFIG_HAVE_GENERIC_VDSO)			+= vsyscall.o
 obj-$(CONFIG_DEBUG_FS)				+= timekeeping_debug.o
 obj-$(CONFIG_TEST_UDELAY)			+= test_udelay.o
-obj-$(CONFIG_TIME_NS)				+= namespace.o
+obj-$(CONFIG_TIME_NS)				+= namespace.o namespace_vdso.o
 obj-$(CONFIG_TEST_CLOCKSOURCE_WATCHDOG)		+= clocksource-wdtest.o
 obj-$(CONFIG_TIME_KUNIT_TEST)			+= time_test.o
diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c
index e3642278df43..c82dc9a5d1de 100644
--- a/kernel/time/namespace.c
+++ b/kernel/time/namespace.c
@@ -18,7 +18,7 @@
 #include <linux/err.h>
 #include <linux/mm.h>
 
-#include <vdso/datapage.h>
+#include "namespace_internal.h"
 
 ktime_t do_timens_ktime_to_host(clockid_t clockid, ktime_t tim,
 				struct timens_offsets *ns_offsets)
@@ -139,112 +139,7 @@ struct time_namespace *copy_time_ns(unsigned long flags,
 	return clone_time_ns(user_ns, old_ns);
 }
 
-static struct timens_offset offset_from_ts(struct timespec64 off)
-{
-	struct timens_offset ret;
-
-	ret.sec = off.tv_sec;
-	ret.nsec = off.tv_nsec;
-
-	return ret;
-}
-
-/*
- * A time namespace VVAR page has the same layout as the VVAR page which
- * contains the system wide VDSO data.
- *
- * For a normal task the VVAR pages are installed in the normal ordering:
- *     VVAR
- *     PVCLOCK
- *     HVCLOCK
- *     TIMENS   <- Not really required
- *
- * Now for a timens task the pages are installed in the following order:
- *     TIMENS
- *     PVCLOCK
- *     HVCLOCK
- *     VVAR
- *
- * The check for vdso_clock->clock_mode is in the unlikely path of
- * the seq begin magic. So for the non-timens case most of the time
- * 'seq' is even, so the branch is not taken.
- *
- * If 'seq' is odd, i.e. a concurrent update is in progress, the extra check
- * for vdso_clock->clock_mode is a non-issue. The task is spin waiting for the
- * update to finish and for 'seq' to become even anyway.
- *
- * Timens page has vdso_clock->clock_mode set to VDSO_CLOCKMODE_TIMENS which
- * enforces the time namespace handling path.
- */
-static void timens_setup_vdso_clock_data(struct vdso_clock *vc,
-					 struct time_namespace *ns)
-{
-	struct timens_offset *offset = vc->offset;
-	struct timens_offset monotonic = offset_from_ts(ns->offsets.monotonic);
-	struct timens_offset boottime = offset_from_ts(ns->offsets.boottime);
-
-	vc->seq				= 1;
-	vc->clock_mode			= VDSO_CLOCKMODE_TIMENS;
-	offset[CLOCK_MONOTONIC]		= monotonic;
-	offset[CLOCK_MONOTONIC_RAW]	= monotonic;
-	offset[CLOCK_MONOTONIC_COARSE]	= monotonic;
-	offset[CLOCK_BOOTTIME]		= boottime;
-	offset[CLOCK_BOOTTIME_ALARM]	= boottime;
-}
-
-struct page *find_timens_vvar_page(struct vm_area_struct *vma)
-{
-	if (likely(vma->vm_mm == current->mm))
-		return current->nsproxy->time_ns->vvar_page;
-
-	/*
-	 * VM_PFNMAP | VM_IO protect .fault() handler from being called
-	 * through interfaces like /proc/$pid/mem or
-	 * process_vm_{readv,writev}() as long as there's no .access()
-	 * in special_mapping_vmops().
-	 * For more details check_vma_flags() and __access_remote_vm()
-	 */
-
-	WARN(1, "vvar_page accessed remotely");
-
-	return NULL;
-}
-
-/*
- * Protects possibly multiple offsets writers racing each other
- * and tasks entering the namespace.
- */
-static DEFINE_MUTEX(offset_lock);
-
-static void timens_set_vvar_page(struct task_struct *task,
-				struct time_namespace *ns)
-{
-	struct vdso_time_data *vdata;
-	struct vdso_clock *vc;
-	unsigned int i;
-
-	if (ns == &init_time_ns)
-		return;
-
-	/* Fast-path, taken by every task in namespace except the first. */
-	if (likely(ns->frozen_offsets))
-		return;
-
-	mutex_lock(&offset_lock);
-	/* Nothing to-do: vvar_page has been already initialized. */
-	if (ns->frozen_offsets)
-		goto out;
-
-	ns->frozen_offsets = true;
-	vdata = page_address(ns->vvar_page);
-	vc = vdata->clock_data;
-
-	for (i = 0; i < CS_BASES; i++)
-		timens_setup_vdso_clock_data(&vc[i], ns);
-
-out:
-	mutex_unlock(&offset_lock);
-}
+DEFINE_MUTEX(timens_offset_lock);
 
 void free_time_ns(struct time_namespace *ns)
 {
@@ -297,12 +192,6 @@ static void timens_put(struct ns_common *ns)
 	put_time_ns(to_time_ns(ns));
 }
 
-void timens_commit(struct task_struct *tsk, struct time_namespace *ns)
-{
-	timens_set_vvar_page(tsk, ns);
-	vdso_join_timens(tsk, ns);
-}
-
 static int timens_install(struct nsset *nsset, struct ns_common *new)
 {
 	struct nsproxy *nsproxy = nsset->nsproxy;
@@ -427,7 +316,7 @@ int proc_timens_set_offset(struct file *file, struct task_struct *p,
 			goto out;
 	}
 
-	mutex_lock(&offset_lock);
+	mutex_lock(&timens_offset_lock);
 	if (time_ns->frozen_offsets) {
 		err = -EACCES;
 		goto out_unlock;
@@ -452,7 +341,7 @@ int proc_timens_set_offset(struct file *file, struct task_struct *p,
 	}
 
 out_unlock:
-	mutex_unlock(&offset_lock);
+	mutex_unlock(&timens_offset_lock);
 out:
 	put_time_ns(time_ns);
 
diff --git a/kernel/time/namespace_internal.h b/kernel/time/namespace_internal.h
new file mode 100644
index 000000000000..e85da11abb4d
--- /dev/null
+++ b/kernel/time/namespace_internal.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _TIME_NAMESPACE_INTERNAL_H
+#define _TIME_NAMESPACE_INTERNAL_H
+
+#include <linux/mutex.h>
+
+/*
+ * Protects possibly multiple offsets writers racing each other
+ * and tasks entering the namespace.
+ */
+extern struct mutex timens_offset_lock;
+
+#endif /* _TIME_NAMESPACE_INTERNAL_H */
diff --git a/kernel/time/namespace_vdso.c b/kernel/time/namespace_vdso.c
new file mode 100644
index 000000000000..558bf5208588
--- /dev/null
+++ b/kernel/time/namespace_vdso.c
@@ -0,0 +1,141 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Author: Andrei Vagin <avagin@openvz.org>
+ * Author: Dmitry Safonov <dima@arista.com>
+ */
+
+#include <linux/cleanup.h>
+#include <linux/mm.h>
+#include <linux/time_namespace.h>
+#include <linux/time.h>
+#include <linux/vdso_datastore.h>
+
+#include <vdso/clocksource.h>
+#include <vdso/datapage.h>
+
+#include "namespace_internal.h"
+
+static struct timens_offset offset_from_ts(struct timespec64 off)
+{
+	struct timens_offset ret;
+
+	ret.sec = off.tv_sec;
+	ret.nsec = off.tv_nsec;
+
+	return ret;
+}
+
+/*
+ * A time namespace VVAR page has the same layout as the VVAR page which
+ * contains the system wide VDSO data.
+ *
+ * For a normal task the VVAR pages are installed in the normal ordering:
+ *     VVAR
+ *     PVCLOCK
+ *     HVCLOCK
+ *     TIMENS   <- Not really required
+ *
+ * Now for a timens task the pages are installed in the following order:
+ *     TIMENS
+ *     PVCLOCK
+ *     HVCLOCK
+ *     VVAR
+ *
+ * The check for vdso_clock->clock_mode is in the unlikely path of
+ * the seq begin magic. So for the non-timens case most of the time
+ * 'seq' is even, so the branch is not taken.
+ *
+ * If 'seq' is odd, i.e. a concurrent update is in progress, the extra check
+ * for vdso_clock->clock_mode is a non-issue. The task is spin waiting for the
+ * update to finish and for 'seq' to become even anyway.
+ *
+ * Timens page has vdso_clock->clock_mode set to VDSO_CLOCKMODE_TIMENS which
+ * enforces the time namespace handling path.
+ */
+static void timens_setup_vdso_clock_data(struct vdso_clock *vc,
+					 struct time_namespace *ns)
+{
+	struct timens_offset *offset = vc->offset;
+	struct timens_offset monotonic = offset_from_ts(ns->offsets.monotonic);
+	struct timens_offset boottime = offset_from_ts(ns->offsets.boottime);
+
+	vc->seq				= 1;
+	vc->clock_mode			= VDSO_CLOCKMODE_TIMENS;
+	offset[CLOCK_MONOTONIC]		= monotonic;
+	offset[CLOCK_MONOTONIC_RAW]	= monotonic;
+	offset[CLOCK_MONOTONIC_COARSE]	= monotonic;
+	offset[CLOCK_BOOTTIME]		= boottime;
+	offset[CLOCK_BOOTTIME_ALARM]	= boottime;
+}
+
+struct page *find_timens_vvar_page(struct vm_area_struct *vma)
+{
+	if (likely(vma->vm_mm == current->mm))
+		return current->nsproxy->time_ns->vvar_page;
+
+	/*
+	 * VM_PFNMAP | VM_IO protect .fault() handler from being called
+	 * through interfaces like /proc/$pid/mem or
+	 * process_vm_{readv,writev}() as long as there's no .access()
+	 * in special_mapping_vmops().
+	 * For more details check_vma_flags() and __access_remote_vm()
+	 */
+
+	WARN(1, "vvar_page accessed remotely");
+
+	return NULL;
+}
+
+static void timens_set_vvar_page(struct task_struct *task,
+				struct time_namespace *ns)
+{
+	struct vdso_time_data *vdata;
+	struct vdso_clock *vc;
+	unsigned int i;
+
+	if (ns == &init_time_ns)
+		return;
+
+	/* Fast-path, taken by every task in namespace except the first. */
+	if (likely(ns->frozen_offsets))
+		return;
+
+	guard(mutex)(&timens_offset_lock);
+	/* Nothing to-do: vvar_page has been already initialized. */
+	if (ns->frozen_offsets)
+		return;
+
+	ns->frozen_offsets = true;
+	vdata = page_address(ns->vvar_page);
+	vc = vdata->clock_data;
+
+	for (i = 0; i < CS_BASES; i++)
+		timens_setup_vdso_clock_data(&vc[i], ns);
+}
+
+/*
+ * The vvar page layout depends on whether a task belongs to the root or
+ * non-root time namespace. Whenever a task changes its namespace, the VVAR
+ * page tables are cleared and then they will be re-faulted with a
+ * corresponding layout.
+ * See also the comment near timens_setup_vdso_clock_data() for details.
+ */
+static int vdso_join_timens(struct task_struct *task, struct time_namespace *ns)
+{
+	struct mm_struct *mm = task->mm;
+	struct vm_area_struct *vma;
+	VMA_ITERATOR(vmi, mm, 0);
+
+	guard(mmap_read_lock)(mm);
+	for_each_vma(vmi, vma) {
+		if (vma_is_special_mapping(vma, &vdso_vvar_mapping))
+			zap_vma_pages(vma);
+	}
+	return 0;
+}
+
+void timens_commit(struct task_struct *tsk, struct time_namespace *ns)
+{
+	timens_set_vvar_page(tsk, ns);
+	vdso_join_timens(tsk, ns);
+}
diff --git a/lib/vdso/datastore.c b/lib/vdso/datastore.c
index 46192c1d8542..7713fd392dd0 100644
--- a/lib/vdso/datastore.c
+++ b/lib/vdso/datastore.c
@@ -102,28 +102,3 @@ struct vm_area_struct *vdso_install_vvar_mapping(struct mm_struct *mm, unsigned
 					VM_READ | VM_MAYREAD | VM_IO | VM_DONTDUMP | VM_PFNMAP,
 					&vdso_vvar_mapping);
 }
-
-#ifdef CONFIG_TIME_NS
-/*
- * The vvar page layout depends on whether a task belongs to the root or
- * non-root time namespace. Whenever a task changes its namespace, the VVAR
- * page tables are cleared and then they will be re-faulted with a
- * corresponding layout.
- * See also the comment near timens_setup_vdso_clock_data() for details.
- */
-int vdso_join_timens(struct task_struct *task, struct time_namespace *ns)
-{
-	struct mm_struct *mm = task->mm;
-	struct vm_area_struct *vma;
-	VMA_ITERATOR(vmi, mm, 0);
-
-	mmap_read_lock(mm);
-	for_each_vma(vmi, vma) {
-		if (vma_is_special_mapping(vma, &vdso_vvar_mapping))
-			zap_vma_pages(vma);
-	}
-	mmap_read_unlock(mm);
-
-	return 0;
-}
-#endif
-- 
2.56.0

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

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

* [Devel] [PATCH hci-8.1 v5 4/5] ms/timens: Remove dependency on the vDSO
  2026-10-21  4:08 [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO Eva Kurchatova
                   ` (2 preceding siblings ...)
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 3/5] ms/vdso/timens: Move functions to new file Eva Kurchatova
@ 2026-10-21  4:08 ` Eva Kurchatova
  2026-10-21  4:16   ` no-reply
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 5/5] config: follow the TIME_NS Kconfig change in config.vz10.minimal Eva Kurchatova
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Eva Kurchatova @ 2026-10-21  4:08 UTC (permalink / raw)
  To: khorenko; +Cc: devel

Previously, missing time namespace support in the vDSO meant that time
namespaces needed to be disabled globally. This was expressed in a hard
dependency on the generic vDSO library. This also meant that architectures
without any vDSO or only a stub vDSO could not enable time namespaces.
Now that all architectures using a real vDSO are using the generic library,
that dependency is not necessary anymore.

Remove the dependency and let all architectures enable time namespaces.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260326-vdso-timens-decoupling-v2-2-c82693a7775f@linutronix.de
(cherry picked from commit 1b6c89285d37114d7efe8ab04102a542581cd7da)

Rebase note: context only. This kernel keeps the refcount_t namespace
count, ns_free_inum() and kfree(), and has no to_time_ns() or
time_ns_init() in the header; the change is the same.

https://virtuozzo.atlassian.net/browse/VSTOR-148112
Feature: fix ms/timens

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Reviewed-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 include/linux/time_namespace.h   | 28 ++++++++++++++++------------
 init/Kconfig                     |  4 +++-
 kernel/time/Makefile             |  3 ++-
 kernel/time/namespace.c          |  8 ++++----
 kernel/time/namespace_internal.h | 15 +++++++++++++++
 kernel/time/namespace_vdso.c     | 14 ++++++++++++++
 6 files changed, 54 insertions(+), 18 deletions(-)

diff --git a/include/linux/time_namespace.h b/include/linux/time_namespace.h
index 63d0051927f1..1c8052e5da14 100644
--- a/include/linux/time_namespace.h
+++ b/include/linux/time_namespace.h
@@ -25,7 +25,9 @@ struct time_namespace {
 	struct ucounts		*ucounts;
 	struct ns_common	ns;
 	struct timens_offsets	offsets;
+#ifdef CONFIG_TIME_NS_VDSO
 	struct page		*vvar_page;
+#endif
 	/* If set prevents changing offsets after any task joined namespace. */
 	bool			frozen_offsets;
 } __randomize_layout;
@@ -33,7 +35,6 @@ struct time_namespace {
 extern struct time_namespace init_time_ns;
 
 #ifdef CONFIG_TIME_NS
-extern void timens_commit(struct task_struct *tsk, struct time_namespace *ns);
 
 static inline struct time_namespace *get_time_ns(struct time_namespace *ns)
 {
@@ -46,7 +47,6 @@ struct time_namespace *copy_time_ns(unsigned long flags,
 				    struct time_namespace *old_ns);
 void free_time_ns(struct time_namespace *ns);
 void timens_on_fork(struct nsproxy *nsproxy, struct task_struct *tsk);
-struct page *find_timens_vvar_page(struct vm_area_struct *vma);
 
 static inline void put_time_ns(struct time_namespace *ns)
 {
@@ -106,11 +106,6 @@ static inline ktime_t timens_ktime_to_host(clockid_t clockid, ktime_t tim)
 }
 
 #else
-static inline void timens_commit(struct task_struct *tsk,
-				 struct time_namespace *ns)
-{
-}
-
 static inline struct time_namespace *get_time_ns(struct time_namespace *ns)
 {
 	return NULL;
@@ -137,11 +132,6 @@ static inline void timens_on_fork(struct nsproxy *nsproxy,
 	return;
 }
 
-static inline struct page *find_timens_vvar_page(struct vm_area_struct *vma)
-{
-	return NULL;
-}
-
 static inline void timens_add_monotonic(struct timespec64 *ts) { }
 static inline void timens_add_boottime(struct timespec64 *ts) { }
 
@@ -158,4 +148,18 @@ static inline ktime_t timens_ktime_to_host(clockid_t clockid, ktime_t tim)
 }
 #endif
 
+#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)
+{
+}
+
+static inline struct page *find_timens_vvar_page(struct vm_area_struct *vma)
+{
+	return NULL;
+}
+#endif /* CONFIG_TIME_NS_VDSO */
+
 #endif /* _LINUX_TIMENS_H */
diff --git a/init/Kconfig b/init/Kconfig
index f0ad3790a93a..44b2d4426109 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1306,12 +1306,14 @@ config UTS_NS
 
 config TIME_NS
 	bool "TIME namespace"
-	depends on GENERIC_GETTIMEOFDAY
 	default y
 	help
 	  In this namespace boottime and monotonic clocks can be set.
 	  The time will keep going with the same pace.
 
+config TIME_NS_VDSO
+	def_bool TIME_NS && GENERIC_GETTIMEOFDAY
+
 config IPC_NS
 	bool "IPC namespace"
 	depends on (SYSVIPC || POSIX_MQUEUE)
diff --git a/kernel/time/Makefile b/kernel/time/Makefile
index 494bd4e41781..dd3ea6997064 100644
--- a/kernel/time/Makefile
+++ b/kernel/time/Makefile
@@ -23,6 +23,7 @@ endif
 obj-$(CONFIG_HAVE_GENERIC_VDSO)			+= vsyscall.o
 obj-$(CONFIG_DEBUG_FS)				+= timekeeping_debug.o
 obj-$(CONFIG_TEST_UDELAY)			+= test_udelay.o
-obj-$(CONFIG_TIME_NS)				+= namespace.o namespace_vdso.o
+obj-$(CONFIG_TIME_NS)				+= namespace.o
+obj-$(CONFIG_TIME_NS_VDSO)			+= namespace_vdso.o
 obj-$(CONFIG_TEST_CLOCKSOURCE_WATCHDOG)		+= clocksource-wdtest.o
 obj-$(CONFIG_TIME_KUNIT_TEST)			+= time_test.o
diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c
index c82dc9a5d1de..cf95f9e0ad94 100644
--- a/kernel/time/namespace.c
+++ b/kernel/time/namespace.c
@@ -94,8 +94,8 @@ static struct time_namespace *clone_time_ns(struct user_namespace *user_ns,
 
 	refcount_set(&ns->ns.count, 1);
 
-	ns->vvar_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
-	if (!ns->vvar_page)
+	err = timens_vdso_alloc_vvar_page(ns);
+	if (err)
 		goto fail_free;
 
 	err = ns_alloc_inum(&ns->ns);
@@ -110,7 +110,7 @@ static struct time_namespace *clone_time_ns(struct user_namespace *user_ns,
 	return ns;
 
 fail_free_page:
-	__free_page(ns->vvar_page);
+	timens_vdso_free_vvar_page(ns);
 fail_free:
 	kfree(ns);
 fail_dec:
@@ -146,7 +146,7 @@ void free_time_ns(struct time_namespace *ns)
 	dec_time_namespaces(ns->ucounts);
 	put_user_ns(ns->user_ns);
 	ns_free_inum(&ns->ns);
-	__free_page(ns->vvar_page);
+	timens_vdso_free_vvar_page(ns);
 	kfree(ns);
 }
 
diff --git a/kernel/time/namespace_internal.h b/kernel/time/namespace_internal.h
index e85da11abb4d..b37ba179f43b 100644
--- a/kernel/time/namespace_internal.h
+++ b/kernel/time/namespace_internal.h
@@ -4,10 +4,25 @@
 
 #include <linux/mutex.h>
 
+struct time_namespace;
+
 /*
  * Protects possibly multiple offsets writers racing each other
  * and tasks entering the namespace.
  */
 extern struct mutex timens_offset_lock;
 
+#ifdef CONFIG_TIME_NS_VDSO
+int timens_vdso_alloc_vvar_page(struct time_namespace *ns);
+void timens_vdso_free_vvar_page(struct time_namespace *ns);
+#else /* !CONFIG_TIME_NS_VDSO */
+static inline int timens_vdso_alloc_vvar_page(struct time_namespace *ns)
+{
+	return 0;
+}
+static inline void timens_vdso_free_vvar_page(struct time_namespace *ns)
+{
+}
+#endif /* CONFIG_TIME_NS_VDSO */
+
 #endif /* _TIME_NAMESPACE_INTERNAL_H */
diff --git a/kernel/time/namespace_vdso.c b/kernel/time/namespace_vdso.c
index 558bf5208588..08d69270eb2c 100644
--- a/kernel/time/namespace_vdso.c
+++ b/kernel/time/namespace_vdso.c
@@ -139,3 +139,17 @@ void timens_commit(struct task_struct *tsk, struct time_namespace *ns)
 	timens_set_vvar_page(tsk, ns);
 	vdso_join_timens(tsk, ns);
 }
+
+int timens_vdso_alloc_vvar_page(struct time_namespace *ns)
+{
+	ns->vvar_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
+	if (!ns->vvar_page)
+		return -ENOMEM;
+
+	return 0;
+}
+
+void timens_vdso_free_vvar_page(struct time_namespace *ns)
+{
+	__free_page(ns->vvar_page);
+}
-- 
2.56.0

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

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

* [Devel] [PATCH hci-8.1 v5 5/5] config: follow the TIME_NS Kconfig change in config.vz10.minimal
  2026-10-21  4:08 [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO Eva Kurchatova
                   ` (3 preceding siblings ...)
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 4/5] ms/timens: Remove dependency on the vDSO Eva Kurchatova
@ 2026-10-21  4:08 ` Eva Kurchatova
  2026-10-21  4:16   ` no-reply
  2026-10-21  4:19 ` [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO Eva Kurchatova (Virtuozzo)
  2026-10-21 12:29 ` Konstantin Khorenko
  6 siblings, 1 reply; 15+ messages in thread
From: Eva Kurchatova @ 2026-10-21  4:08 UTC (permalink / raw)
  To: khorenko; +Cc: devel

The symbol went with "ms/vdso: Drop Kconfig GENERIC_VDSO_TIME_NS" and
TIME_NS_VDSO came in its place, derived from TIME_NS as the file's other
derived symbols are; olddefconfig makes the same change. The x86_64
configs under configs/ keep their line: they are RHEL's and come back
with every import.

https://virtuozzo.atlassian.net/browse/VSTOR-148112
Feature: fix ms/timens

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 config.vz10.minimal | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.vz10.minimal b/config.vz10.minimal
index 03f2fb662498..d5ac8ba4569c 100644
--- a/config.vz10.minimal
+++ b/config.vz10.minimal
@@ -239,6 +239,7 @@ CONFIG_SOCK_CGROUP_DATA=y
 CONFIG_NAMESPACES=y
 CONFIG_UTS_NS=y
 CONFIG_TIME_NS=y
+CONFIG_TIME_NS_VDSO=y
 CONFIG_IPC_NS=y
 CONFIG_USER_NS=y
 CONFIG_PID_NS=y
@@ -5880,7 +5881,6 @@ CONFIG_OID_REGISTRY=y
 CONFIG_UCS2_STRING=y
 CONFIG_HAVE_GENERIC_VDSO=y
 CONFIG_GENERIC_GETTIMEOFDAY=y
-CONFIG_GENERIC_VDSO_TIME_NS=y
 CONFIG_GENERIC_VDSO_OVERFLOW_PROTECT=y
 CONFIG_VDSO_GETRANDOM=y
 CONFIG_FONT_SUPPORT=y
-- 
2.56.0

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

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

* Re: [Devel] [PATCH hci-8.1 v5 1/5] timens: make offset_lock private to namespace.c again
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 1/5] timens: make offset_lock private to namespace.c again Eva Kurchatova
@ 2026-10-21  4:13   ` no-reply
  0 siblings, 0 replies; 15+ messages in thread
From: no-reply @ 2026-10-21  4:13 UTC (permalink / raw)
  To: khorenko, Eva Kurchatova; +Cc: devel

> 51a228b021a0 ("ve: Add interface for ve::clock_[monotonic|bootbased]
> adjustment") exported the lock for the ve code, and nothing took it
> up, then or since: the only users are in namespace.c. Put it back the
> way mainline has it, so that the mainline changes to this file apply
> as they are.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-148112
> Feature: fix ms/timens
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues. It looks great!

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


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

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

* Re: [Devel] [PATCH hci-8.1 v5 2/5] ms/vdso: Drop Kconfig GENERIC_VDSO_TIME_NS
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 2/5] ms/vdso: Drop Kconfig GENERIC_VDSO_TIME_NS Eva Kurchatova
@ 2026-10-21  4:14   ` no-reply
  2026-10-21  4:26     ` Eva Kurchatova (Virtuozzo)
  0 siblings, 1 reply; 15+ messages in thread
From: no-reply @ 2026-10-21  4:14 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko; +Cc: devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] kconfig: stale CONFIG_GENERIC_VDSO_TIME_NS in shipped x86_64 configs
--

commit e601305998d6e60d88bb518baa79a61ef65b0de3
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

ms/vdso: Drop Kconfig GENERIC_VDSO_TIME_NS

This backport removes the GENERIC_VDSO_TIME_NS Kconfig symbol. It drops
the selects from the arm64, loongarch, powerpc, riscv, s390 and x86
Kconfigs. TIME_NS now depends on GENERIC_GETTIMEOFDAY, and the symbol is
also removed from the pidfd selftest config.

Link: https://lore.kernel.org/all/20250826-vdso-cleanups-v1-10-d9b65750e49f@linutronix.de

> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 7bd57bc01adbe..04f4bcc0d59fc 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -180,7 +180,6 @@ config X86
>  	select GENERIC_TIME_VSYSCALL
>  	select GENERIC_GETTIMEOFDAY
>  	select GENERIC_VDSO_DATA_STORE
> -	select GENERIC_VDSO_TIME_NS
>  	select GENERIC_VDSO_OVERFLOW_PROTECT
>  	select GUP_GET_PXX_LOW_HIGH		if X86_PAE

[ ... ]

> diff --git a/lib/vdso/Kconfig b/lib/vdso/Kconfig
> index 45df764b49ad6..a1cc90133cb9e 100644
> --- a/lib/vdso/Kconfig
> +++ b/lib/vdso/Kconfig
> @@ -24,12 +24,6 @@ config GENERIC_COMPAT_VDSO
>  	help
>  	  This config option enables the compat VDSO layer.
>  
> -config GENERIC_VDSO_TIME_NS
> -	bool
> -	help
> -	  Selected by architectures which support time namespaces in the
> -	  VDSO
> -
>  config GENERIC_VDSO_OVERFLOW_PROTECT
>  	bool
>  	help

[Severity: Low]
Is it intentional that the shipped x86_64 configs still set the symbol
this patch deletes?

configs/kernel-6.12.0-x86_64.config and
configs/kernel-6.12.0-x86_64-debug.config both still contain:

CONFIG_GENERIC_VDSO_TIME_NS=y

Patch 5/5 of the series updates config.vz10.minimal. It removes the line
and adds CONFIG_TIME_NS_VDSO. At the series end commit b20653c3, git grep
still finds CONFIG_GENERIC_VDSO_TIME_NS=y in the two files above.

Running make olddefconfig on them will drop the symbol silently, and a
savedefconfig or config-consistency diff will show drift. The compiled
kernel should not change, since CONFIG_TIME_NS and
CONFIG_GENERIC_GETTIMEOFDAY stay enabled on x86.

Should these two files be updated together with this change?

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

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

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

* Re: [Devel] [PATCH hci-8.1 v5 3/5] ms/vdso/timens: Move functions to new file
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 3/5] ms/vdso/timens: Move functions to new file Eva Kurchatova
@ 2026-10-21  4:15   ` no-reply
  0 siblings, 0 replies; 15+ messages in thread
From: no-reply @ 2026-10-21  4:15 UTC (permalink / raw)
  To: khorenko, Eva Kurchatova; +Cc: devel

> As a preparation of the untangling of time namespaces and the vDSO, move
> the glue functions between those subsystems into a new file.
> 
> While at it, switch the mutex lock and mmap_read_lock() in the vDSO
> namespace code to guard().
> 
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> Link: https://patch.msgid.link/20260326-vdso-timens-decoupling-v2-1-c82693a7775f@linutronix.de
> (cherry picked from commit 5dc9cf835aba73c882348aa4f99be83b6e45ad9b)
> 
> Rebase note: this kernel has no auxiliary clocks, so the moved
> timens_set_vvar_page() has no aux_clock_data to set up; and the header
> hunk sits next to to_time_ns() and time_ns_init(), which this kernel
> does not have in the header.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-148112
> Feature: fix ms/timens
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues. It looks great!

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


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

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

* Re: [Devel] [PATCH hci-8.1 v5 4/5] ms/timens: Remove dependency on the vDSO
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 4/5] ms/timens: Remove dependency on the vDSO Eva Kurchatova
@ 2026-10-21  4:16   ` no-reply
  2026-10-21  4:24     ` Eva Kurchatova (Virtuozzo)
  0 siblings, 1 reply; 15+ messages in thread
From: no-reply @ 2026-10-21  4:16 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko; +Cc: devel

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@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

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

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

* Re: [Devel] [PATCH hci-8.1 v5 5/5] config: follow the TIME_NS Kconfig change in config.vz10.minimal
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 5/5] config: follow the TIME_NS Kconfig change in config.vz10.minimal Eva Kurchatova
@ 2026-10-21  4:16   ` no-reply
  0 siblings, 0 replies; 15+ messages in thread
From: no-reply @ 2026-10-21  4:16 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko; +Cc: devel

> The symbol went with "ms/vdso: Drop Kconfig GENERIC_VDSO_TIME_NS" and
> TIME_NS_VDSO came in its place, derived from TIME_NS as the file's other
> derived symbols are; olddefconfig makes the same change. The x86_64
> configs under configs/ keep their line: they are RHEL's and come back
> with every import.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-148112
> Feature: fix ms/timens
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues. It looks great!

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


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

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

* Re: [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO
  2026-10-21  4:08 [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO Eva Kurchatova
                   ` (4 preceding siblings ...)
  2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 5/5] config: follow the TIME_NS Kconfig change in config.vz10.minimal Eva Kurchatova
@ 2026-10-21  4:19 ` Eva Kurchatova (Virtuozzo)
  2026-10-21 12:29 ` Konstantin Khorenko
  6 siblings, 0 replies; 15+ messages in thread
From: Eva Kurchatova (Virtuozzo) @ 2026-10-21  4:19 UTC (permalink / raw)
  To: devel


On 10/21/26 07:08, Eva Kurchatova wrote:
> Changes in v3:
>
Oops. Accidentally messed up the subject, instead picking 5 patches 
wrote "v5".

Can re-send with corrected subject if needed.

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

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

* Re: [Devel] [PATCH hci-8.1 v5 4/5] ms/timens: Remove dependency on the vDSO
  2026-10-21  4:16   ` no-reply
@ 2026-10-21  4:24     ` Eva Kurchatova (Virtuozzo)
  0 siblings, 0 replies; 15+ messages in thread
From: Eva Kurchatova (Virtuozzo) @ 2026-10-21  4:24 UTC (permalink / raw)
  To: no-reply, khorenko; +Cc: devel


On 10/21/26 07:16, no-reply@sashiko.virtuozzo.com wrote:
> 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
> --
>
This is indeed the same issue as confirmed in mainline, and dropped

from the previous v2 patchset to merge a fix into mainline first.

This will be a separate task:

https://virtuozzo.atlassian.net/browse/VSTOR-151072


Not critical temporarily as this is not exploitable and same behavior as 
mainline.

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

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

* Re: [Devel] [PATCH hci-8.1 v5 2/5] ms/vdso: Drop Kconfig GENERIC_VDSO_TIME_NS
  2026-10-21  4:14   ` no-reply
@ 2026-10-21  4:26     ` Eva Kurchatova (Virtuozzo)
  0 siblings, 0 replies; 15+ messages in thread
From: Eva Kurchatova (Virtuozzo) @ 2026-10-21  4:26 UTC (permalink / raw)
  To: no-reply, khorenko; +Cc: devel


On 10/21/26 07:14, no-reply@sashiko.virtuozzo.com wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] kconfig: stale CONFIG_GENERIC_VDSO_TIME_NS in shipped x86_64 configs
> --
>
This is a RHEL config import; Not used for production kernel builds AFAIK.

Can be deleted, but that seems unused, and the patch is mostly a 
verbatim cherry-pick.

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

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

* Re: [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO
  2026-10-21  4:08 [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO Eva Kurchatova
                   ` (5 preceding siblings ...)
  2026-10-21  4:19 ` [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO Eva Kurchatova (Virtuozzo)
@ 2026-10-21 12:29 ` Konstantin Khorenko
  6 siblings, 0 replies; 15+ messages in thread
From: Konstantin Khorenko @ 2026-10-21 12:29 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

On Wed, 21 Oct 2026 07:08:38 +0300, Eva Kurchatova wrote:
> timens: Remove dependency on the vDSO
> 
> Changes in v3:
> 
> - Drop offset_lock extern declaration, so that the picks apply clean.
> - Mainline commits are git cherry-pick -x of mainline, with the conflict
>   resolution described in a rebase note where the patch differs.
> - Drop the freeze fix from the series: Low priority, the same issue
>   exists in mainline, and not exploitable. Goes mainline first.
> - Drop the sparc config workaround: VZKernel doesn't target sparc, will
>   be fixed if ever needed by a newer kernel import.
> 
> [...]

Applied to branch-rh10-6.12.0-211.52.1.22.x.vz10-ovz, will be released in rh10-6.12.0-211.52.1.22.10.vz10, thanks!

[1/5] timens: make offset_lock private to namespace.c again
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/98266536a254
[2/5] ms/vdso: Drop Kconfig GENERIC_VDSO_TIME_NS
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/6ed58327d564
[3/5] ms/vdso/timens: Move functions to new file
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/e2f86f24078e
[4/5] ms/timens: Remove dependency on the vDSO
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/b48b95f76e05
[5/5] config: follow the TIME_NS Kconfig change in config.vz10.minimal
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/4cef333389a9

-- 
Konstantin Khorenko <khorenko@virtuozzo.com>

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

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

end of thread, other threads:[~2026-10-21 12:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21  4:08 [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO Eva Kurchatova
2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 1/5] timens: make offset_lock private to namespace.c again Eva Kurchatova
2026-10-21  4:13   ` no-reply
2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 2/5] ms/vdso: Drop Kconfig GENERIC_VDSO_TIME_NS Eva Kurchatova
2026-10-21  4:14   ` no-reply
2026-10-21  4:26     ` Eva Kurchatova (Virtuozzo)
2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 3/5] ms/vdso/timens: Move functions to new file Eva Kurchatova
2026-10-21  4:15   ` no-reply
2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 4/5] ms/timens: Remove dependency on the vDSO Eva Kurchatova
2026-10-21  4:16   ` no-reply
2026-10-21  4:24     ` Eva Kurchatova (Virtuozzo)
2026-10-21  4:08 ` [Devel] [PATCH hci-8.1 v5 5/5] config: follow the TIME_NS Kconfig change in config.vz10.minimal Eva Kurchatova
2026-10-21  4:16   ` no-reply
2026-10-21  4:19 ` [Devel] [PATCH hci-8.1 v5 0/5] timens: Remove dependency on the vDSO Eva Kurchatova (Virtuozzo)
2026-10-21 12:29 ` Konstantin Khorenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox