mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
VDSO updates:
- Consolidate the VDSO datastore further and provide support for
mlock_all() and prefaulting.
- Provide 32-bit legacy time related functionality only if
CONFIG_COMPAT_32BIT_TIME is enabled. The config switch exists, but
architecture code still exposes the legacy functionality even disabled.
Clean this up by adding the missing guards and validating at build time
that the VDSO is legacy free if disabled.
- Consolidate the VDSO related config options in core and drivers, which
removes some non-sensical dependencies and quite an amount of #ifdeffery.
- Clean up the PAGE_SIZE definition maze
-----BEGIN PGP SIGNATURE-----
iQJEBAABCgAuFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmqCxfkQHHRnbHhAa2Vy
bmVsLm9yZwAKCRCmGPVMDXSYoSQkEADEOmcrm3vwMbaElrAfQRp4MOQMnDpKPCDa
0EwdkXKJyqfOGx1PNKbcWZe10qShpXqyz+q3MUbHiOVh7KxkaGj0GOA/+xD+Tgs5
RAFXCq+CY4Ccjix7vlyOBLvGgomuznAtRDCFprVq5OTXyQfVvS++5SHzaU/0xXiY
ZZEInrFP61BEJ8LJycpoN5431EBcUX7XpSkr9eHtuSOslOBzbTEtBbDp0AjDGse0
5qM/oZDufZDQQr31kVQiL0dN9bBWwdGNtBwZBjsf6KioY9M00LO0E9twSCSrI39F
kgD2N97RDjTewu/zEe0fvCDVypqel2mBvjfiYU4c8g6pprdJ4Hq1qMcDAtMBUDBZ
9jR8B09eYZwHLdbM5PFjiMf9d6p25P7X+twFI9Hylcm1YZtM4OTnamDhQOQDp1Fd
QdrFevXg1zvYVi1rrDYarcPfg/tGsetOTujMQ1m50/AJZOoEdcX9jZR/wfdW8ti6
X9TIn3SDzhauXkmeR86tHxtOmHDirVfBWCCCEyVT2YzGIIje25cf266fCPdcGRYl
kzhtycg8LqpTRMWjhlaf56NtD9qQlbvDY8L23tQLJUYhDp8xOxqyuRPRdpJVM0b3
4vp/Z8Sgz8tpEHO2ARsXfuu2CzilTBH0B2KL3f+a8CwpzIEadjIfc+6EEYqwgOAn
+/RhckFp/A==
=jHl1
-----END PGP SIGNATURE-----
Merge tag 'timers-vdso-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull VDSO updates from Thomas Gleixner:
- Consolidate the VDSO datastore further and provide support for
mlock_all() and prefaulting.
- Provide 32-bit legacy time related functionality only if
CONFIG_COMPAT_32BIT_TIME is enabled. The config switch exists,
but architecture code still exposes the legacy functionality even
disabled.
Clean this up by adding the missing guards and validating at build
time that the VDSO is legacy free if disabled.
- Consolidate the VDSO related config options in core and drivers,
which removes some non-sensical dependencies and quite an amount of
#ifdeffery.
- Clean up the PAGE_SIZE definition maze
* tag 'timers-vdso-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (30 commits)
random: vDSO: Drop custom PAGE_SIZE definitions
LoongArch: Remove CONFIG_GENERIC_GETTIMEOFDAY ifdeffery
clocksource/drivers/timer-riscv: Remove CONFIG_GENERIC_GETTIMEOFDAY ifdeffery
clocksource/drivers/arm_arch_timer: Remove CONFIG_GENERIC_GETTIMEOFDAY ifdeffery
clocksource/drivers/mips-gic-timer: Remove CONFIG_GENERIC_GETTIMEOFDAY ifdeffery
MIPS: csrc-r4k: Remove CONFIG_GENERIC_GETTIMEOFDAY ifdeffery
vDSO: Make clockmode constants available without CONFIG_GENERIC_GETTIMEOFDAY
kbuild: Support generated asm-headers in subdirectories
vdso: Rename HAVE_GENERIC_VDSO to VDSO_DATASTORE
vdso: Drop HAVE_GENERIC_VDSO from architecture kconfig files
vdso: Automatically select HAVE_GENERIC_VDSO if necessary
MIPS: vdso: Stop using CONFIG_HAVE_GENERIC_VDSO
vdso: Remove the dependency on HAVE_GENERIC_VDSO from ARCH_HAS_VDSO_ARCH_DATA
futex: Remove dependency on HAVE_GENERIC_VDSO from FUTEX_ROBUST_UNLOCK
vdso/gettimeofday: Verify COMPAT_32BIT_TIME interactions
sparc: vdso: Respect COMPAT_32BIT_TIME
MIPS: VDSO: Respect COMPAT_32BIT_TIME
powerpc/vdso: Respect COMPAT_32BIT_TIME
ARM: VDSO: Respect COMPAT_32BIT_TIME
arm64: vdso32: Respect COMPAT_32BIT_TIME
...
This commit is contained in:
commit
104a813376
|
|
@ -1699,7 +1699,6 @@ config HAVE_SPARSE_SYSCALL_NR
|
|||
related optimizations for a given architecture.
|
||||
|
||||
config ARCH_HAS_VDSO_ARCH_DATA
|
||||
depends on HAVE_GENERIC_VDSO
|
||||
bool
|
||||
|
||||
config ARCH_HAS_VDSO_TIME_DATA
|
||||
|
|
|
|||
|
|
@ -924,7 +924,6 @@ config VDSO
|
|||
bool "Enable VDSO for acceleration of some system calls"
|
||||
depends on AEABI && MMU && CPU_V7
|
||||
default y if ARM_ARCH_TIMER
|
||||
select HAVE_GENERIC_VDSO
|
||||
select GENERIC_GETTIMEOFDAY
|
||||
help
|
||||
Place in the process address space an ELF shared object
|
||||
|
|
|
|||
|
|
@ -70,9 +70,11 @@ VERSION
|
|||
{
|
||||
LINUX_2.6 {
|
||||
global:
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
__vdso_clock_gettime;
|
||||
__vdso_gettimeofday;
|
||||
__vdso_clock_getres;
|
||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
||||
__vdso_clock_gettime64;
|
||||
__vdso_clock_getres_time64;
|
||||
local: *;
|
||||
|
|
|
|||
|
|
@ -10,16 +10,17 @@
|
|||
#include <asm/unwind.h>
|
||||
#include <vdso/gettime.h>
|
||||
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
int __vdso_clock_gettime(clockid_t clock,
|
||||
struct old_timespec32 *ts)
|
||||
{
|
||||
return __cvdso_clock_gettime32(clock, ts);
|
||||
}
|
||||
|
||||
int __vdso_clock_gettime64(clockid_t clock,
|
||||
struct __kernel_timespec *ts)
|
||||
int __vdso_clock_getres(clockid_t clock_id,
|
||||
struct old_timespec32 *res)
|
||||
{
|
||||
return __cvdso_clock_gettime(clock, ts);
|
||||
return __cvdso_clock_getres_time32(clock_id, res);
|
||||
}
|
||||
|
||||
int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
|
||||
|
|
@ -27,11 +28,12 @@ int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
|
|||
{
|
||||
return __cvdso_gettimeofday(tv, tz);
|
||||
}
|
||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
||||
|
||||
int __vdso_clock_getres(clockid_t clock_id,
|
||||
struct old_timespec32 *res)
|
||||
int __vdso_clock_gettime64(clockid_t clock,
|
||||
struct __kernel_timespec *ts)
|
||||
{
|
||||
return __cvdso_clock_getres_time32(clock_id, res);
|
||||
return __cvdso_clock_gettime(clock, ts);
|
||||
}
|
||||
|
||||
int __vdso_clock_getres_time64(clockid_t clock_id, struct __kernel_timespec *res)
|
||||
|
|
|
|||
|
|
@ -229,7 +229,6 @@ config ARM64
|
|||
select HAVE_SYSCALL_TRACEPOINTS
|
||||
select HAVE_KPROBES
|
||||
select HAVE_KRETPROBES
|
||||
select HAVE_GENERIC_VDSO
|
||||
select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
|
||||
select HOTPLUG_SMT if HOTPLUG_CPU
|
||||
select IRQ_DOMAIN
|
||||
|
|
|
|||
|
|
@ -82,9 +82,11 @@ VERSION
|
|||
{
|
||||
LINUX_2.6 {
|
||||
global:
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
__vdso_clock_gettime;
|
||||
__vdso_gettimeofday;
|
||||
__vdso_clock_getres;
|
||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
||||
__vdso_clock_gettime64;
|
||||
__vdso_clock_getres_time64;
|
||||
local: *;
|
||||
|
|
|
|||
|
|
@ -8,16 +8,17 @@
|
|||
#define BUILD_VDSO32_64
|
||||
#include <vdso/gettime.h>
|
||||
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
int __vdso_clock_gettime(clockid_t clock,
|
||||
struct old_timespec32 *ts)
|
||||
{
|
||||
return __cvdso_clock_gettime32(clock, ts);
|
||||
}
|
||||
|
||||
int __vdso_clock_gettime64(clockid_t clock,
|
||||
struct __kernel_timespec *ts)
|
||||
int __vdso_clock_getres(clockid_t clock_id,
|
||||
struct old_timespec32 *res)
|
||||
{
|
||||
return __cvdso_clock_gettime(clock, ts);
|
||||
return __cvdso_clock_getres_time32(clock_id, res);
|
||||
}
|
||||
|
||||
int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
|
||||
|
|
@ -25,11 +26,12 @@ int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
|
|||
{
|
||||
return __cvdso_gettimeofday(tv, tz);
|
||||
}
|
||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
||||
|
||||
int __vdso_clock_getres(clockid_t clock_id,
|
||||
struct old_timespec32 *res)
|
||||
int __vdso_clock_gettime64(clockid_t clock,
|
||||
struct __kernel_timespec *ts)
|
||||
{
|
||||
return __cvdso_clock_getres_time32(clock_id, res);
|
||||
return __cvdso_clock_gettime(clock, ts);
|
||||
}
|
||||
|
||||
int __vdso_clock_getres_time64(clockid_t clock_id, struct __kernel_timespec *res)
|
||||
|
|
|
|||
|
|
@ -153,7 +153,6 @@ config LOONGARCH
|
|||
select HAVE_FUNCTION_GRAPH_TRACER
|
||||
select HAVE_FUNCTION_TRACER
|
||||
select HAVE_GCC_PLUGINS
|
||||
select HAVE_GENERIC_VDSO
|
||||
select HAVE_HW_BREAKPOINT if PERF_EVENTS
|
||||
select HAVE_IOREMAP_PROT
|
||||
select HAVE_IRQ_EXIT_ON_IRQ_STACK
|
||||
|
|
@ -213,6 +212,7 @@ config LOONGARCH
|
|||
select TRACE_IRQFLAGS_SUPPORT
|
||||
select USE_PERCPU_NUMA_NODE_ID
|
||||
select USER_STACKTRACE_SUPPORT
|
||||
select VDSO_DATASTORE
|
||||
select VDSO_GETRANDOM
|
||||
select ZONE_DMA32 if 64BIT
|
||||
|
||||
|
|
|
|||
|
|
@ -212,9 +212,7 @@ static struct clocksource clocksource_const = {
|
|||
.read = read_const_counter,
|
||||
.mask = CLOCKSOURCE_MASK(64),
|
||||
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
||||
#ifdef CONFIG_GENERIC_GETTIMEOFDAY
|
||||
.vdso_clock_mode = VDSO_CLOCKMODE_CPU,
|
||||
#endif
|
||||
};
|
||||
|
||||
int __init constant_clocksource_init(void)
|
||||
|
|
|
|||
|
|
@ -3163,7 +3163,6 @@ config MIPS_EXTERNAL_TIMER
|
|||
config MIPS_GENERIC_GETTIMEOFDAY
|
||||
def_bool y
|
||||
select GENERIC_GETTIMEOFDAY
|
||||
select HAVE_GENERIC_VDSO
|
||||
depends on CSRC_R4K || CLKSRC_MIPS_GIC
|
||||
# GCC (at least up to version 9.2) appears to emit function calls that make use
|
||||
# of the GOT when targeting microMIPS, which we can't use in the VDSO due to
|
||||
|
|
|
|||
|
|
@ -126,14 +126,12 @@ int __init init_r4k_clocksource(void)
|
|||
clocksource_mips.rating = 200;
|
||||
clocksource_mips.rating += clamp(mips_hpt_frequency / 10000000, 0, 99);
|
||||
|
||||
#ifdef CONFIG_GENERIC_GETTIMEOFDAY
|
||||
/*
|
||||
* R2 onwards makes the count accessible to user mode so it can be used
|
||||
* by the VDSO (HWREna is configured by configure_hwrena()).
|
||||
*/
|
||||
if (cpu_has_mips_r2_r6 && rdhwr_count_usable())
|
||||
clocksource_mips.vdso_clock_mode = VDSO_CLOCKMODE_R4K;
|
||||
#endif
|
||||
|
||||
clocksource_register_hz(&clocksource_mips, mips_hpt_frequency);
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
|
|||
* This ensures that when the kernel updates the VDSO data userland
|
||||
* will observe it without requiring cache invalidations.
|
||||
*/
|
||||
if (cpu_has_dc_aliases && IS_ENABLED(CONFIG_HAVE_GENERIC_VDSO)) {
|
||||
if (cpu_has_dc_aliases && IS_ENABLED(CONFIG_MIPS_GENERIC_GETTIMEOFDAY)) {
|
||||
base = __ALIGN_MASK(base, shm_align_mask);
|
||||
base += ((unsigned long)vdso_k_time_data - gic_size) & shm_align_mask;
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
|
|||
data_addr = base + gic_size;
|
||||
vdso_addr = data_addr + VDSO_NR_PAGES * PAGE_SIZE;
|
||||
|
||||
if (IS_ENABLED(CONFIG_HAVE_GENERIC_VDSO)) {
|
||||
if (IS_ENABLED(CONFIG_MIPS_GENERIC_GETTIMEOFDAY)) {
|
||||
vma = vdso_install_vvar_mapping(mm, data_addr);
|
||||
if (IS_ERR(vma)) {
|
||||
ret = PTR_ERR(vma);
|
||||
|
|
|
|||
|
|
@ -97,9 +97,11 @@ VERSION
|
|||
LINUX_2.6 {
|
||||
#ifdef CONFIG_GENERIC_GETTIMEOFDAY
|
||||
global:
|
||||
#if _MIPS_SIM == _MIPS_SIM_ABI64 || defined(CONFIG_COMPAT_32BIT_TIME)
|
||||
__vdso_clock_gettime;
|
||||
__vdso_gettimeofday;
|
||||
__vdso_clock_getres;
|
||||
#endif
|
||||
#if _MIPS_SIM != _MIPS_SIM_ABI64
|
||||
__vdso_clock_gettime64;
|
||||
__vdso_clock_getres_time64;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
#include <vdso/gettime.h>
|
||||
|
||||
#if _MIPS_SIM != _MIPS_SIM_ABI64
|
||||
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
int __vdso_clock_gettime(clockid_t clock,
|
||||
struct old_timespec32 *ts)
|
||||
{
|
||||
|
|
@ -29,6 +31,7 @@ int __vdso_clock_getres(clockid_t clock_id,
|
|||
{
|
||||
return __cvdso_clock_getres_time32(clock_id, res);
|
||||
}
|
||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
||||
|
||||
int __vdso_clock_gettime64(clockid_t clock,
|
||||
struct __kernel_timespec *ts)
|
||||
|
|
|
|||
|
|
@ -256,7 +256,6 @@ config PPC
|
|||
select HAVE_FUNCTION_GRAPH_TRACER
|
||||
select HAVE_FUNCTION_TRACER if !COMPILE_TEST && (PPC64 || (PPC32 && CC_IS_GCC))
|
||||
select HAVE_GCC_PLUGINS
|
||||
select HAVE_GENERIC_VDSO
|
||||
select HAVE_HARDLOCKUP_DETECTOR_ARCH if PPC_BOOK3S_64 && SMP
|
||||
select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI
|
||||
select HAVE_HW_BREAKPOINT if PERF_EVENTS && (PPC_BOOK3S || PPC_8xx)
|
||||
|
|
@ -331,6 +330,7 @@ config PPC
|
|||
select SYSCTL_EXCEPTION_TRACE
|
||||
select THREAD_INFO_IN_TASK
|
||||
select TRACE_IRQFLAGS_SUPPORT
|
||||
select VDSO_DATASTORE
|
||||
select VDSO_GETRANDOM
|
||||
#
|
||||
# Please keep this list sorted alphabetically.
|
||||
|
|
|
|||
|
|
@ -67,9 +67,11 @@
|
|||
* int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
*
|
||||
*/
|
||||
#if defined(__powerpc64__) || defined(CONFIG_COMPAT_32BIT_TIME)
|
||||
V_FUNCTION_BEGIN(__kernel_gettimeofday)
|
||||
cvdso_call __c_kernel_gettimeofday
|
||||
V_FUNCTION_END(__kernel_gettimeofday)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Exact prototype of clock_gettime()
|
||||
|
|
@ -77,9 +79,11 @@ V_FUNCTION_END(__kernel_gettimeofday)
|
|||
* int __kernel_clock_gettime(clockid_t clock_id, struct timespec *tp);
|
||||
*
|
||||
*/
|
||||
#if defined(__powerpc64__) || defined(CONFIG_COMPAT_32BIT_TIME)
|
||||
V_FUNCTION_BEGIN(__kernel_clock_gettime)
|
||||
cvdso_call __c_kernel_clock_gettime
|
||||
V_FUNCTION_END(__kernel_clock_gettime)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Exact prototype of clock_gettime64()
|
||||
|
|
@ -99,9 +103,11 @@ V_FUNCTION_END(__kernel_clock_gettime64)
|
|||
* int __kernel_clock_getres(clockid_t clock_id, struct timespec *res);
|
||||
*
|
||||
*/
|
||||
#if defined(__powerpc64__) || defined(CONFIG_COMPAT_32BIT_TIME)
|
||||
V_FUNCTION_BEGIN(__kernel_clock_getres)
|
||||
cvdso_call __c_kernel_clock_getres
|
||||
V_FUNCTION_END(__kernel_clock_getres)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Exact prototype of clock_getres_time64()
|
||||
|
|
@ -122,6 +128,8 @@ V_FUNCTION_END(__kernel_clock_getres_time64)
|
|||
* time_t time(time *t);
|
||||
*
|
||||
*/
|
||||
#if defined(__powerpc64__) || defined(CONFIG_COMPAT_32BIT_TIME)
|
||||
V_FUNCTION_BEGIN(__kernel_time)
|
||||
cvdso_call __c_kernel_time call_time=1
|
||||
V_FUNCTION_END(__kernel_time)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -119,13 +119,15 @@ VERSION
|
|||
{
|
||||
VDSO_VERSION_STRING {
|
||||
global:
|
||||
__kernel_get_syscall_map;
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
__kernel_gettimeofday;
|
||||
__kernel_clock_gettime;
|
||||
__kernel_clock_gettime64;
|
||||
__kernel_clock_getres;
|
||||
__kernel_clock_getres_time64;
|
||||
__kernel_time;
|
||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
||||
__kernel_get_syscall_map;
|
||||
__kernel_clock_gettime64;
|
||||
__kernel_clock_getres_time64;
|
||||
__kernel_get_tbfreq;
|
||||
__kernel_sync_dicache;
|
||||
__kernel_sigtramp32;
|
||||
|
|
|
|||
|
|
@ -18,23 +18,25 @@ int __c_kernel_clock_getres(clockid_t clock_id, struct __kernel_timespec *res,
|
|||
return __cvdso_clock_getres_data(vd, clock_id, res);
|
||||
}
|
||||
#else
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
int __c_kernel_clock_gettime(clockid_t clock, struct old_timespec32 *ts,
|
||||
const struct vdso_time_data *vd)
|
||||
{
|
||||
return __cvdso_clock_gettime32_data(vd, clock, ts);
|
||||
}
|
||||
|
||||
int __c_kernel_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts,
|
||||
const struct vdso_time_data *vd)
|
||||
{
|
||||
return __cvdso_clock_gettime_data(vd, clock, ts);
|
||||
}
|
||||
|
||||
int __c_kernel_clock_getres(clockid_t clock_id, struct old_timespec32 *res,
|
||||
const struct vdso_time_data *vd)
|
||||
{
|
||||
return __cvdso_clock_getres_time32_data(vd, clock_id, res);
|
||||
}
|
||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
||||
|
||||
int __c_kernel_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts,
|
||||
const struct vdso_time_data *vd)
|
||||
{
|
||||
return __cvdso_clock_gettime_data(vd, clock, ts);
|
||||
}
|
||||
|
||||
int __c_kernel_clock_getres_time64(clockid_t clock_id, struct __kernel_timespec *res,
|
||||
const struct vdso_time_data *vd)
|
||||
|
|
@ -43,6 +45,7 @@ int __c_kernel_clock_getres_time64(clockid_t clock_id, struct __kernel_timespec
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(__powerpc64__) || defined(CONFIG_COMPAT_32BIT_TIME)
|
||||
int __c_kernel_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz,
|
||||
const struct vdso_time_data *vd)
|
||||
{
|
||||
|
|
@ -53,3 +56,4 @@ __kernel_old_time_t __c_kernel_time(__kernel_old_time_t *time, const struct vdso
|
|||
{
|
||||
return __cvdso_time_data(vd, time);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ config RISCV
|
|||
select ARCH_HAS_SYSCALL_WRAPPER
|
||||
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
|
||||
select ARCH_HAS_UBSAN
|
||||
select ARCH_HAS_VDSO_ARCH_DATA if HAVE_GENERIC_VDSO
|
||||
select ARCH_HAS_VDSO_ARCH_DATA
|
||||
select ARCH_HAVE_NMI_SAFE_CMPXCHG
|
||||
select ARCH_KEEP_MEMBLOCK if ACPI || KEXEC
|
||||
select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE if 64BIT && MMU
|
||||
|
|
@ -111,7 +111,7 @@ config RISCV
|
|||
select GENERIC_CPU_VULNERABILITIES
|
||||
select GENERIC_EARLY_IOREMAP
|
||||
select GENERIC_ENTRY
|
||||
select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO && 64BIT
|
||||
select GENERIC_GETTIMEOFDAY if MMU && 64BIT
|
||||
select GENERIC_IDLE_POLL_SETUP
|
||||
select GENERIC_IOREMAP if MMU
|
||||
select HAVE_IOREMAP_PROT if MMU
|
||||
|
|
@ -172,7 +172,6 @@ config RISCV
|
|||
select HAVE_FUNCTION_ARG_ACCESS_API
|
||||
select HAVE_FUNCTION_ERROR_INJECTION
|
||||
select HAVE_GCC_PLUGINS
|
||||
select HAVE_GENERIC_VDSO if MMU
|
||||
select HAVE_IRQ_TIME_ACCOUNTING
|
||||
select HAVE_KERNEL_BZIP2 if !EFI_ZBOOT
|
||||
select HAVE_KERNEL_GZIP if !EFI_ZBOOT
|
||||
|
|
@ -228,7 +227,8 @@ config RISCV
|
|||
select THREAD_INFO_IN_TASK
|
||||
select TRACE_IRQFLAGS_SUPPORT
|
||||
select UACCESS_MEMCPY if !MMU
|
||||
select VDSO_GETRANDOM if HAVE_GENERIC_VDSO && 64BIT
|
||||
select VDSO_DATASTORE if MMU
|
||||
select VDSO_GETRANDOM if MMU && 64BIT
|
||||
select USER_STACKTRACE_SUPPORT
|
||||
select ZONE_DMA32 if 64BIT
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,6 @@ config S390
|
|||
select HAVE_FUNCTION_GRAPH_TRACER
|
||||
select HAVE_FUNCTION_TRACER
|
||||
select HAVE_GCC_PLUGINS
|
||||
select HAVE_GENERIC_VDSO
|
||||
select HAVE_IOREMAP_PROT if PCI
|
||||
select HAVE_KERNEL_BZIP2
|
||||
select HAVE_KERNEL_GZIP
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@ config SPARC64
|
|||
select ARCH_SUPPORTS_SCHED_SMT if SMP
|
||||
select ARCH_SUPPORTS_SCHED_MC if SMP
|
||||
select ARCH_HAS_LAZY_MMU_MODE
|
||||
select HAVE_GENERIC_VDSO
|
||||
select GENERIC_GETTIMEOFDAY
|
||||
|
||||
config ARCH_PROC_KCORE_TEXT
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "../../../../lib/vdso/gettimeofday.c"
|
||||
|
||||
#if defined(CONFIG_SPARC64) || defined(CONFIG_COMPAT_32BIT_TIME)
|
||||
int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
|
||||
{
|
||||
return __cvdso_gettimeofday(tv, tz);
|
||||
|
|
@ -28,6 +29,7 @@ int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
|
|||
|
||||
int gettimeofday(struct __kernel_old_timeval *, struct timezone *)
|
||||
__weak __alias(__vdso_gettimeofday);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SPARC64)
|
||||
int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts)
|
||||
|
|
@ -40,6 +42,7 @@ int clock_gettime(clockid_t, struct __kernel_timespec *)
|
|||
|
||||
#else
|
||||
|
||||
#if defined(CONFIG_COMPAT_32BIT_TIME)
|
||||
int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts)
|
||||
{
|
||||
return __cvdso_clock_gettime32(clock, ts);
|
||||
|
|
@ -47,6 +50,7 @@ int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts)
|
|||
|
||||
int clock_gettime(clockid_t, struct old_timespec32 *)
|
||||
__weak __alias(__vdso_clock_gettime);
|
||||
#endif
|
||||
|
||||
int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,12 +15,14 @@
|
|||
VERSION {
|
||||
LINUX_2.6 {
|
||||
global:
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
clock_gettime;
|
||||
__vdso_clock_gettime;
|
||||
clock_gettime64;
|
||||
__vdso_clock_gettime64;
|
||||
gettimeofday;
|
||||
__vdso_gettimeofday;
|
||||
#endif
|
||||
clock_gettime64;
|
||||
__vdso_clock_gettime64;
|
||||
local: *;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,7 +303,6 @@ config X86
|
|||
select HAVE_UNSTABLE_SCHED_CLOCK
|
||||
select HAVE_UNWIND_USER_FP if X86_64
|
||||
select HAVE_USER_RETURN_NOTIFIER
|
||||
select HAVE_GENERIC_VDSO
|
||||
select VDSO_GETRANDOM if X86_64
|
||||
select HOTPLUG_PARALLEL if SMP && X86_64
|
||||
select HOTPLUG_SMT if SMP
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "lib/vdso/gettimeofday.c"
|
||||
|
||||
#if defined(__x86_64__) || defined(CONFIG_COMPAT_32BIT_TIME)
|
||||
int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
|
||||
{
|
||||
return __cvdso_gettimeofday(tv, tz);
|
||||
|
|
@ -29,6 +30,7 @@ __kernel_old_time_t __vdso_time(__kernel_old_time_t *t)
|
|||
}
|
||||
|
||||
__kernel_old_time_t time(__kernel_old_time_t *t) __attribute__((weak, alias("__vdso_time")));
|
||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
||||
|
||||
|
||||
#if defined(CONFIG_X86_64) && !defined(BUILD_VDSO32_64)
|
||||
|
|
@ -51,6 +53,7 @@ int clock_getres(clockid_t, struct __kernel_timespec *)
|
|||
|
||||
#else
|
||||
/* i386 only */
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts)
|
||||
{
|
||||
return __cvdso_clock_gettime32(clock, ts);
|
||||
|
|
@ -59,6 +62,15 @@ int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts)
|
|||
int clock_gettime(clockid_t, struct old_timespec32 *)
|
||||
__attribute__((weak, alias("__vdso_clock_gettime")));
|
||||
|
||||
int __vdso_clock_getres(clockid_t clock, struct old_timespec32 *res)
|
||||
{
|
||||
return __cvdso_clock_getres_time32(clock, res);
|
||||
}
|
||||
|
||||
int clock_getres(clockid_t, struct old_timespec32 *)
|
||||
__attribute__((weak, alias("__vdso_clock_getres")));
|
||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
||||
|
||||
int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts)
|
||||
{
|
||||
return __cvdso_clock_gettime(clock, ts);
|
||||
|
|
@ -67,14 +79,6 @@ int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts)
|
|||
int clock_gettime64(clockid_t, struct __kernel_timespec *)
|
||||
__attribute__((weak, alias("__vdso_clock_gettime64")));
|
||||
|
||||
int __vdso_clock_getres(clockid_t clock, struct old_timespec32 *res)
|
||||
{
|
||||
return __cvdso_clock_getres_time32(clock, res);
|
||||
}
|
||||
|
||||
int clock_getres(clockid_t, struct old_timespec32 *)
|
||||
__attribute__((weak, alias("__vdso_clock_getres")));
|
||||
|
||||
int __vdso_clock_getres_time64(clockid_t clock, struct __kernel_timespec *ts)
|
||||
{
|
||||
return __cvdso_clock_getres(clock, ts);
|
||||
|
|
|
|||
|
|
@ -23,10 +23,12 @@ VERSION
|
|||
{
|
||||
LINUX_2.6 {
|
||||
global:
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
__vdso_clock_gettime;
|
||||
__vdso_gettimeofday;
|
||||
__vdso_time;
|
||||
__vdso_clock_getres;
|
||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
||||
__vdso_clock_gettime64;
|
||||
__vdso_clock_getres_time64;
|
||||
__vdso_getcpu;
|
||||
|
|
|
|||
|
|
@ -56,11 +56,7 @@ static struct clock_event_device __percpu *arch_timer_evt;
|
|||
static enum arch_timer_ppi_nr arch_timer_uses_ppi __ro_after_init = ARCH_TIMER_VIRT_PPI;
|
||||
static bool arch_timer_c3stop __ro_after_init;
|
||||
static bool arch_counter_suspend_stop __ro_after_init;
|
||||
#ifdef CONFIG_GENERIC_GETTIMEOFDAY
|
||||
static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_ARCHTIMER;
|
||||
#else
|
||||
static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_NONE;
|
||||
#endif /* CONFIG_GENERIC_GETTIMEOFDAY */
|
||||
|
||||
static cpumask_t evtstrm_available = CPU_MASK_NONE;
|
||||
static bool evtstrm_enable __ro_after_init = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
|
||||
|
|
|
|||
|
|
@ -198,9 +198,7 @@ static struct clocksource gic_clocksource = {
|
|||
.name = "GIC",
|
||||
.read = gic_hpt_read,
|
||||
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
||||
#ifdef CONFIG_GENERIC_GETTIMEOFDAY
|
||||
.vdso_clock_mode = VDSO_CLOCKMODE_GIC,
|
||||
#endif
|
||||
};
|
||||
|
||||
static void gic_clocksource_unstable(char *reason)
|
||||
|
|
|
|||
|
|
@ -98,11 +98,7 @@ static struct clocksource riscv_clocksource = {
|
|||
.mask = CLOCKSOURCE_MASK(64),
|
||||
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
||||
.read = riscv_clocksource_rdtime,
|
||||
#if IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY)
|
||||
.vdso_clock_mode = VDSO_CLOCKMODE_ARCHTIMER,
|
||||
#else
|
||||
.vdso_clock_mode = VDSO_CLOCKMODE_NONE,
|
||||
#endif
|
||||
};
|
||||
|
||||
static int riscv_timer_starting_cpu(unsigned int cpu)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ mandatory-y += topology.h
|
|||
mandatory-y += trace_clock.h
|
||||
mandatory-y += uaccess.h
|
||||
mandatory-y += unwind_user.h
|
||||
mandatory-y += vdso/clocksource.h
|
||||
mandatory-y += vermagic.h
|
||||
mandatory-y += vga.h
|
||||
mandatory-y += video.h
|
||||
|
|
|
|||
0
include/asm-generic/vdso/clocksource.h
Normal file
0
include/asm-generic/vdso/clocksource.h
Normal file
|
|
@ -2,7 +2,7 @@
|
|||
#ifndef __ASM_GENERIC_VSYSCALL_H
|
||||
#define __ASM_GENERIC_VSYSCALL_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#ifndef __arch_get_vdso_u_time_data
|
||||
static __always_inline const struct vdso_time_data *__arch_get_vdso_u_time_data(void)
|
||||
|
|
@ -30,6 +30,6 @@ static __always_inline void __arch_sync_vdso_time_data(struct vdso_time_data *vd
|
|||
}
|
||||
#endif /* __arch_sync_vdso_time_data */
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#endif /* __ASM_GENERIC_VSYSCALL_H */
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
extern const struct vm_special_mapping vdso_vvar_mapping;
|
||||
struct vm_area_struct *vdso_install_vvar_mapping(struct mm_struct *mm, unsigned long addr);
|
||||
|
||||
#ifdef CONFIG_HAVE_GENERIC_VDSO
|
||||
#ifdef CONFIG_VDSO_DATASTORE
|
||||
void __init vdso_setup_data_pages(void);
|
||||
#else /* !CONFIG_HAVE_GENERIC_VDSO */
|
||||
#else /* !CONFIG_VDSO_DATASTORE */
|
||||
static inline void vdso_setup_data_pages(void) { }
|
||||
#endif /* CONFIG_HAVE_GENERIC_VDSO */
|
||||
#endif /* CONFIG_VDSO_DATASTORE */
|
||||
|
||||
#endif /* _LINUX_VDSO_DATASTORE_H */
|
||||
|
|
|
|||
|
|
@ -4,13 +4,11 @@
|
|||
|
||||
#include <vdso/limits.h>
|
||||
|
||||
#ifdef CONFIG_GENERIC_GETTIMEOFDAY
|
||||
#include <asm/vdso/clocksource.h>
|
||||
#endif /* CONFIG_GENERIC_GETTIMEOFDAY */
|
||||
|
||||
enum vdso_clock_mode {
|
||||
VDSO_CLOCKMODE_NONE,
|
||||
#ifdef CONFIG_GENERIC_GETTIMEOFDAY
|
||||
#ifdef VDSO_ARCH_CLOCKMODES
|
||||
VDSO_ARCH_CLOCKMODES,
|
||||
#endif
|
||||
VDSO_CLOCKMODE_MAX,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#ifndef __VDSO_DATAPAGE_H
|
||||
#define __VDSO_DATAPAGE_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
|
|
@ -176,7 +176,7 @@ enum vdso_pages {
|
|||
VDSO_NR_PAGES
|
||||
};
|
||||
|
||||
#else /* !__ASSEMBLY__ */
|
||||
#else /* !__ASSEMBLER__ */
|
||||
|
||||
#ifdef CONFIG_VDSO_GETRANDOM
|
||||
#define __vdso_u_rng_data PROVIDE(vdso_u_rng_data = vdso_u_data + 2 * PAGE_SIZE);
|
||||
|
|
@ -197,6 +197,6 @@ enum vdso_pages {
|
|||
__vdso_u_arch_data \
|
||||
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#endif /* __VDSO_DATAPAGE_H */
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#ifndef __VDSO_HELPERS_H
|
||||
#define __VDSO_HELPERS_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include <asm/barrier.h>
|
||||
#include <vdso/datapage.h>
|
||||
|
|
@ -111,6 +111,6 @@ static __always_inline void vdso_write_end(struct vdso_time_data *vd)
|
|||
vdso_write_seq_end(&vc[CS_RAW]);
|
||||
}
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#endif /* __VDSO_HELPERS_H */
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
#ifndef __VDSO_PROCESSOR_H
|
||||
#define __VDSO_PROCESSOR_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include <asm/vdso/processor.h>
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
#endif /* __VDSO_PROCESSOR_H */
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
#ifndef __VDSO_VSYSCALL_H
|
||||
#define __VDSO_VSYSCALL_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include <asm/vdso/vsyscall.h>
|
||||
|
||||
unsigned long vdso_update_begin(void);
|
||||
void vdso_update_end(unsigned long flags);
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#endif /* __VDSO_VSYSCALL_H */
|
||||
|
|
|
|||
|
|
@ -1861,7 +1861,7 @@ config HAVE_FUTEX_ROBUST_UNLOCK
|
|||
bool
|
||||
|
||||
config FUTEX_ROBUST_UNLOCK
|
||||
def_bool FUTEX && HAVE_GENERIC_VDSO && GENERIC_IRQ_ENTRY && RSEQ && HAVE_FUTEX_ROBUST_UNLOCK
|
||||
def_bool FUTEX && GENERIC_IRQ_ENTRY && RSEQ && HAVE_FUTEX_ROBUST_UNLOCK
|
||||
|
||||
config EPOLL
|
||||
bool "Enable eventpoll support" if EXPERT
|
||||
|
|
|
|||
|
|
@ -351,6 +351,10 @@ COND_SYSCALL(ppoll_time32);
|
|||
COND_SYSCALL_COMPAT(ppoll_time32);
|
||||
COND_SYSCALL(utimensat_time32);
|
||||
COND_SYSCALL(clock_adjtime32);
|
||||
COND_SYSCALL(gettimeofday);
|
||||
COND_SYSCALL_COMPAT(gettimeofday);
|
||||
COND_SYSCALL(time);
|
||||
COND_SYSCALL(stime);
|
||||
|
||||
/*
|
||||
* The syscalls below are not found in include/uapi/asm-generic/unistd.h
|
||||
|
|
|
|||
|
|
@ -74,11 +74,8 @@ struct page *find_timens_vvar_page(struct vm_area_struct *vma)
|
|||
return current->nsproxy->time_ns->vvar_page;
|
||||
|
||||
/*
|
||||
* VM_PFNMAP | VM_IO protect .fault() handler from being called
|
||||
* through interfaces like /proc/$pid/mem or
|
||||
* process_vm_{readv,writev}() as long as there's no .access()
|
||||
* in special_mapping_vmops().
|
||||
* For more details check_vma_flags() and __access_remote_vm()
|
||||
* vvar_fault() protects this from being called through remote interfaces like
|
||||
* /proc/$pid/mem or process_vm_{readv,writev}().
|
||||
*/
|
||||
|
||||
WARN(1, "vvar_page accessed remotely");
|
||||
|
|
|
|||
|
|
@ -44,6 +44,12 @@
|
|||
#include "timekeeping.h"
|
||||
#include "timekeeping_internal.h"
|
||||
|
||||
#if defined(CONFIG_64BIT) || defined(CONFIG_COMPAT_32BIT_TIME)
|
||||
#define __WANT_OLD_TIME_TYPE_SYSCALL 1
|
||||
#endif
|
||||
|
||||
static_assert(sizeof(__kernel_old_time_t) == 8 ? IS_ENABLED(__WANT_OLD_TIME_TYPE_SYSCALL) : true);
|
||||
|
||||
/*
|
||||
* The timezone where the local system is located. Used as a default by some
|
||||
* programs who obtain this value by using gettimeofday.
|
||||
|
|
@ -52,7 +58,7 @@ struct timezone sys_tz;
|
|||
|
||||
EXPORT_SYMBOL(sys_tz);
|
||||
|
||||
#ifdef __ARCH_WANT_SYS_TIME
|
||||
#if defined(__ARCH_WANT_SYS_TIME) && defined(__WANT_OLD_TIME_TYPE_SYSCALL)
|
||||
|
||||
/*
|
||||
* sys_time() can be implemented in user-level using
|
||||
|
|
@ -97,7 +103,7 @@ SYSCALL_DEFINE1(stime, __kernel_old_time_t __user *, tptr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __ARCH_WANT_SYS_TIME */
|
||||
#endif /* __ARCH_WANT_SYS_TIME && __WANT_OLD_TIME_TYPE_SYSCALL */
|
||||
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
#ifdef __ARCH_WANT_SYS_TIME32
|
||||
|
|
@ -138,6 +144,7 @@ SYSCALL_DEFINE1(stime32, old_time32_t __user *, tptr)
|
|||
#endif /* __ARCH_WANT_SYS_TIME32 */
|
||||
#endif
|
||||
|
||||
#ifdef __WANT_OLD_TIME_TYPE_SYSCALL
|
||||
SYSCALL_DEFINE2(gettimeofday, struct __kernel_old_timeval __user *, tv,
|
||||
struct timezone __user *, tz)
|
||||
{
|
||||
|
|
@ -155,6 +162,7 @@ SYSCALL_DEFINE2(gettimeofday, struct __kernel_old_timeval __user *, tv,
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* __WANT_OLD_TIME_TYPE_SYSCALL */
|
||||
|
||||
/*
|
||||
* In case for some reason the CMOS clock has not already been running
|
||||
|
|
@ -204,6 +212,9 @@ SYSCALL_DEFINE2(settimeofday, struct __kernel_old_timeval __user *, tv,
|
|||
struct timezone new_tz;
|
||||
|
||||
if (tv) {
|
||||
if (!IS_ENABLED(__WANT_OLD_TIME_TYPE_SYSCALL))
|
||||
return -EINVAL;
|
||||
|
||||
if (get_user(new_ts.tv_sec, &tv->tv_sec) ||
|
||||
get_user(new_ts.tv_nsec, &tv->tv_usec))
|
||||
return -EFAULT;
|
||||
|
|
@ -221,7 +232,7 @@ SYSCALL_DEFINE2(settimeofday, struct __kernel_old_timeval __user *, tv,
|
|||
return do_sys_settimeofday64(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
COMPAT_SYSCALL_DEFINE2(gettimeofday, struct old_timeval32 __user *, tv,
|
||||
struct timezone __user *, tz)
|
||||
{
|
||||
|
|
@ -240,7 +251,9 @@ COMPAT_SYSCALL_DEFINE2(gettimeofday, struct old_timeval32 __user *, tv,
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32 __user *, tv,
|
||||
struct timezone __user *, tz)
|
||||
{
|
||||
|
|
@ -248,6 +261,9 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32 __user *, tv,
|
|||
struct timezone new_tz;
|
||||
|
||||
if (tv) {
|
||||
if (!IS_ENABLED(CONFIG_COMPAT_32BIT_TIME))
|
||||
return -EINVAL;
|
||||
|
||||
if (get_user(new_ts.tv_sec, &tv->tv_sec) ||
|
||||
get_user(new_ts.tv_nsec, &tv->tv_usec))
|
||||
return -EFAULT;
|
||||
|
|
@ -264,7 +280,7 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32 __user *, tv,
|
|||
|
||||
return do_sys_settimeofday64(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_COMPAT */
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
SYSCALL_DEFINE1(adjtimex, struct __kernel_timex __user *, txc_p)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
config HAVE_GENERIC_VDSO
|
||||
config VDSO_DATASTORE
|
||||
bool
|
||||
|
||||
if HAVE_GENERIC_VDSO
|
||||
|
||||
config GENERIC_GETTIMEOFDAY
|
||||
bool
|
||||
select VDSO_DATASTORE
|
||||
help
|
||||
This is a generic implementation of gettimeofday vdso.
|
||||
Each architecture that enables this feature has to
|
||||
|
|
@ -21,7 +20,6 @@ config GENERIC_VDSO_OVERFLOW_PROTECT
|
|||
|
||||
config VDSO_GETRANDOM
|
||||
bool
|
||||
select VDSO_DATASTORE
|
||||
help
|
||||
Selected by architectures that support vDSO getrandom().
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
obj-$(CONFIG_HAVE_GENERIC_VDSO) += datastore.o
|
||||
obj-$(CONFIG_VDSO_DATASTORE) += datastore.o
|
||||
|
|
|
|||
|
|
@ -29,10 +29,11 @@ struct vdso_arch_data *vdso_k_arch_data __ro_after_init =
|
|||
(void *)&vdso_initdata[VDSO_ARCH_PAGES_START * PAGE_SIZE];
|
||||
#endif /* CONFIG_ARCH_HAS_VDSO_ARCH_DATA */
|
||||
|
||||
static struct page *vdso_data_pages __ro_after_init;
|
||||
|
||||
void __init vdso_setup_data_pages(void)
|
||||
{
|
||||
unsigned int order = get_order(VDSO_NR_PAGES * PAGE_SIZE);
|
||||
struct page *pages;
|
||||
|
||||
/*
|
||||
* Allocate the data pages dynamically. SPARC does not support mapping
|
||||
|
|
@ -42,24 +43,24 @@ void __init vdso_setup_data_pages(void)
|
|||
* Do not use folios. In time namespaces the pages are mapped in a different order
|
||||
* to userspace, which is not handled by the folio optimizations in finish_fault().
|
||||
*/
|
||||
pages = alloc_pages(GFP_KERNEL, order);
|
||||
if (!pages)
|
||||
vdso_data_pages = alloc_pages(GFP_KERNEL, order);
|
||||
if (!vdso_data_pages)
|
||||
panic("Unable to allocate VDSO storage pages");
|
||||
|
||||
/* The pages are mapped one-by-one into userspace and each one needs to be refcounted. */
|
||||
split_page(pages, order);
|
||||
split_page(vdso_data_pages, order);
|
||||
|
||||
/* Move the data already written by other subsystems to the new pages */
|
||||
memcpy(page_address(pages), vdso_initdata, VDSO_NR_PAGES * PAGE_SIZE);
|
||||
memcpy(page_address(vdso_data_pages), vdso_initdata, VDSO_NR_PAGES * PAGE_SIZE);
|
||||
|
||||
if (IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY))
|
||||
vdso_k_time_data = page_address(pages + VDSO_TIME_PAGE_OFFSET);
|
||||
vdso_k_time_data = page_address(vdso_data_pages + VDSO_TIME_PAGE_OFFSET);
|
||||
|
||||
if (IS_ENABLED(CONFIG_VDSO_GETRANDOM))
|
||||
vdso_k_rng_data = page_address(pages + VDSO_RNG_PAGE_OFFSET);
|
||||
vdso_k_rng_data = page_address(vdso_data_pages + VDSO_RNG_PAGE_OFFSET);
|
||||
|
||||
if (IS_ENABLED(CONFIG_ARCH_HAS_VDSO_ARCH_DATA))
|
||||
vdso_k_arch_data = page_address(pages + VDSO_ARCH_PAGES_START);
|
||||
vdso_k_arch_data = page_address(vdso_data_pages + VDSO_ARCH_PAGES_START);
|
||||
}
|
||||
|
||||
static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
|
||||
|
|
@ -67,27 +68,28 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
|
|||
{
|
||||
struct page *page, *timens_page;
|
||||
|
||||
if (unlikely(vmf->flags & FAULT_FLAG_REMOTE))
|
||||
return VM_FAULT_SIGBUS;
|
||||
|
||||
page = vdso_data_pages + vmf->pgoff;
|
||||
timens_page = find_timens_vvar_page(vma);
|
||||
|
||||
switch (vmf->pgoff) {
|
||||
case VDSO_TIME_PAGE_OFFSET:
|
||||
if (!IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY))
|
||||
return VM_FAULT_SIGBUS;
|
||||
page = virt_to_page(vdso_k_time_data);
|
||||
if (timens_page) {
|
||||
/*
|
||||
* Fault in VVAR page too, since it will be accessed
|
||||
* to get clock data anyway.
|
||||
*/
|
||||
unsigned long addr;
|
||||
vm_fault_t err;
|
||||
if (!IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY) || !timens_page)
|
||||
break;
|
||||
/*
|
||||
* Fault in VVAR page too, since it will be accessed
|
||||
* to get clock data anyway.
|
||||
*/
|
||||
unsigned long addr;
|
||||
vm_fault_t err;
|
||||
|
||||
addr = vmf->address + VDSO_TIMENS_PAGE_OFFSET * PAGE_SIZE;
|
||||
err = vmf_insert_page(vma, addr, page);
|
||||
if (unlikely(err & VM_FAULT_ERROR))
|
||||
return err;
|
||||
page = timens_page;
|
||||
}
|
||||
addr = vmf->address + VDSO_TIMENS_PAGE_OFFSET * PAGE_SIZE;
|
||||
err = vmf_insert_page(vma, addr, page);
|
||||
if (unlikely(err & VM_FAULT_ERROR))
|
||||
return err;
|
||||
page = timens_page;
|
||||
break;
|
||||
case VDSO_TIMENS_PAGE_OFFSET:
|
||||
/*
|
||||
|
|
@ -98,18 +100,11 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
|
|||
* See also the comment near timens_setup_vdso_data().
|
||||
*/
|
||||
if (!IS_ENABLED(CONFIG_TIME_NS) || !timens_page)
|
||||
return VM_FAULT_SIGBUS;
|
||||
page = virt_to_page(vdso_k_time_data);
|
||||
break;
|
||||
page = vdso_data_pages + VDSO_TIME_PAGE_OFFSET;
|
||||
break;
|
||||
case VDSO_RNG_PAGE_OFFSET:
|
||||
if (!IS_ENABLED(CONFIG_VDSO_GETRANDOM))
|
||||
return VM_FAULT_SIGBUS;
|
||||
page = virt_to_page(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;
|
||||
page = virt_to_page(vdso_k_arch_data) + vmf->pgoff - VDSO_ARCH_PAGES_START;
|
||||
break;
|
||||
default:
|
||||
return VM_FAULT_SIGBUS;
|
||||
|
|
@ -128,7 +123,7 @@ const struct vm_special_mapping vdso_vvar_mapping = {
|
|||
struct vm_area_struct *vdso_install_vvar_mapping(struct mm_struct *mm, unsigned long addr)
|
||||
{
|
||||
return _install_special_mapping(mm, addr, VDSO_NR_PAGES * PAGE_SIZE,
|
||||
VM_READ | VM_MAYREAD | VM_IO | VM_DONTDUMP |
|
||||
VM_READ | VM_MAYREAD | VM_DONTDUMP |
|
||||
VM_MIXEDMAP | VM_SEALED_SYSMAP,
|
||||
&vdso_vvar_mapping);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <vdso/datapage.h>
|
||||
#include <vdso/getrandom.h>
|
||||
#include <vdso/limits.h>
|
||||
#include <vdso/page.h>
|
||||
#include <vdso/unaligned.h>
|
||||
#include <asm/barrier.h>
|
||||
#include <asm/vdso/getrandom.h>
|
||||
|
|
@ -18,11 +19,6 @@
|
|||
/* Bring in default accessors */
|
||||
#include <vdso/vsyscall.h>
|
||||
|
||||
#undef PAGE_SIZE
|
||||
#undef PAGE_MASK
|
||||
#define PAGE_SIZE (1UL << CONFIG_PAGE_SHIFT)
|
||||
#define PAGE_MASK (~(PAGE_SIZE - 1))
|
||||
|
||||
#define MEMCPY_AND_ZERO_SRC(type, dst, src, len) do { \
|
||||
while (len >= sizeof(type)) { \
|
||||
__put_unaligned_t(type, __get_unaligned_t(type, src), dst); \
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
#include <vdso/time32.h>
|
||||
#include <vdso/time64.h>
|
||||
|
||||
#include <uapi/linux/unistd.h>
|
||||
|
||||
/*
|
||||
* The generic vDSO implementation requires that gettimeofday.h
|
||||
* provides:
|
||||
|
|
@ -23,6 +25,8 @@
|
|||
*/
|
||||
#include <asm/vdso/gettimeofday.h>
|
||||
|
||||
#include <linux/build_bug.h>
|
||||
|
||||
/* Bring in default accessors */
|
||||
#include <vdso/vsyscall.h>
|
||||
|
||||
|
|
@ -323,6 +327,8 @@ __cvdso_clock_gettime32_data(const struct vdso_time_data *vd, clockid_t clock,
|
|||
struct __kernel_timespec ts;
|
||||
bool ok;
|
||||
|
||||
BUILD_BUG_ON(!IS_ENABLED(CONFIG_COMPAT_32BIT_TIME));
|
||||
|
||||
ok = __cvdso_clock_gettime_common(vd, clock, &ts);
|
||||
|
||||
if (unlikely(!ok))
|
||||
|
|
@ -348,6 +354,12 @@ __cvdso_gettimeofday_data(const struct vdso_time_data *vd,
|
|||
{
|
||||
const struct vdso_clock *vc = vd->clock_data;
|
||||
|
||||
#ifndef __NR_gettimeofday
|
||||
BUILD_BUG();
|
||||
#endif
|
||||
|
||||
BUILD_BUG_ON(sizeof(tv->tv_sec) != 8 && !IS_ENABLED(CONFIG_COMPAT_32BIT_TIME));
|
||||
|
||||
if (likely(tv != NULL)) {
|
||||
struct __kernel_timespec ts;
|
||||
|
||||
|
|
@ -382,6 +394,12 @@ __cvdso_time_data(const struct vdso_time_data *vd, __kernel_old_time_t *time)
|
|||
const struct vdso_clock *vc = vd->clock_data;
|
||||
__kernel_old_time_t t;
|
||||
|
||||
#ifndef __NR_time
|
||||
BUILD_BUG();
|
||||
#endif
|
||||
|
||||
BUILD_BUG_ON(sizeof(*time) != 8 && !IS_ENABLED(CONFIG_COMPAT_32BIT_TIME));
|
||||
|
||||
if (vdso_is_timens_clock(vc)) {
|
||||
vd = vdso_timens_data(vd);
|
||||
vc = vd->clock_data;
|
||||
|
|
@ -471,6 +489,8 @@ __cvdso_clock_getres_time32_data(const struct vdso_time_data *vd, clockid_t cloc
|
|||
struct __kernel_timespec ts;
|
||||
bool ok;
|
||||
|
||||
BUILD_BUG_ON(!IS_ENABLED(CONFIG_COMPAT_32BIT_TIME));
|
||||
|
||||
ok = __cvdso_clock_getres_common(vd, clock, &ts);
|
||||
|
||||
if (unlikely(!ok))
|
||||
|
|
|
|||
|
|
@ -48,14 +48,13 @@ syscall-y := $(addprefix $(obj)/, $(syscall-y))
|
|||
generated-y := $(addprefix $(obj)/, $(generated-y))
|
||||
|
||||
# Remove stale wrappers when the corresponding files are removed from generic-y
|
||||
old-headers := $(wildcard $(obj)/*.h)
|
||||
old-headers := $(shell test -d $(obj) && find $(obj) -name *.h)
|
||||
unwanted := $(filter-out $(generic-y) $(generated-y) $(syscall-y),$(old-headers))
|
||||
|
||||
quiet_cmd_wrap = WRAP $@
|
||||
cmd_wrap = echo "\#include <asm-generic/$*.h>" > $@
|
||||
filechk_wrap = echo "\#include <asm-generic/$*.h>"
|
||||
|
||||
quiet_cmd_remove = REMOVE $(unwanted)
|
||||
cmd_remove = rm -f $(unwanted)
|
||||
cmd_remove = rm -f $(unwanted); find $(obj) -type d -empty -delete
|
||||
|
||||
quiet_cmd_syshdr = SYSHDR $@
|
||||
cmd_syshdr = $(CONFIG_SHELL) $(syshdr) \
|
||||
|
|
@ -74,8 +73,8 @@ all: $(generic-y) $(syscall-y)
|
|||
$(if $(unwanted),$(call cmd,remove))
|
||||
@:
|
||||
|
||||
$(obj)/%.h: $(srctree)/$(generic)/%.h
|
||||
$(call cmd,wrap)
|
||||
$(obj)/%.h: $(srctree)/$(generic)/%.h FORCE
|
||||
$(call filechk,wrap)
|
||||
|
||||
$(obj)/unistd_%.h: $(syscalltbl) $(syshdr) FORCE
|
||||
$(call if_changed,syshdr)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user