From nobody Thu Apr 2 20:22:00 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F91839D6D4; Thu, 26 Mar 2026 14:49:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774536553; cv=none; b=HeM8FIpvAfWK5Df5GtvcLKU/HgPNBWWwTu9sUtHn83Z7Eta0qJnU2o8x9WuJJsHi3kaoD7o3Iu+gVgaO3/mhuDOjo5JX/u1LfLPIT63o+uVNY3I6WyfofdCgTdB78xbrZwDvqmB9g072Qjorqwtfaf35sGLJ88ayfhqF/yZ++mQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774536553; c=relaxed/simple; bh=Ney/aSMmDYrda/XwV3skWOV3D+wEq5WVjTRtebbrCzg=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=PR4O5e/Skv5br1ZEGhLu5pO6wxMFNVCg6NhNP72kLwSwxvl8t6qWL3HWgXyae36wOelg3DhB8CNQMpMDUVnJ/QZ4w/luKeQB+XuivaCAjzZnMf5g3OzInAVgd6n4B119e6YGy3i1E1c0wfQ0sunHKn1jvnMqhFYz97pTRtqSC5I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=lJ3jZAtw; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=rHpqwcwv; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="lJ3jZAtw"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="rHpqwcwv" Date: Thu, 26 Mar 2026 14:49:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1774536549; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=62W0ewF2jvyYthyw7PA9+ZlRzuHCbtIeJyoAiuI6CF4=; b=lJ3jZAtwEco3VQymdqCvvAARRCT/Kqu8NuavBxLfwjJhLyMVgSmgs8vyh1Eg8y4kdW6H5W EO7jnhrj24IsfjDRsm+rRBFWHxKmOYRbOXKvSps4A/Hi2M8W/xVyoozCQ9EWy7jvKhd3Jk D8RnBRSrzno+BxnY0UKVs/dUFpn/R+H4RfHbVEYePwWXklpCxCuauRdIUa4PhLGMoa9Kwb v4/dvoeRXWGU/g9GumJ95Taztsmmd4TJKKcErOqthgicX2HIVh+eXynUlX7LewOTZCshEK y0e4AdxR1nvSQJzyAj9NGYX3khkrqnBsFSIw8P+vO1rgGWVfuT/7NjvjeEiAGw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1774536549; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=62W0ewF2jvyYthyw7PA9+ZlRzuHCbtIeJyoAiuI6CF4=; b=rHpqwcwvEvwz/3xWYJrWPuAv+GvaIaWfOHAIsVF7Ib8Cc0MldacDNukHi9OBiCToEMD3c1 T+uZy2ygtvt4Z/Aw== From: tip-bot2 for Thomas =?utf-8?q?Wei=C3=9Fschuh?= Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/vdso] timens: Remove dependency on the vDSO Cc: thomas.weissschuh@linutronix.de, Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260326-vdso-timens-decoupling-v2-2-c82693a7775f@linutronix.de> References: <20260326-vdso-timens-decoupling-v2-2-c82693a7775f@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177453654738.1647592.11615116266394400977.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/vdso branch of tip: Commit-ID: 1b6c89285d37114d7efe8ab04102a542581cd7da Gitweb: https://git.kernel.org/tip/1b6c89285d37114d7efe8ab04102a5425= 81cd7da Author: Thomas Wei=C3=9Fschuh AuthorDate: Thu, 26 Mar 2026 12:42:31 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 26 Mar 2026 15:44:23 +01:00 timens: Remove dependency on the vDSO 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=C3=9Fschuh Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260326-vdso-timens-decoupling-v2-2-c82693a= 7775f@linutronix.de --- 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 0421bf1..c1de21a 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; @@ -38,7 +40,6 @@ static inline struct time_namespace *to_time_ns(struct ns= _common *ns) return container_of(ns, struct time_namespace, ns); } void __init time_ns_init(void); -extern void timens_commit(struct task_struct *tsk, struct time_namespace *= ns); =20 static inline struct time_namespace *get_time_ns(struct time_namespace *ns) { @@ -51,7 +52,6 @@ struct time_namespace *copy_time_ns(u64 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); =20 static inline void put_time_ns(struct time_namespace *ns) { @@ -115,11 +115,6 @@ static inline void __init time_ns_init(void) { } =20 -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; @@ -146,11 +141,6 @@ static inline void timens_on_fork(struct nsproxy *nspr= oxy, return; } =20 -static inline struct page *find_timens_vvar_page(struct vm_area_struct *vm= a) -{ - return NULL; -} - static inline void timens_add_monotonic(struct timespec64 *ts) { } static inline void timens_add_boottime(struct timespec64 *ts) { } =20 @@ -167,4 +157,18 @@ static inline ktime_t timens_ktime_to_host(clockid_t c= lockid, ktime_t tim) } #endif =20 +#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_name= space *ns) +{ +} + +static inline struct page *find_timens_vvar_page(struct vm_area_struct *vm= a) +{ + return NULL; +} +#endif /* CONFIG_TIME_NS_VDSO */ + #endif /* _LINUX_TIMENS_H */ diff --git a/init/Kconfig b/init/Kconfig index 444ce81..5e710b0 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1386,12 +1386,14 @@ config UTS_NS =20 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. =20 +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 662bccb..eaf290c 100644 --- a/kernel/time/Makefile +++ b/kernel/time/Makefile @@ -29,6 +29,7 @@ endif obj-$(CONFIG_GENERIC_GETTIMEOFDAY) +=3D vsyscall.o obj-$(CONFIG_DEBUG_FS) +=3D timekeeping_debug.o obj-$(CONFIG_TEST_UDELAY) +=3D test_udelay.o -obj-$(CONFIG_TIME_NS) +=3D namespace.o namespace_vdso.o +obj-$(CONFIG_TIME_NS) +=3D namespace.o +obj-$(CONFIG_TIME_NS_VDSO) +=3D namespace_vdso.o obj-$(CONFIG_TEST_CLOCKSOURCE_WATCHDOG) +=3D clocksource-wdtest.o obj-$(CONFIG_TIME_KUNIT_TEST) +=3D time_test.o diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c index 903f55a..42302cc 100644 --- a/kernel/time/namespace.c +++ b/kernel/time/namespace.c @@ -93,8 +93,8 @@ static struct time_namespace *clone_time_ns(struct user_n= amespace *user_ns, if (!ns) goto fail_dec; =20 - ns->vvar_page =3D alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO); - if (!ns->vvar_page) + err =3D timens_vdso_alloc_vvar_page(ns); + if (err) goto fail_free; =20 err =3D ns_common_init(ns); @@ -109,7 +109,7 @@ static struct time_namespace *clone_time_ns(struct user= _namespace *user_ns, return ns; =20 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_common_free(ns); - __free_page(ns->vvar_page); + timens_vdso_free_vvar_page(ns); /* Concurrent nstree traversal depends on a grace period. */ kfree_rcu(ns, ns.ns_rcu); } diff --git a/kernel/time/namespace_internal.h b/kernel/time/namespace_inter= nal.h index e85da11..b37ba17 100644 --- a/kernel/time/namespace_internal.h +++ b/kernel/time/namespace_internal.h @@ -4,10 +4,25 @@ =20 #include =20 +struct time_namespace; + /* * Protects possibly multiple offsets writers racing each other * and tasks entering the namespace. */ extern struct mutex timens_offset_lock; =20 +#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 0e154f9..88c075c 100644 --- a/kernel/time/namespace_vdso.c +++ b/kernel/time/namespace_vdso.c @@ -144,3 +144,17 @@ void timens_commit(struct task_struct *tsk, struct tim= e_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 =3D 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); +}