Skip to content

Commit f1c538c

Browse files
committed
Merge tag 'timers-vdso-2026-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull VDSO updates from Thomas Gleixner: - Provide the missing 64-bit variant of clock_getres() This allows the extension of CONFIG_COMPAT_32BIT_TIME to the vDSO and finally the removal of 32-bit time types from the kernel and UAPI. - Remove the useless and broken getcpu_cache from the VDSO The intention was to provide a trivial way to retrieve the CPU number from the VDSO, but as the VDSO data is per process there is no way to make it work. - Switch get/put_unaligned() from packed struct to memcpy() The packed struct violates strict aliasing rules which requires to pass -fno-strict-aliasing to the compiler. As this are scalar values __builtin_memcpy() turns them into simple loads and stores - Use __typeof_unqual__() for __unqual_scalar_typeof() The get/put_unaligned() changes triggered a new sparse warning when __beNN types are used with get/put_unaligned() as sparse builds add a special 'bitwise' attribute to them which prevents sparse to evaluate the Generic in __unqual_scalar_typeof(). Newer sparse versions support __typeof_unqual__() which avoids the problem, but requires a recent sparse install. So this adds a sanity check to sparse builds, which validates that sparse is available and capable of handling it. - Force inline __cvdso_clock_getres_common() Compilers sometimes un-inline agressively, which results in function call overhead and problems with automatic stack variable initialization. Interestingly enough the force inlining results in smaller code than the un-inlined variant produced by GCC when optimizing for size. * tag 'timers-vdso-2026-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: vdso/gettimeofday: Force inlining of __cvdso_clock_getres_common() x86/percpu: Make CONFIG_USE_X86_SEG_SUPPORT work with sparse compiler: Use __typeof_unqual__() for __unqual_scalar_typeof() powerpc/vdso: Provide clock_getres_time64() tools headers: Remove unneeded ignoring of warnings in unaligned.h tools headers: Update the linux/unaligned.h copy with the kernel sources vdso: Switch get/put_unaligned() from packed struct to memcpy() parisc: Inline a type punning version of get_unaligned_le32() vdso: Remove struct getcpu_cache MIPS: vdso: Provide getres_time64() for 32-bit ABIs arm64: vdso32: Provide clock_getres_time64() ARM: VDSO: Provide clock_getres_time64() ARM: VDSO: Patch out __vdso_clock_getres() if unavailable x86/vdso: Provide clock_getres_time64() for x86-32 selftests: vDSO: vdso_test_abi: Add test for clock_getres_time64() selftests: vDSO: vdso_test_abi: Use UAPI system call numbers selftests: vDSO: vdso_config: Add configurations for clock_getres_time64() vdso: Add prototype for __vdso_clock_getres_time64()
2 parents 353a7e8 + 546e928 commit f1c538c

36 files changed

Lines changed: 268 additions & 76 deletions

File tree

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,14 @@ CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian)
11951195
# the checker needs the correct machine size
11961196
CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32)
11971197

1198+
# Validate the checker is available and functional
1199+
ifneq ($(KBUILD_CHECKSRC), 0)
1200+
ifneq ($(shell $(srctree)/scripts/checker-valid.sh $(CHECK) $(CHECKFLAGS)), 1)
1201+
$(warning C=$(KBUILD_CHECKSRC) specified, but $(CHECK) is not available or not up to date)
1202+
KBUILD_CHECKSRC = 0
1203+
endif
1204+
endif
1205+
11981206
# Default kernel image to build when no specific target is given.
11991207
# KBUILD_IMAGE may be overruled on the command line or
12001208
# set in the environment

arch/arm/kernel/vdso.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ static void __init patch_vdso(void *ehdr)
161161
vdso_nullpatch_one(&einfo, "__vdso_gettimeofday");
162162
vdso_nullpatch_one(&einfo, "__vdso_clock_gettime");
163163
vdso_nullpatch_one(&einfo, "__vdso_clock_gettime64");
164+
vdso_nullpatch_one(&einfo, "__vdso_clock_getres");
165+
vdso_nullpatch_one(&einfo, "__vdso_clock_getres_time64");
164166
}
165167
}
166168

