summaryrefslogtreecommitdiff
path: root/lib/vdso
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>2025-02-04 13:05:39 +0100
committerThomas Gleixner <tglx@linutronix.de>2025-02-21 09:54:01 +0100
commit365841e1557ace6e8b4d5ba06a6cf53f699bc684 (patch)
treee224d903a601777f65478c93712aaade86c362ee /lib/vdso
parent51d6ca373f459fa6c91743e14ae69854d844aa38 (diff)
downloadlinux-365841e1557ace6e8b4d5ba06a6cf53f699bc684.tar.gz
linux-365841e1557ace6e8b4d5ba06a6cf53f699bc684.tar.bz2
linux-365841e1557ace6e8b4d5ba06a6cf53f699bc684.zip
vdso: Add generic architecture-specific data storage
Some architectures need to expose architecture-specific data to the vDSO. Enable the generic vDSO storage mechanism to both store and map this data. Some architectures require more than a single page, like LoongArch, so prepare for that usecase, too. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20250204-vdso-store-rng-v3-7-13a4669dfc8c@linutronix.de
Diffstat (limited to 'lib/vdso')
-rw-r--r--lib/vdso/datastore.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/vdso/datastore.c b/lib/vdso/datastore.c
index 9260b00dc852..0959d62d7858 100644
--- a/lib/vdso/datastore.c
+++ b/lib/vdso/datastore.c
@@ -26,6 +26,14 @@ struct vdso_rng_data *vdso_k_rng_data = &vdso_rng_data_store.data;
static_assert(sizeof(vdso_rng_data_store) == PAGE_SIZE);
#endif /* CONFIG_VDSO_GETRANDOM */
+#ifdef CONFIG_ARCH_HAS_VDSO_ARCH_DATA
+static union {
+ struct vdso_arch_data data;
+ u8 page[VDSO_ARCH_DATA_SIZE];
+} vdso_arch_data_store __page_aligned_data;
+struct vdso_arch_data *vdso_k_arch_data = &vdso_arch_data_store.data;
+#endif /* CONFIG_ARCH_HAS_VDSO_ARCH_DATA */
+
static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
struct vm_area_struct *vma, struct vm_fault *vmf)
{
@@ -67,6 +75,12 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
return VM_FAULT_SIGBUS;
pfn = __phys_to_pfn(__pa_symbol(vdso_k_rng_data));
break;
+ case VDSO_ARCH_PAGES_START ... VDSO_ARCH_PAGES_END:
+ if (!IS_ENABLED(CONFIG_ARCH_HAS_VDSO_ARCH_DATA))
+ return VM_FAULT_SIGBUS;
+ pfn = __phys_to_pfn(__pa_symbol(vdso_k_arch_data)) +
+ vmf->pgoff - VDSO_ARCH_PAGES_START;
+ break;
default:
return VM_FAULT_SIGBUS;
}