From df7fcbefa71090a276fb841ffe19b8e5f12b4767 Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Tue, 4 Feb 2025 13:05:37 +0100 Subject: vdso: Add generic time data storage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Historically each architecture defined their own way to store the vDSO data page. Add a generic mechanism to provide storage for that page. Furthermore this generic storage will be extended to also provide uniform storage for *non*-time-related data, like the random state or architecture-specific data. These will have their own pages and data structures, so rename 'vdso_data' into 'vdso_time_data' to make that split clear from the name. Also introduce a new consistent naming scheme for the symbols related to the vDSO, which makes it clear if the symbol is accessible from userspace or kernel space and the type of data behind the symbol. The generic fault handler contains an optimization to prefault the vvar page when the timens page is accessed. This was lifted from s390 and x86. Co-developed-by: Nam Cao Signed-off-by: Nam Cao Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/all/20250204-vdso-store-rng-v3-5-13a4669dfc8c@linutronix.de --- include/asm-generic/vdso/vsyscall.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/asm-generic/vdso') diff --git a/include/asm-generic/vdso/vsyscall.h b/include/asm-generic/vdso/vsyscall.h index 01dafd604188..ac5b93b91993 100644 --- a/include/asm-generic/vdso/vsyscall.h +++ b/include/asm-generic/vdso/vsyscall.h @@ -4,12 +4,28 @@ #ifndef __ASSEMBLY__ +#ifdef CONFIG_GENERIC_VDSO_DATA_STORE + +#ifndef __arch_get_vdso_u_time_data +static __always_inline const struct vdso_time_data *__arch_get_vdso_u_time_data(void) +{ + return vdso_u_time_data; +} +#endif + +#else /* !CONFIG_GENERIC_VDSO_DATA_STORE */ + #ifndef __arch_get_k_vdso_data static __always_inline struct vdso_data *__arch_get_k_vdso_data(void) { return NULL; } #endif /* __arch_get_k_vdso_data */ +#define vdso_k_time_data __arch_get_k_vdso_data() + +#define __arch_get_vdso_u_time_data __arch_get_vdso_data + +#endif /* CONFIG_GENERIC_VDSO_DATA_STORE */ #ifndef __arch_update_vsyscall static __always_inline void __arch_update_vsyscall(struct vdso_data *vdata) -- cgit v1.2.3