linux/arch/x86/entry/vdso
Dmitry Safonov 550a77a74c x86/vdso: Add time napespace page
To support time namespaces in the VDSO with a minimal impact on regular non
time namespace affected tasks, the namespace handling needs to be hidden in
a slow path.

The most obvious place is vdso_seq_begin(). If a task belongs to a time
namespace then the VVAR page which contains the system wide VDSO data is
replaced with a namespace specific page which has the same layout as the
VVAR page. That page has vdso_data->seq set to 1 to enforce the slow path
and vdso_data->clock_mode set to VCLOCK_TIMENS to enforce the time
namespace handling path.

The extra check in the case that vdso_data->seq is odd, e.g. a concurrent
update of the VDSO data is in progress, is not really affecting regular
tasks which are not part of a time namespace as the task is spin waiting
for the update to finish and vdso_data->seq to become even again.

If a time namespace task hits that code path, it invokes the corresponding
time getter function which retrieves the real VVAR page, reads host time
and then adds the offset for the requested clock which is stored in the
special VVAR page.

Allocate the time namespace page among VVAR pages and place vdso_data on
it.  Provide __arch_get_timens_vdso_data() helper for VDSO code to get the
code-relative position of VVARs on that special page.

Co-developed-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20191112012724.250792-23-dima@arista.com
2020-01-14 12:20:58 +01:00
..
vdso32 x86/asm: Use SYM_INNER_LABEL instead of GLOBAL 2019-10-18 11:27:44 +02:00
.gitignore
checkundef.sh
Makefile x86/build/vdso: Remove meaningless CFLAGS_REMOVE_*.o 2019-11-15 12:07:32 +01:00
vclock_gettime.c y2038: vdso: change time_t to __kernel_old_time_t 2019-11-15 14:38:28 +01:00
vdso2c.c x86/vdso: Add time napespace page 2020-01-14 12:20:58 +01:00
vdso2c.h x86/vdso: Rename variable to fix -Wshadow warning 2019-04-19 21:33:46 +02:00
vdso32-setup.c proc/sysctl: add shared variables for range check 2019-07-18 17:08:07 -07:00
vdso-layout.lds.S x86/vdso: Add time napespace page 2020-01-14 12:20:58 +01:00
vdso-note.S x86: Add build salt to the vDSO 2018-07-18 01:18:05 +09:00
vdso.lds.S x86/vdso: Add clock_getres() entry point 2019-06-22 21:21:10 +02:00
vdsox32.lds.S x86/vdso: Switch to generic vDSO implementation 2019-06-22 21:21:10 +02:00
vgetcpu.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 223 2019-05-30 11:29:55 -07:00
vma.c x86/vdso: Provide vdso_data offset on vvar_page 2020-01-14 12:20:57 +01:00