arch/arm/vdso/vdso.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ VERSION
7474
__vdso_gettimeofday;
7575
__vdso_clock_getres;
7676
__vdso_clock_gettime64;
77+
__vdso_clock_getres_time64;
7778
local: *;
7879
};
7980
}

arch/arm/vdso/vgettimeofday.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ int __vdso_clock_getres(clockid_t clock_id,
3434
return __cvdso_clock_getres_time32(clock_id, res);
3535
}
3636

37+
int __vdso_clock_getres_time64(clockid_t clock_id, struct __kernel_timespec *res)
38+
{
39+
return __cvdso_clock_getres(clock_id, res);
40+
}
41+
3742
/* Avoid unresolved references emitted by GCC */
3843

3944
void __aeabi_unwind_cpp_pr0(void)

arch/arm64/kernel/vdso32/vdso.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ VERSION
8686
__vdso_gettimeofday;
8787
__vdso_clock_getres;
8888
__vdso_clock_gettime64;
89+
__vdso_clock_getres_time64;
8990
local: *;
9091
};
9192
}

arch/arm64/kernel/vdso32/vgettimeofday.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ int __vdso_clock_getres(clockid_t clock_id,
3232
return __cvdso_clock_getres_time32(clock_id, res);
3333
}
3434

35+
int __vdso_clock_getres_time64(clockid_t clock_id, struct __kernel_timespec *res)
36+
{
37+
return __cvdso_clock_getres(clock_id, res);
38+
}
39+
3540
/* Avoid unresolved references emitted by GCC */
3641

3742
void __aeabi_unwind_cpp_pr0(void)

arch/loongarch/vdso/vgetcpu.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55

66
#include <asm/vdso.h>
7-
#include <linux/getcpu.h>
87

98
static __always_inline int read_cpu_id(void)
109
{
@@ -28,8 +27,8 @@ static __always_inline int read_cpu_id(void)
2827
}
2928

3029
extern
31-
int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused);
32-
int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused)
30+
int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused);
31+
int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused)
3332
{
3433
int cpu_id;
3534

arch/mips/vdso/vdso.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ VERSION
103103
__vdso_clock_getres;
104104
#if _MIPS_SIM != _MIPS_SIM_ABI64
105105
__vdso_clock_gettime64;
106+
__vdso_clock_getres_time64;
106107
#endif
107108
#endif
108109
local: *;

arch/mips/vdso/vgettimeofday.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ int __vdso_clock_gettime64(clockid_t clock,
4646
return __cvdso_clock_gettime(clock, ts);
4747
}
4848

49+
int __vdso_clock_getres_time64(clockid_t clock, struct __kernel_timespec *ts)
50+
{
51+
return __cvdso_clock_getres(clock, ts);
52+
}
53+
4954
#else
5055

5156
int __vdso_clock_gettime(clockid_t clock,

arch/parisc/boot/compressed/misc.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,19 @@ static void parse_elf(void *output)
278278
free(phdrs);
279279
}
280280

281+
/*
282+
* The regular get_unaligned_le32 uses __builtin_memcpy which can trigger
283+
* warnings when reading a byte/char output_len as an integer, as the size of a
284+
* char is less than that of an integer. Use type punning and the packed
285+
* attribute, which requires -fno-strict-aliasing, to work around the problem.
286+
*/
287+
static u32 punned_get_unaligned_le32(const void *p)
288+
{
289+
const struct { __le32 x; } __packed * __get_pptr = p;
290+
291+
return le32_to_cpu(__get_pptr->x);
292+
}
293+
281294
asmlinkage unsigned long __visible decompress_kernel(unsigned int started_wide,
282295
unsigned int command_line,
283296
const unsigned int rd_start,
@@ -309,7 +322,7 @@ asmlinkage unsigned long __visible decompress_kernel(unsigned int started_wide,
309322
* leave 2 MB for the stack.
310323
*/
311324
vmlinux_addr = (unsigned long) &_ebss + 2*1024*1024;
312-
vmlinux_len = get_unaligned_le32(&output_len);
325+
vmlinux_len = punned_get_unaligned_le32(&output_len);
313326
output = (char *) vmlinux_addr;
314327

315328
/*

0 commit comments

Comments
 (0)