| faeff8d4 | 09-Jul-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso: Automatically select HAVE_GENERIC_VDSO if necessary
gettimeofday() and getrandom() in the vDSO require the vDSO datastore.
Enable it automatically if either one of them is enabled so the arch
vdso: Automatically select HAVE_GENERIC_VDSO if necessary
gettimeofday() and getrandom() in the vDSO require the vDSO datastore.
Enable it automatically if either one of them is enabled so the architecture code doesn't need to know this.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Link: https://patch.msgid.link/20260709-vdso-have_generic_vdso-v1-4-d2e1061f268b@linutronix.de
show more ...
|
| f8b94677 | 02-Jul-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/gettimeofday: Validate system call existence for time() and gettimeofday()
Not all architectures have the system calls for time() and gettimeofday(). When the system call is missing, the vDSO f
vdso/gettimeofday: Validate system call existence for time() and gettimeofday()
Not all architectures have the system calls for time() and gettimeofday(). When the system call is missing, the vDSO function should also not be present.
Validate that.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/20260702-vdso-compat_32bit_time-v3-2-db9f36d8d432@linutronix.de
show more ...
|
| 0b50763e | 30-Jun-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/datastore: Simplify the mapping logic for VDSO_TIME_PAGE_OFFSET
The logic for CONFIG_GENERIC_GETTIMEOFDAY=n and !timens_page is identical now.
Use this to simplify the logic a bit.
Signed-off
vdso/datastore: Simplify the mapping logic for VDSO_TIME_PAGE_OFFSET
The logic for CONFIG_GENERIC_GETTIMEOFDAY=n and !timens_page is identical now.
Use this to simplify the logic a bit.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260630-vdso-mlockall-v4-6-6c93708ce723@linutronix.de
show more ...
|
| c27e727c | 30-Jun-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/datastore: Allow prefaulting by mlockall()
While mlockall() is meant to lock page *memory*, effectively it will also create and lock the corresponding page table entries. Latency-sensitive appl
vdso/datastore: Allow prefaulting by mlockall()
While mlockall() is meant to lock page *memory*, effectively it will also create and lock the corresponding page table entries. Latency-sensitive applications expect not to experience any pagefaults after calling mlockall(). However mlockall() ignores VM_IO mappings, which is used by the generic vDSO datastore. While the fault handler itself is very fast, going through the full pagefault exception handling is much slower, on the order of 20us in a test machine.
Since the memory behind the datastore mappings is always present and accessible it is not necessary to use VM_IO for them.
The data page mapping is now also aligned with the architecture-specific code pages. Some architecture-specific data pages, like the x86 VCLOCK pages, continue to use VM_IO as they are not always mappable. They will require their own special handling later when the general approach has been agreed upon.
As a side-effect this will allow GUP on these pages and allow more ways to access the data in them. This is fine, as all data in this mapping is globally visible anyways. Either because it is mapped into all tasks, or in the case of the time namespace pages, can be read from procfs.
Regular mlock() would also work, but userspace does not know the boundaries of the vDSO.
Reported-by: Nam Cao <namcao@linutronix.de> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Tested-by: Nam Cao <namcao@linutronix.de> Link: https://patch.msgid.link/20260630-vdso-mlockall-v4-5-6c93708ce723@linutronix.de
show more ...
|
| 9ab500d4 | 30-Jun-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/datastore: Explicitly prevent remote access to timens vvar page
The fault handler for the timens page does not have access to the target task and therefore can not be invoked remotely. Currentl
vdso/datastore: Explicitly prevent remote access to timens vvar page
The fault handler for the timens page does not have access to the target task and therefore can not be invoked remotely. Currently the handler relies on the fact that the vvar mapping is marked as VM_IO and VM_PFNMAP for which the mm core always prevents remote access. However the VM_IO and VM_PFNMAP flags are going to be removed.
Add an explicit check to prevent remote access to the mapping.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Tested-by: Nam Cao <namcao@linutronix.de> Link: https://patch.msgid.link/20260630-vdso-mlockall-v4-4-6c93708ce723@linutronix.de
show more ...
|
| 43648f9f | 30-Jun-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/datastore: Map zeroed pages for unavailable data
mlockall() stops if a page in a VMA is unmappable. As the datastore VMA can contain holes, mlockall() would not process all data pages.
Replace
vdso/datastore: Map zeroed pages for unavailable data
mlockall() stops if a page in a VMA is unmappable. As the datastore VMA can contain holes, mlockall() would not process all data pages.
Replace the mapping error VM_FAULT_SIGBUS by just mapping the underlying unused and zeroed-out data page. The vDSO will not access these pages in any case and for other userspace these pages have undefined contents.
This will allow mlockall() to process all pages within the VMA as soon as VM_IO is removed from the VMA.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Tested-by: Nam Cao <namcao@linutronix.de> Link: https://patch.msgid.link/20260630-vdso-mlockall-v4-3-6c93708ce723@linutronix.de
show more ...
|
| 75572734 | 30-Jun-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/datastore: Map pages in terms of the faults pgoff
To support mlockall() on the datapages the VMA can have no holes where inner pages return VM_FAULT_SIGBUS. An upcoming change will avoid these
vdso/datastore: Map pages in terms of the faults pgoff
To support mlockall() on the datapages the VMA can have no holes where inner pages return VM_FAULT_SIGBUS. An upcoming change will avoid these holes by mapping a zeroed pages into these holes. That logic will be simpler when the mapping logic is based on vmf->pgoff instead of the vdso_k_ symbols.
Switch to the equivalent vmf->pgoff logic.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Tested-by: Nam Cao <namcao@linutronix.de> Link: https://patch.msgid.link/20260630-vdso-mlockall-v4-2-6c93708ce723@linutronix.de
show more ...
|
| 5dc9cf83 | 26-Mar-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/timens: Move functions to new file
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
vdso/timens: Move functions to new file
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
show more ...
|
| 750d8cc8 | 27-Feb-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/datapage: Remove inclusion of gettimeofday.h
vdso/datapage.h is useful without pulling in the architecture-specific gettimeofday() helpers.
Move the include to the only users which needs it.
vdso/datapage: Remove inclusion of gettimeofday.h
vdso/datapage.h is useful without pulling in the architecture-specific gettimeofday() helpers.
Move the include to the only users which needs it.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://patch.msgid.link/20260227-vdso-header-cleanups-v2-12-35d60acf7410@linutronix.de
show more ...
|
| 9fc2232e | 27-Feb-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/gettimeofday: Add explicit includes
Various used symbols are only visible through transitive includes. These transitive includes are about to go away.
Explicitly include the necessary headers.
vdso/gettimeofday: Add explicit includes
Various used symbols are only visible through transitive includes. These transitive includes are about to go away.
Explicitly include the necessary headers.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://patch.msgid.link/20260227-vdso-header-cleanups-v2-10-35d60acf7410@linutronix.de
show more ...
|
| 0c02d6df | 27-Feb-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/gettimeofday: Move the unlikely() into vdso_read_retry()
All callers of vdso_read_retry() test its return value with unlikely(). Move the unlikely into the helper to make the code easier to rea
vdso/gettimeofday: Move the unlikely() into vdso_read_retry()
All callers of vdso_read_retry() test its return value with unlikely(). Move the unlikely into the helper to make the code easier to read. This is equivalent to the retry function of non-vDSO seqlocks.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://patch.msgid.link/20260227-vdso-cleanups-v1-4-c848b4bc4850@linutronix.de
show more ...
|
| a657bebd | 27-Feb-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/gettimeofday: Add a helper to test if a clock is namespaced
Currently this logic is duplicate multiple times.
Add a helper for it to make the code more readable.
[ bp: Add a missing clockso
vdso/gettimeofday: Add a helper to test if a clock is namespaced
Currently this logic is duplicate multiple times.
Add a helper for it to make the code more readable.
[ bp: Add a missing clocksource.h include, see https://lore.kernel.org/r/20260311113435-f72f81d8-33a6-4a0f-bd80-4997aad068cc@linutronix.de ]
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://patch.msgid.link/20260227-vdso-cleanups-v1-3-c848b4bc4850@linutronix.de
show more ...
|
| ed78b7b2 | 27-Feb-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/gettimeofday: Add a helper to read the sequence lock of a time namespace aware clock
Currently there are three different open-coded variants of a time namespace aware variant of vdso_read_begin
vdso/gettimeofday: Add a helper to read the sequence lock of a time namespace aware clock
Currently there are three different open-coded variants of a time namespace aware variant of vdso_read_begin(). They make the code hard to read and introduce an inconsistency, as only the first copy uses unlikely().
Split the code into a shared helper function. Move that next to the definition of the regular vdso_read_begin(), so that any future changes can be kept in sync easily.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260227-vdso-cleanups-v1-2-c848b4bc4850@linutronix.de
show more ...
|
| 05988dba | 04-Mar-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/datastore: Allocate data pages dynamically
Allocating the data pages as part of the kernel image does not work on SPARC. The MMU will raise a fault when userspace tries to access them.
Allocat
vdso/datastore: Allocate data pages dynamically
Allocating the data pages as part of the kernel image does not work on SPARC. The MMU will raise a fault when userspace tries to access them.
Allocate the data pages through the page allocator instead.
Unused pages in the vDSO VMA are still allocated to keep the virtual addresses aligned. Switch the mapping from PFNs to 'struct page' as that is required for dynamically allocated pages. This also aligns the allocation of the datapages with the code pages and is a prerequisite for mlockall() support.
VM_MIXEDMAP is necessary for the call to vmf_insert_page() in the timens prefault path to work.
The data pages need to be order-0, non-compound pages so that the mapping to userspace and the different orderings work.
These pages are also used by the timekeeping, random pool and architecture initialization code. Some of these are running before the page allocator is available. To keep these subsytems working without changes, introduce early, statically data storage which will then replaced by the real one as soon as that is available.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org> Link: https://patch.msgid.link/20260304-vdso-sparc64-generic-2-v6-3-d8eb3b0e1410@linutronix.de
show more ...
|
| c0c9439b | 04-Mar-2026 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
vdso/datastore: Drop inclusion of linux/mmap_lock.h
This header is unnecessary and together with some upcoming changes would introduce compiler warnings.
Signed-off-by: Thomas Weißschuh <thomas.wei
vdso/datastore: Drop inclusion of linux/mmap_lock.h
This header is unnecessary and together with some upcoming changes would introduce compiler warnings.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Tested-by: Andreas Larsson <andreas@gaisler.com> Reviewed-by: Andreas Larsson <andreas@gaisler.com> Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org> Link: https://lore.kernel.org/lkml/20250916-mm-rcuwait-v1-1-39a3beea6ec3@linutronix.de/ Link: https://patch.msgid.link/20260304-vdso-sparc64-generic-2-v6-2-d8eb3b0e1410@linutronix.de
show more ...
|