From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EF2C2F362D; Thu, 13 Nov 2025 15:31:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047870; cv=none; b=D1MDOKIalBLCfAgdqV84gjywazALQgZMBPVQb7SsrfyOo5molgG2tLVeHbBPc0P31ggojPYR3+H4vPdNTDEsMyF4e5hHywUGAShv5H0ZDv+E48oiTx7wuH6ZpKtrZU7llIEkFhI9GKNxzk5qAOcaUHyEPCw+HzLEHnd8D5hhnNU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047870; c=relaxed/simple; bh=5Op/T/eyCK+F5h2kEKIs2m7fYFFJJ7Y0BBAu8h5Itc8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZBt29mujNnmSwzlMp+r7yGFhTsZEg0EASp1FIgZPR7trAdlrrHRZ7Yx254+GEFmAr+Cz53GedaipLot/irr/ykTCGlSW1HjjnHE5MnxDOdImeKSo4tgQYAkX4LnVfEgjVNK+bFMadDJiJniMXoYPoG2cj2rqLOlEZfUjZhFnpUI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=yZLDdAIP; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=dGNr/nNr; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yZLDdAIP"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dGNr/nNr" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047866; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lkJuPkbdEbvr1D9/q5FGwGe2aiPkXcMa/v88BuPKdsA=; b=yZLDdAIPOYIcB52Qnz/xUJyrjUzFvrcX2jMeZSHkQlH5B/Q6Sh7ZM7YaNI+t4sCefMTOjF l/Md0cklT/05zVFK4Wu+tSuJS/ee70DgNygkfONMJlmtbTrBuDjxy8ZXgri4eDDA4toovd /X8Q1bWH41xX8s72paZn3nxvTVAM2TpUP2RzUIx9qLN+DeLOvX9WYQ9H5Oo8DIq0el3eD7 f9vkQb+nVFwy3GoENnSWhHuiYe68Vz5N3e82SCsKY1Q41rsQoODWydWZOAJzWrAUDN445t pk6t3bnUDjAI1AQWA/hTeZMpNwfQ1SuEAHHha5JfSOjNVeg/zx1NXtC8htOUJw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047866; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lkJuPkbdEbvr1D9/q5FGwGe2aiPkXcMa/v88BuPKdsA=; b=dGNr/nNrz2bvdkTmrB9YxETJuRAQx1sQTUGQuJXFPrcwy+yMzSKHL1hHSdGs/5pZTabTEY Zj8Q5q/QIJsaqbBg== Date: Thu, 13 Nov 2025 16:30:17 +0100 Subject: [PATCH v2 01/14] Revert "selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-1-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=1846; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=5Op/T/eyCK+F5h2kEKIs2m7fYFFJJ7Y0BBAu8h5Itc8=; b=3vyDLpbd397jWGe+N6QwdtnJCklB7Ey+qMGVwoRLiXFZz17v4y2DTqkKRmjXNttsggpq0rov3 BmZs8uc3V6jC+ojKrd5HnqJOhxwje5NKsAHlwXK6fohBB7vYwexFNCS X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= This reverts commit c9fbaa879508 ("selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers") The kernel headers were used to make parse_vdso.c compatible with nolibc. Unfortunately linux/elf.h is incompatible with glibc's sys/auxv.h. When using glibc it is therefore not possible build parse_vdso.c as part of the same compilation unit as its caller as sys/auxv.h is needed for getauxval(). In the meantime nolibc gained its own elf.h, providing compatibility with the documented libc interfaces. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/vDSO/Makefile | 2 -- tools/testing/selftests/vDSO/parse_vdso.c | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftest= s/vDSO/Makefile index f94ea07cddc97ea8b13d8bed2b35a32bb99a2423..74dfc60e636edce91cc1df9643c= a8aa008ecfe65 100644 --- a/tools/testing/selftests/vDSO/Makefile +++ b/tools/testing/selftests/vDSO/Makefile @@ -19,8 +19,6 @@ endif =20 include ../lib.mk =20 -CFLAGS +=3D $(TOOLS_INCLUDES) - CFLAGS_NOLIBC :=3D -nostdlib -nostdinc -ffreestanding -fno-asynchronous-un= wind-tables \ -fno-stack-protector -include $(top_srcdir)/tools/include/nolibc/nolibc= .h \ -I$(top_srcdir)/tools/include/nolibc/ $(KHDR_INCLUDES) diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/self= tests/vDSO/parse_vdso.c index 3ff00fb624a44b964cc54954f1f088cabe11a901..c6ff4413ea367ae57bc6a600733= 14b29f938c99d 100644 --- a/tools/testing/selftests/vDSO/parse_vdso.c +++ b/tools/testing/selftests/vDSO/parse_vdso.c @@ -19,8 +19,7 @@ #include #include #include -#include -#include +#include =20 #include "parse_vdso.h" =20 --=20 2.51.0 From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF8892F363B; Thu, 13 Nov 2025 15:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047870; cv=none; b=iBQeYd5hkmTgHmqyrMl+wOoBrU2nr1TAMBHobkZrPFhOhMc+rIN8PR8JpDoO4ydd5fKFGnihYNutpg9oNsBrZwUFwh94zQZvGrGbxdVM8XuMSbXvE8YbgEYF06AfmrjvuVWFuugnU3kLHyVPqnod53d4nCi/707+FQEC3vfYmWE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047870; c=relaxed/simple; bh=vMHQb2pZU8YuJZrhWcCiLCwjhvrbfECZZuvDEJ5pZYc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BY+fvyYv990VMXcOAFAovYyoKR8SgyB9M54ITx4Bu2PLjMBxxNaNNvzzojWgbpl119lXCtSeynsW7ACoScv3bmwXHlUGlmAmZMkAmUMf96fdAWja/Q2tYMSBhmkZ4a3F4UgyuKKh4OsYcc9Nv9+6LtjN5/Nq7dkuu8Cpsexqngc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=wimaF+9/; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=+4ogWPra; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wimaF+9/"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="+4ogWPra" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZgafkdasB43CZMgeqQ/jKhsmZopqp31FwuK/XeQH0zA=; b=wimaF+9/1sELlqjQnOnNc3XCpnD0K6Xzpzmsf89i1/dzZpjLYruTGuRtoDEE7qYYM6oU6L llZC7aGXmMddRNeqQuHyV7Fj6FivgpklIN6VlBxZZ5fv9GgHCmdM3rR+d3jiT3WjUU48+n LJXMc9dMpx770BDY6MhgH5q78s18GJ717vZIWpwU8SY/b9HFzx3q7zaD1SGVHILjCmWF1J /FLLAxjlQ/pYXJDXiwnUpxCuA7DNxbbtR0Zh3P/G3CYDE2oxrdPr6rvp39SPVPWwcTv7gn eu+tXKLNEfAh0NLDGlW5yC/X/EHRH5PNKa4McCUaIjWFm3JCOOKWBruK6RSl4g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZgafkdasB43CZMgeqQ/jKhsmZopqp31FwuK/XeQH0zA=; b=+4ogWPraL9yWDZk3RBzk6PTOEK5CXILqI18hq1iBQT+p8i4xL/aZXPGbJBreImZV6X8gSl Fe7J20S8S9Us97Bg== Date: Thu, 13 Nov 2025 16:30:18 +0100 Subject: [PATCH v2 02/14] selftests: vDSO: Introduce vdso_types.h Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-2-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=3191; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=vMHQb2pZU8YuJZrhWcCiLCwjhvrbfECZZuvDEJ5pZYc=; b=kv+NJvr34fUn58aJcSqjyw9lRiORxlaU3HTkrNFePvcUKSqf9MMgw66sY1LBEXdz3kELrgWoG P45wL87CD2bAoOVe0FJED/uFawh44/+uEVRx6Fd9FJFzLWUeK3e3cvX X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Currently the vDSO selftests use the time-related types from libc. This works on glibc by chance today but will break with other libc implementations or on distributions which switch to 64-bit times everywhere. The kernel's UAPI headers provide the proper types to use with the vDSO (and raw syscalls) but are not necessarily compatible with libc types. Introduce a new header which makes the UAPI headers compatible with the libc. Tested with glibc, musl and nolibc. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/vDSO/vdso_types.h | 70 +++++++++++++++++++++++++++= ++++ 1 file changed, 70 insertions(+) diff --git a/tools/testing/selftests/vDSO/vdso_types.h b/tools/testing/self= tests/vDSO/vdso_types.h new file mode 100644 index 0000000000000000000000000000000000000000..75f2b108ed0fb6956d05e249887= 9658608aa2f51 --- /dev/null +++ b/tools/testing/selftests/vDSO/vdso_types.h @@ -0,0 +1,70 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2025 Thomas Wei=C3=9Fschuh , Linutronix GmbH + * + * Types to use with vDSO functions. + * + * The types used by the vDSO functions do not necessarily match the ones = used + * by libc. The kernel's UAPI headers do provide definitions for those typ= es + * but are often not compatible with libc which applications need to use. + * As the types differ between platforms listing them manually is a lot of= work + * and error prone. Instead hack around the incompatibilities of the libc = and + * UAPI headers and use the UAPI types. + */ +#ifndef __VDSO_TYPES_H__ +#define __VDSO_TYPES_H__ + +/* + * Include the headers from libc first to not override any of its types la= ter. + */ +#include +#include + +/* + * Avoid collisions. + */ +#define timeval kernel_timeval_moved +#define itimerspec kernel_itimerspec_moved +#define itimerval kernel_itimerval_moved +#define timezone kernel_timezone_moved + +/* + * Get the UAPI types. + */ +#include + +#undef timeval +#undef itimerspec +#undef itimerval +#undef timezone + +/* + * The UAPI headers do not provide their own 'struct __kernel_timezone'. + * 'struct timezone' is the one from libc. + */ +struct kernel_timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +#include + +/* + * UAPI headers from the libc may be older and not provide these. + */ +#if KERNEL_VERSION(5, 5, 0) > LINUX_VERSION_CODE +typedef __kernel_long_t __kernel_old_time_t; + +struct __kernel_old_timespec { + __kernel_old_time_t tv_sec; + long tv_nsec; +}; +#endif + +typedef long (*vdso_gettimeofday_t)(struct __kernel_old_timeval *tv, struc= t kernel_timezone *tz); +typedef long (*vdso_clock_gettime_t)(__kernel_clockid_t clk_id, struct __k= ernel_old_timespec *ts); +typedef long (*vdso_clock_gettime64_t)(__kernel_clockid_t clk_id, struct _= _kernel_timespec *ts); +typedef long (*vdso_clock_getres_t)(__kernel_clockid_t clk_id, struct __ke= rnel_old_timespec *ts); +typedef __kernel_old_time_t (*vdso_time_t)(__kernel_old_time_t *t); + +#endif /* __VDSO_TYPES_H__ */ --=20 2.51.0 From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96B432F39D1; Thu, 13 Nov 2025 15:31:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047871; cv=none; b=sfqndBS70+Y+F3wt4WXKA6wnMdlaXMA5/IN/OybhHOZH3+xcse7vEsml6FfaXU+a7FsnGZ/6bV2RtAOyb/tx47jUyuW3olNWR9ZL7KRNTgYffwUxcGB/rF/l/bZ4aEVmbHiNxt61FMIFNj+569pZTqpqYHGwezInjepXzLZgcB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047871; c=relaxed/simple; bh=XprfE5GVbG+1C0TRWP/OMuxspwruH8TFVSisi/13+5A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Sr8jFHrL+qf9gRKSeMG+lzd3ufYx9BFqacgkY8HY7xuhtP0F1vj0EWnSSu7cRA4G4gKLZChaXmN0IKvddwrFVPWRnKXKY3oGVWQDtpsKIanKpesF0DlYVt3dpUIqehlIRestdJNPhsQ0lH4sZcGg0QeG12J8txQKQYp8jWPiFyc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=bKm2mfaE; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=vbaSfjo5; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="bKm2mfaE"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="vbaSfjo5" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rk4H2rJzsJKwW6HjwCB/Dmy11K36eNhIBQuW6DahpyQ=; b=bKm2mfaEDX6yIFx4tJOrmBGPUEfuq1VgV/0fIUEr/xtjccrN32ta3iiYa90Ow4uIGlib68 icnSXwjG3fqueYKlcrVwwxPI0m1kUiceI86ti0t0fyhnTk63FdjvEAVYSTFOafh58FT7Ua uqpG1zONLgPYULmCkGmHqWHL+KOyymuGXdsA4iTcsc/uM805HbmW4HMo/yU1Xi4y2TEzEO 6s2SX++0f7MwtA0RYLvuvK2t7Ntw8VqXg79OXmOuw/HZO/aAzmlzqrM87VyVgK8Za67yh4 McgekwyRu1Rm6rypdkXyKF72Yuu9W+wzHcYhA0Pof28IkdR8oPJSCYdTrsuhUg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rk4H2rJzsJKwW6HjwCB/Dmy11K36eNhIBQuW6DahpyQ=; b=vbaSfjo5bb9btVBVIiWbGjb9I884nB9gRX6yK16OgmHY+9GgoS5TG/XCokRyRHnThFFZZx endJnLMrDbRiJ8Aw== Date: Thu, 13 Nov 2025 16:30:19 +0100 Subject: [PATCH v2 03/14] selftests: vDSO: Introduce vdso_syscalls.h Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-3-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=4307; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=XprfE5GVbG+1C0TRWP/OMuxspwruH8TFVSisi/13+5A=; b=FCtQS+LIqCLv/nrQU5QH23RgGGUcob9f/SSyfGFJ7hEQiH6GwyWrf0ppsMk5wvmBadVrNV4b1 /qSMMDozJ+fAMi8XFOhcnncUaTRMTXxVk3mTr+ngccziiZZJbg+ri6K X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The vDSO selftests use raw system call wrapper to validate the correctness of the vDSO implementation. The exactly available system calls differ between architectures and kernel configurations. Raw system calls should not use libc types as these are not necessarily compatible. Introduce a helper header which uses the correct types and fallbacks. Link: https://lore.kernel.org/lkml/29dd9e11-9ae8-415a-acb3-b96af56550b0@app= .fastmail.com/ Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/vDSO/vdso_syscalls.h | 93 ++++++++++++++++++++++++= ++++ 1 file changed, 93 insertions(+) diff --git a/tools/testing/selftests/vDSO/vdso_syscalls.h b/tools/testing/s= elftests/vDSO/vdso_syscalls.h new file mode 100644 index 0000000000000000000000000000000000000000..1419f8dd3ea831beaf582c47f6a= cf2ce5d5d12f8 --- /dev/null +++ b/tools/testing/selftests/vDSO/vdso_syscalls.h @@ -0,0 +1,93 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2025 Thomas Wei=C3=9Fschuh , Linutronix GmbH + * + * System call wrappers to use for vDSO testing. + * + * vDSO calls are expected to return the same data as the equivalent syste= m call. + * To ensure this the tests need to trigger system calls. Calling into lib= c may + * silently use the vDSO, so explicit system calls are necessary. + * Not all system calls are available on all platforms, so some fallback l= ogic + * is needed. Use __NR_ constants from the kernel's UAPI headers over SYS_= from + * ones from libc to avoid any potential interference from libc. + * Always prefer the 64-bit time variants of the system calls as 32-bit on= es + * may not be present on the platform or disabled in the kernel configurat= ion. + */ +#ifndef __VDSO_SYSCALLS_H__ +#define __VDSO_SYSCALLS_H__ + +#include "vdso_types.h" + +#include +#include +#include + +#define typeof_member(T, m) typeof(((T*)0)->m) +#define sizeof_member(T, m) sizeof(typeof_member(T, m)) + +/* + * To keep the fallback logic simple we assume that although the types bet= ween + * the wrapper and the system call are different they are compatible. + * Validate that assumption. + * On x32 tv_nsec of __kernel_old_timespec is smaller than the one from + * __kernel_timespec. This is fine, as only the lower 4 bytes are relevant= and + * it is a little-endian architecture. + */ +#define ASSERT_TIMESPEC_COMPATIBLE(T1, T2) \ + do { \ + _Static_assert(sizeof(T2) =3D=3D sizeof(T2)); \ + _Static_assert(offsetof(T1, tv_sec) =3D=3D offsetof(T2, tv_sec)); \ + _Static_assert(sizeof_member(T1, tv_sec) =3D=3D sizeof_member(T2, tv_sec= )); \ + _Static_assert(offsetof(T1, tv_nsec) =3D=3D offsetof(T2, tv_nsec)); \ + _Static_assert(sizeof_member(T1, tv_nsec) =3D=3D sizeof_member(T2, tv_ns= ec) || \ + (__BYTE_ORDER__ =3D=3D __ORDER_LITTLE_ENDIAN__ && \ + sizeof_member(T1, tv_nsec) > sizeof_member(T2, tv_nsec))); \ + } while(0) + +static inline +int sys_clock_getres(__kernel_clockid_t clock, struct __kernel_timespec *t= s) +{ +#ifdef __NR_clock_getres_time64 + return syscall(__NR_clock_getres_time64, clock, ts); +#else + ASSERT_TIMESPEC_COMPATIBLE(typeof(*ts), struct __kernel_old_timespec); + return syscall(__NR_clock_getres, clock, ts); +#endif +} + +static inline +int sys_clock_gettime(__kernel_clockid_t clock, struct __kernel_timespec *= ts) +{ +#ifdef __NR_clock_gettime64 + return syscall(__NR_clock_gettime64, clock, ts); +#else + ASSERT_TIMESPEC_COMPATIBLE(typeof(*ts), struct __kernel_old_timespec); + return syscall(__NR_clock_gettime, clock, ts); +#endif +} + +static inline +int sys_gettimeofday(struct __kernel_old_timeval *tv, struct kernel_timezo= ne *tz) +{ +#ifdef __NR_gettimeofday + return syscall(__NR_gettimeofday, tv, tz); +#else + /* Architectures with vdso_gettimeofday() also have __NR_gettimeofday */ + errno =3D ENOSYS; + return -1; +#endif +} + +static inline +__kernel_old_time_t sys_time(__kernel_old_time_t *tloc) +{ +#ifdef __NR_time + return syscall(__NR_time, tloc); +#else + /* Architectures with vdso_time() also have __NR_time */ + errno =3D ENOSYS; + return -1; +#endif +} + +#endif /* __VDSO_SYSCALLS_H__ */ --=20 2.51.0 From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D48B2F39CF; Thu, 13 Nov 2025 15:31:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047871; cv=none; b=dsn8RVEv9mMMN0vZ+Y3SZq2l0cqgyP5bqjeKuzk4yr4HR8bBlLFJFN88wNgNNGTDESuSLpTOy/TE2OPaUB3WpnwEeWQ5eZv9k/QzkZBv4nF1W9Q1z88scrSCpQhGe7Ulw+HqBbtbAlXTaTBDXAkc8KNPC9eTJT9jfIWGajElepI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047871; c=relaxed/simple; bh=IhZCZpYTEfcsIhUb1OvA+o2aZg+IqFDuCoJX9+mQwCg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BCwOEI2hTUYO/iWlR/9VJ7wVQjmNzSsuiLTGB6CugAfENS6Jo4wYnsna+3tFBbDcvkmKh4Dr+n1QNM4pIBdJRwXzCKMddUn4m6CklHK+0uSQmNd1UOM74x6sfKk/i0dKnZ6PmKU1cZJ9T0ctxSS7rFxtfYh/84KhoFBZHNTBVo4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=BhBtzjMp; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=oPUg+Pej; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="BhBtzjMp"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="oPUg+Pej" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0mBr7wG1x9Eu1Fb7Qvx7iJnYkPB3hiuiZVSG49/GyNg=; b=BhBtzjMpGupW2q68FyRcA6dYu+8mytE/hB6COxrMd3a3qzc8Eye4BwF14P5R8lGso/vWqx yD4oWbN5SZu3dcSbqewzwZij/A2YIztnIdsf5moAU5WFm1aKoPxzrMlzDGDLYU+aIEFyVb xcbnM9+/oORO76Im+Wm0UZbIfBmJ14Z2DvasMEgXlYN15XKV6hQe5Mi0V9cKI3bIcpk78C C90yAAwITNilG7eKLL1ZGDcFFLgmBb6raQl4s6wo2cmPBz0KIVc4t32LcplsXEUqZL+3rL XZQnUXH6Ut7GdULbH5IZATUVxmDZB//o9C441UcECN4jZ2n9ag8mzCsTz640eA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0mBr7wG1x9Eu1Fb7Qvx7iJnYkPB3hiuiZVSG49/GyNg=; b=oPUg+Pej4n92x+9YIIckuUBMtSyyblOuO2o3y92axdJuKqC/VKNVmEjL1BoOalagUSVh4B WCJfdH0SlXYTN8Ag== Date: Thu, 13 Nov 2025 16:30:20 +0100 Subject: [PATCH v2 04/14] selftests: vDSO: vdso_test_gettimeofday: Remove nolibc checks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-4-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=778; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=IhZCZpYTEfcsIhUb1OvA+o2aZg+IqFDuCoJX9+mQwCg=; b=wcVyOKYJVtjeugf7DXLzwHZjavlOPPBnQWiHrJiWLZoJsKj4szXTS9hGsdberS99uBaor8k+A toj+2v2rbc0DfFiLHgndLky/boYccYIQNaP43Jn/Y1Z/xpFQTFUC9Jl X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= nolibc now provides these headers, making the check unnecessary. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/vDSO/vdso_test_gettimeofday.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c b/tools/= testing/selftests/vDSO/vdso_test_gettimeofday.c index 9ce795b806f0992b83cef78c7e16fac0e54750da..636a56ccf8e4e7943ca446fe3fa= d6897598ca77f 100644 --- a/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c +++ b/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c @@ -11,10 +11,8 @@ */ =20 #include -#ifndef NOLIBC #include #include -#endif =20 #include "../kselftest.h" #include "parse_vdso.h" --=20 2.51.0 From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8555A355800; Thu, 13 Nov 2025 15:31:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047874; cv=none; b=cNJgEXiUfGe4UJEJmTHSKyHuhV/PVVKK6tTVcU0eABM9OoQmRmNKr5oh2lriRnKVxet9D9CwV9684ivpuAXLoQwoIA5l30709EjMetb+G3G9iIww1KhgJ/1CkPD5XWw3zVEulWKJDv3DDiADIEThw83XyEUAlr5ousAH9PU+HhM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047874; c=relaxed/simple; bh=aE/WV2Mi+bsanJlDrSl9gQQohVGvHhC6JpfJzLKQvZ4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KXqzBrlHo2BlA3KidT9PXNOQRGxp8oRx3gMrPfYuYmmAgkw6pyqPtgw6FOJyA4cJNIa0VQqYGk6dH+Rvw9suPvpNVkeQrJfcx4NhBBexO99uI7ng4MrKplcYs9MPFxo2ay6gimaz3l7pncb28UFdMDv7HRIE9UNCTVJyGNJ+iWc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=tpZJ6RB2; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=sQDJJmYk; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tpZJ6RB2"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="sQDJJmYk" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EWRbOr5K7jIjvQLAayug9MX0ujPyaf2nA2ZDGHxUXu0=; b=tpZJ6RB2ZIWMQ0un4x93pd20M34fmnMYRKkyy9xaBC7z9leBe5c2jCbWKdnNhuYRHtmPlz PB5GhK/opGbBv/sOGccrvw06+bK5vRY2JY9IDaDzTTTTM0dlvOndWlDxWaeGoSNtUeI2q1 if+QNECS1vQm8b4B1ZLE1OA8nz5l3dAVUyPp8OpM6NYMiaFg4NV9FErZ0fv2EODmhluFj2 0hZiHpgT+90bhcDXkOuKwWXfxFj7yRlPVhi5Pw9W2mZll/zo026MUa/KE1qiDhP8P/kOMQ 5M3vmXq2QIhuiKbJDEjThtOnT17HJLZbSXWz3XQolTepEAp58MLvdcT5td+KpA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EWRbOr5K7jIjvQLAayug9MX0ujPyaf2nA2ZDGHxUXu0=; b=sQDJJmYkRj6ZYQGLKn4+GzX6J7z/0ymTCf45xrdzmYLuIGdM3wKrikA/JMitN++QimZYYB vhIRj8LI79ziqjAg== Date: Thu, 13 Nov 2025 16:30:21 +0100 Subject: [PATCH v2 05/14] selftests: vDSO: vdso_test_gettimeofday: Use types from vdso_types.h Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-5-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=1506; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=aE/WV2Mi+bsanJlDrSl9gQQohVGvHhC6JpfJzLKQvZ4=; b=VNYLn2LfDOqE3yKLgg24YD0/DO4Gw8FiThFchHxpELdfOdSzRVN/FcZc794RaNgNqbD9WlcyP Tpd3IKmrrKBBLpWe6rGMsc1dNrMoSFYr5WFLgWkwYF7y/9uTbO4VKuE X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The libc types are not necessarily compatible with the vDSO functions. Use the dedicated types from vdso_types.h instead. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/vDSO/vdso_test_gettimeofday.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c b/tools/= testing/selftests/vDSO/vdso_test_gettimeofday.c index 636a56ccf8e4e7943ca446fe3fad6897598ca77f..3c14ed654428e0dbe08e9d44671= e82737ac61486 100644 --- a/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c +++ b/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c @@ -12,12 +12,12 @@ =20 #include #include -#include =20 #include "../kselftest.h" #include "parse_vdso.h" #include "vdso_config.h" #include "vdso_call.h" +#include "vdso_types.h" =20 int main(int argc, char **argv) { @@ -33,15 +33,14 @@ int main(int argc, char **argv) vdso_init_from_sysinfo_ehdr(getauxval(AT_SYSINFO_EHDR)); =20 /* Find gettimeofday. */ - typedef long (*gtod_t)(struct timeval *tv, struct timezone *tz); - gtod_t gtod =3D (gtod_t)vdso_sym(version, name[0]); + vdso_gettimeofday_t gtod =3D (vdso_gettimeofday_t)vdso_sym(version, name[= 0]); =20 if (!gtod) { printf("Could not find %s\n", name[0]); return KSFT_SKIP; } =20 - struct timeval tv; + struct __kernel_old_timeval tv; long ret =3D VDSO_CALL(gtod, 2, &tv, 0); =20 if (ret =3D=3D 0) { --=20 2.51.0 From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 746AF3563C1; Thu, 13 Nov 2025 15:31:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047876; cv=none; b=UJB28vZ7pEt5n0wslka4UYCnKIo5nIBIYnXHMO1XKQc4L9Mtroak5LVGSRrtFiRwsDMe29+5heiQGKF7L7Lv+GFPQ8uH5N5i10mWxMF9CfFVK03WTcnDxKfh1qPBB+vkfYDR6om0mMQakR5B/F+cYP7rsLgZ/9gRmtGKITBLzpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047876; c=relaxed/simple; bh=c3bcEv9BGvQQcgu0BIsu5QL478np+U0x8j+cvLcIwpM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KMu6ub4PFcbzAsVNpE+0Bj+cP3bjg/pwGSsgkw9tOScoGgZzxzPhQFbtJyT0C+mO1GupFg9iEDUadOYc0R6o6F98hmXkw92K0sL//oQdCCIx+xuF7XLcwuI+oaPwOFTjLYBswhlxDbPXp5LmFlJZ8FuFHDLKbblJ3idGOXeW1z8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=dBYRxnC1; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=75K4JQ27; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dBYRxnC1"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="75K4JQ27" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047871; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oAHC9l+o6T0gxY6CoNDjUFoohSMI8Y+G6cyys+oqSBg=; b=dBYRxnC1SqDTHunxBpGJnGQQWtRcGIVQeqZ93j+6uB1RCL9I9dZ7eJoykpDcDs43MuEZUY 7eKZxtq+FIXy3rcTtBo8nnggcpnduHA6AnqoL98j8KwDW8Xv7XGyArV7jk7fsDOeWAUEWr aemupMAtDHfUJprQczkPtZnaWHZ53187E1jL4Gs7tg+6VfxLM2iYxJNB14/JMHmvDOnQFB ir/eybiRkCT1MI/dtgkhzkc7HFgaU9GLdbKP/Ay14GKcFrFPwK5FbGT7J5tIDdRC/HY8Mi tF9o/pq1fwGvFVnxJf9ciLp8SYmZn8ldK8JY069082pf1KBji3A/9c205c+0kg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047871; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oAHC9l+o6T0gxY6CoNDjUFoohSMI8Y+G6cyys+oqSBg=; b=75K4JQ27L/aNYUD0TTf2Jf9/p7gKRqlM4K/0NyIxo/yRCBGLagXz6F+0AtOaR7oWxG87cl C21uZMf0i9XCggCA== Date: Thu, 13 Nov 2025 16:30:22 +0100 Subject: [PATCH v2 06/14] selftests: vDSO: vdso_test_abi: Use types from vdso_types.h Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-6-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=3866; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=c3bcEv9BGvQQcgu0BIsu5QL478np+U0x8j+cvLcIwpM=; b=Y1IAzIaHM0kehHikC703SGQOWzfjBr/Pids/gLeT+AWMexkB96jRzSmiwS4jVPwFV9t3mqGAt 1RRLs6PN5kEBV0ZICw9PX0fqAOfAVKc5jYZ58eYJqomF7FITXLBKZ6a X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The libc types are not necessarily compatible with the vDSO functions. Use the dedicated types from vdso_types.h instead. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/vDSO/vdso_test_abi.c | 32 +++++++++---------------= ---- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/s= elftests/vDSO/vdso_test_abi.c index 238d609a457a281d802734b40d6a2c35ba7f6d72..7826d9c10ccaf313dc003e8959d= 9eb84b2cda874 100644 --- a/tools/testing/selftests/vDSO/vdso_test_abi.c +++ b/tools/testing/selftests/vDSO/vdso_test_abi.c @@ -11,9 +11,7 @@ #include #include #include -#include #include -#include #define _GNU_SOURCE #include #include @@ -21,23 +19,12 @@ #include "../kselftest.h" #include "vdso_config.h" #include "vdso_call.h" +#include "vdso_types.h" #include "parse_vdso.h" =20 static const char *version; static const char **name; =20 -/* The same as struct __kernel_timespec */ -struct vdso_timespec64 { - uint64_t tv_sec; - uint64_t tv_nsec; -}; - -typedef long (*vdso_gettimeofday_t)(struct timeval *tv, struct timezone *t= z); -typedef long (*vdso_clock_gettime_t)(clockid_t clk_id, struct timespec *ts= ); -typedef long (*vdso_clock_gettime64_t)(clockid_t clk_id, struct vdso_times= pec64 *ts); -typedef long (*vdso_clock_getres_t)(clockid_t clk_id, struct timespec *ts); -typedef time_t (*vdso_time_t)(time_t *t); - static const char * const vdso_clock_name[] =3D { [CLOCK_REALTIME] =3D "CLOCK_REALTIME", [CLOCK_MONOTONIC] =3D "CLOCK_MONOTONIC", @@ -65,7 +52,7 @@ static void vdso_test_gettimeofday(void) return; } =20 - struct timeval tv; + struct __kernel_old_timeval tv; long ret =3D VDSO_CALL(vdso_gettimeofday, 2, &tv, 0); =20 if (ret =3D=3D 0) { @@ -77,7 +64,7 @@ static void vdso_test_gettimeofday(void) } } =20 -static void vdso_test_clock_gettime64(clockid_t clk_id) +static void vdso_test_clock_gettime64(__kernel_clockid_t clk_id) { /* Find clock_gettime64. */ vdso_clock_gettime64_t vdso_clock_gettime64 =3D @@ -90,7 +77,7 @@ static void vdso_test_clock_gettime64(clockid_t clk_id) return; } =20 - struct vdso_timespec64 ts; + struct __kernel_timespec ts; long ret =3D VDSO_CALL(vdso_clock_gettime64, 2, clk_id, &ts); =20 if (ret =3D=3D 0) { @@ -104,7 +91,7 @@ static void vdso_test_clock_gettime64(clockid_t clk_id) } } =20 -static void vdso_test_clock_gettime(clockid_t clk_id) +static void vdso_test_clock_gettime(__kernel_clockid_t clk_id) { /* Find clock_gettime. */ vdso_clock_gettime_t vdso_clock_gettime =3D @@ -117,7 +104,7 @@ static void vdso_test_clock_gettime(clockid_t clk_id) return; } =20 - struct timespec ts; + struct __kernel_old_timespec ts; long ret =3D VDSO_CALL(vdso_clock_gettime, 2, clk_id, &ts); =20 if (ret =3D=3D 0) { @@ -154,7 +141,7 @@ static void vdso_test_time(void) } } =20 -static void vdso_test_clock_getres(clockid_t clk_id) +static void vdso_test_clock_getres(__kernel_clockid_t clk_id) { int clock_getres_fail =3D 0; =20 @@ -169,7 +156,8 @@ static void vdso_test_clock_getres(clockid_t clk_id) return; } =20 - struct timespec ts, sys_ts; + struct __kernel_old_timespec ts; + struct timespec sys_ts; long ret =3D VDSO_CALL(vdso_clock_getres, 2, clk_id, &ts); =20 if (ret =3D=3D 0) { @@ -200,7 +188,7 @@ static void vdso_test_clock_getres(clockid_t clk_id) * This function calls vdso_test_clock_gettime and vdso_test_clock_getres * with different values for clock_id. */ -static inline void vdso_test_clock(clockid_t clock_id) +static inline void vdso_test_clock(__kernel_clockid_t clock_id) { ksft_print_msg("clock_id: %s\n", vdso_clock_name[clock_id]); =20 --=20 2.51.0 From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC12A355035; Thu, 13 Nov 2025 15:31:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047875; cv=none; b=gQyL+lBTyx1m7olBkMgdQ994FdBhx5q/yUhzgy7T+QuXHbrQu8TUNBjSW6Qn1m+6Zb+9Mc9xXmJuHd3/QIUF78ReTUL5IS7QincqQp92JBEMHBr/ikjFESDgOCpYV9TdZhcXEak1hF+FJDnYjIVu3r6PkABMMspyeHBCBPwhfTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047875; c=relaxed/simple; bh=TK3kDMdKI7t7x2lzP/yrgs3XhFSrM6UorVFO2YD8btE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p3ip6zHT0YY+ENuvzFml24hxe+NKc+q5dD/ImLvFi+XFYH31m2ohdLjGoCVLJ9FkBEDLYNHRlinFkWfR9m4nSbIxtcsHmdMqRqDjaD3nwGF0ub1JiuN9dZSBwUGlENv+XB2X4fTxQlgrca8jifdApJnuCukvOXA7gZhwpQBTt1Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=cBqO4yEB; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=/UP3j5af; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cBqO4yEB"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="/UP3j5af" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2ZFSs81AIopxVpJk23vsXnUXNlQYUu8F0A7B4CVaEBE=; b=cBqO4yEBWMtMvzSwaRiBc3j1aa9vS6c4eP2KB0WyIyUC7NhneRw36H/h57JnXbEhyJc8dM cojD/AUTZZ6VmXR6IticxNQFdgxFqnTevq/xVZZ7Ke7FtpzRtzwkYvYQ0VFV/Hioob0iBH hhvhfz8AJdnzeSHIhHFkjiyimkd7cf1dxxKyzMUTTnz7RpdMfIgwlIf3PnS/Syj6ap7zDt Li6194V0Fq9J0KrSr4lnKTv4NiGdIGgJVVmfjp4rr46FG2eojODN5yWZaDBExdl4kjNl0R 9K3kO5wgvIfmUOmapdG2kM1lCcyDS88wxpjutEziVDUcMjuAVXNKOR0fVfZxVw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2ZFSs81AIopxVpJk23vsXnUXNlQYUu8F0A7B4CVaEBE=; b=/UP3j5afozy/Ol/0KfuT6Tlpok1H1DMR3/BQX5zlD78CSqjC8IFSFfFdTW7/TbSwxbHplY 0Ng5r4lwZqUadoBw== Date: Thu, 13 Nov 2025 16:30:23 +0100 Subject: [PATCH v2 07/14] selftests: vDSO: vdso_test_abi: Validate return value of syscall(clock_getres) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-7-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=1274; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=TK3kDMdKI7t7x2lzP/yrgs3XhFSrM6UorVFO2YD8btE=; b=eeHGGgJt+gpM1IhzcBzDHm+KY3Wx4fTV35i3di87gmYvJyLmaJ3jnkIkXo8vv3VSScVnmlhdZ +WuY82so5weBeDZbq5sYXMVMSrTBQ2SIYY4gfpX2jolL09PAqZW6NGb X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= If the system call failed the output memory is not usable. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/vDSO/vdso_test_abi.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/s= elftests/vDSO/vdso_test_abi.c index 7826d9c10ccaf313dc003e8959d9eb84b2cda874..ff142b3b9075b18e60a46b77492= d285e9937fa71 100644 --- a/tools/testing/selftests/vDSO/vdso_test_abi.c +++ b/tools/testing/selftests/vDSO/vdso_test_abi.c @@ -168,12 +168,15 @@ static void vdso_test_clock_getres(__kernel_clockid_t= clk_id) } =20 ret =3D syscall(SYS_clock_getres, clk_id, &sys_ts); + if (ret =3D=3D 0) { + ksft_print_msg("The syscall resolution is %lld %lld\n", + (long long)sys_ts.tv_sec, (long long)sys_ts.tv_nsec); =20 - ksft_print_msg("The syscall resolution is %lld %lld\n", - (long long)sys_ts.tv_sec, (long long)sys_ts.tv_nsec); - - if ((sys_ts.tv_sec !=3D ts.tv_sec) || (sys_ts.tv_nsec !=3D ts.tv_nsec)) + if ((sys_ts.tv_sec !=3D ts.tv_sec) || (sys_ts.tv_nsec !=3D ts.tv_nsec)) + clock_getres_fail++; + } else { clock_getres_fail++; + } =20 if (clock_getres_fail > 0) { ksft_test_result_fail("%s %s\n", name[3], --=20 2.51.0 From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 747983563C2; Thu, 13 Nov 2025 15:31:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047876; cv=none; b=gdYQWmwzln5XwdqI2RvSvMpQgzXZC2KhvbujHSXmJEdIt8XYzPeG5EjUHymedMGq8ycVWpaLH1A+wOVoTBg44rhk3PZPNp/OcNFmGPMfLmdH4kEwx/CI19BMALD+mRR9n6+guGop1LuuEMV1CUxDZGUxImrrPL/JHZOUtAwJoZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047876; c=relaxed/simple; bh=tHkazwfRRe5zIBfq6xHhZxxbf5hd0Fjqdu6I4Nax/zY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oM1vN7yIDerS4S4cNzWkyxTPiRbtOCaCA7815f1pa/a2+Y1Ukw4z4e7T+h0CFU8zDvW/9/Fi6eXuJGQq5B455Gy8MwvLsNIk3um3Kmj59kbz8SKYqrztfp6pSZz7Os8jJCRFqcmc8x12U8txp7IYG3dieA47H4uVZme+2lX99bM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=31a87OVp; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ACeknWZd; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="31a87OVp"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ACeknWZd" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NSpmbETV/gJ3846lTSx3RdqjnTc/TTgAtrO1oHs0U2E=; b=31a87OVpxYkVH7FUAd3iRvGJlbx2TYJAFBU+VnJWELet4dhwXNu9079PbBnQNC3anvxzuo 0iqXkWP5penBCTMEze46TRNtlPqNBAZyQYrKGr9L2C12AvPqCbuVnOaw8+4EaKsoSoTj4l e4hyuEkTW5/+WYhSN+15NIjWevoJujfmA7lJ/Qz+T7qN5ljJ3xs54rWCGyD2WxNayl5hSq wUwIdSrVc/VkQV/OOqBFVBPVFZURd7o0yE4BMwNUwmgotwItBpkG8I6+KpHRTzBD2+/iDI SE7GbVw572EUAaXwX9ExrvxqkuhETnFszoyBqeUWN/FCfcSX7hy3KpJYwIgsEA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NSpmbETV/gJ3846lTSx3RdqjnTc/TTgAtrO1oHs0U2E=; b=ACeknWZdBpARbYkLpA4s7edcDaOJ0/gxSLXyCpBBkae5YUYaDBfSINfMsdKwpCTwTrKEZd OspL6xJj8OOWQ5AA== Date: Thu, 13 Nov 2025 16:30:24 +0100 Subject: [PATCH v2 08/14] selftests: vDSO: vdso_test_abi: Use system call wrappers from vdso_syscalls.h Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-8-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=1454; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=tHkazwfRRe5zIBfq6xHhZxxbf5hd0Fjqdu6I4Nax/zY=; b=jumne8xKPJ/aEXwg+sJ1tb9tl5hApwOBFOe1PIx5t1b4K6mY7hEw6kVLgv7A3i9odqN81aQbi Eo0s3LK5boVCWdBxEHJBIlh0lEe7Hf8gvuKbsM5CK4kCLJdSWNWzCP1 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Using syscall(SYS_getcpu) is problematic for the reasons outlined in vdso_syscalls.h. Use the wrappers from the utility header instead. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/vDSO/vdso_test_abi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/s= elftests/vDSO/vdso_test_abi.c index ff142b3b9075b18e60a46b77492d285e9937fa71..5a1bd0c2742ae14053d826c8d9f= 3bdc1018d91f3 100644 --- a/tools/testing/selftests/vDSO/vdso_test_abi.c +++ b/tools/testing/selftests/vDSO/vdso_test_abi.c @@ -19,6 +19,7 @@ #include "../kselftest.h" #include "vdso_config.h" #include "vdso_call.h" +#include "vdso_syscalls.h" #include "vdso_types.h" #include "parse_vdso.h" =20 @@ -157,7 +158,7 @@ static void vdso_test_clock_getres(__kernel_clockid_t c= lk_id) } =20 struct __kernel_old_timespec ts; - struct timespec sys_ts; + struct __kernel_timespec sys_ts; long ret =3D VDSO_CALL(vdso_clock_getres, 2, clk_id, &ts); =20 if (ret =3D=3D 0) { @@ -167,7 +168,7 @@ static void vdso_test_clock_getres(__kernel_clockid_t c= lk_id) clock_getres_fail++; } =20 - ret =3D syscall(SYS_clock_getres, clk_id, &sys_ts); + ret =3D sys_clock_getres(clk_id, &sys_ts); if (ret =3D=3D 0) { ksft_print_msg("The syscall resolution is %lld %lld\n", (long long)sys_ts.tv_sec, (long long)sys_ts.tv_nsec); --=20 2.51.0 From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEE863563D8; Thu, 13 Nov 2025 15:31:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047876; cv=none; b=V1W2J1LVK6vRTDu9tkvwqqq2ancVz5ZJfDMdxqk1iRDJltl28JmJZDceYFUbRT8efc0jBVZXAQP0vmLs7eSPFnbEbZBTNyX2WFzPYhs/umgvgjF5zUTilAl/kIT73PGdqvbJxWCARbOzkjX3TveOqSixxlseTaxjqX2NIi0YMkY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047876; c=relaxed/simple; bh=mgBbhqKXIVtDgBpWnLQNQGMfOsIij1eGHRln0s0hly4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uFjfb14Jm9rD1igC0ddKa3GiJVvoM1ZnqUayWMWZ5pV2Zj+BD3DlMdKSXSapdHrdb5CJteR30LqU+AQuuD2oRBwi6VDw/EkBmZTW0bWQZVfOr3HjsC2GPeIxxjhgKoMngEn2TiAJ+yZjvNh/58IDKqvEq70svj1EAFxlQRzX/kI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=eVbTXIZA; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=crLKsI8a; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="eVbTXIZA"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="crLKsI8a" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047873; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sistUqI+ZNMZcEsNWeX14s6eyv+7oxVPQusG72kG8mg=; b=eVbTXIZA6Eio0HCEoTMPZ7vqAVCaunDnZfiA0iqoo9DB4UQeQo/CWIC9I9thEwGX3snjgI hW1KIp/5zXu6Jt0kjRJoAWGoXaga2NcjysA8pjuLNLHSFzS3aL8cQLPDMVu3aQFgrauTjh kv78qdo0grLeBalNw7r6c1fOBddRQNsSsBRT+4B6+VsZqmpRAPd0CpGfu2IFxLb9vs+4m9 F4JotsCjchKpGF0JHD4MnMRSB7wV8XlWDMYwFT8pIzCYVdMKbBoAroCGEkhxWfJqGB5WUJ hs7MdEJuPhqpSp8VJrnk7+4xFc70G6uK97hl84eC1Ct7ogZQoTXwIXTP7CtbkQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047873; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sistUqI+ZNMZcEsNWeX14s6eyv+7oxVPQusG72kG8mg=; b=crLKsI8alXLU9TCgt51PCfeh1WaKZmM9BErit0gg4iibG6yUM13F9I7eEZnnX7eNGQJycH MfvPMT3j9EyFUZAw== Date: Thu, 13 Nov 2025 16:30:25 +0100 Subject: [PATCH v2 09/14] selftests: vDSO: vdso_test_correctness: Drop SYS_getcpu fallbacks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-9-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=858; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=mgBbhqKXIVtDgBpWnLQNQGMfOsIij1eGHRln0s0hly4=; b=w0+FcXUkyU/yo3cDZBtV91GtB+2iil2GEo/ayiXAbPTNnnSj8iFZ2azle1Js87gyNUVWYhz5S XAY3z94IhvqD7r4QDk0wTElINjr+o/5EJTb2AmULuR9uyWWeGgPGuMK X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= These fallbacks are only valid on x86 and unused in the first place. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/vDSO/vdso_test_correctness.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/t= esting/selftests/vDSO/vdso_test_correctness.c index da651cf53c6ca4242085de109c7fc57bd807297c..66cd1d4c19872e78c0e608f5e0f= b5215cf902b50 100644 --- a/tools/testing/selftests/vDSO/vdso_test_correctness.c +++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c @@ -25,14 +25,6 @@ =20 static const char **name; =20 -#ifndef SYS_getcpu -# ifdef __x86_64__ -# define SYS_getcpu 309 -# else -# define SYS_getcpu 318 -# endif -#endif - #ifndef __NR_clock_gettime64 #define __NR_clock_gettime64 403 #endif --=20 2.51.0 From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 944C33563F5; Thu, 13 Nov 2025 15:31:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047877; cv=none; b=ae3M+gAFzNNgZRaPaTx3I+heaOxjGPSY9DhtYA64m0P+MLjqQWFtZAVUlKnEr5xH5+/AjU15y4obbC7o6XDNKlFl/YMPbIU4m+XsU6GsePxIUUwYug1mDquA3tdX2aPCa+9qGVQnolCfnewx88D8XGYBR0dBdFK5urMuogYZtxM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047877; c=relaxed/simple; bh=d+jX5oKg97wnWczmWgj4ARbemuOMARMiBHxW0i+sU3s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MaCv20Op8ZC9++KiDQxk3sXN9G13MAGzjK48Esv21ZSW4WSX8f6YUxCpey+xcKczaphOOznEGIL9E8DsZrukJ5QfWDDgf0HaAJFDuLaLVMG6N+QWRKW8XIgm/yFivqdEOLfvX5+dNnI2SQkxitT2bZEvoKWSpXXM6LUfkhHK85Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=zc1CGpYF; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=5E9lBFkD; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="zc1CGpYF"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="5E9lBFkD" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047873; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0ZUBlUZ3/0PUhBjY+iwfE/jHgMYfdPz62xyEz521tm0=; b=zc1CGpYFhBQhS6kq4Z+p8nOJeXc0VGW3pPjOquyHYzUkvii8ZW5MeMkaPrprq00y0A1+Kt Y0c62U7gkOeVSDzRhwfxHp++7WvTuMp0uo4LsoDGRVxZD82H4lo5dJ5n7WhrcfpbD8AAKP lGx4/WKhNErBPgSUSBDjqaqfCnuNLZ5HfuQpzppjqtVI9Q/gM5N0fgcayZ2YK8I5HyELEl lVBHBYi8tq5TPXRzQJ2BOOC9fDxOh18+g7KeZunfWolrH5iY81z0FXwgWNkfWDHlaGs2gC XRcdGy61AbChhqTnjZ39MvB0kspIv9X/Ix7rUjKhdePE2rIEhQwZYLLjSDsd5g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047873; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0ZUBlUZ3/0PUhBjY+iwfE/jHgMYfdPz62xyEz521tm0=; b=5E9lBFkDQ4NLY9F72pO5pQjy+piLJWOjPNmmSAQtDkaD7PtMErdtETxWsLs7MXVggZmsNu HukfX+PLqKmxkGDw== Date: Thu, 13 Nov 2025 16:30:26 +0100 Subject: [PATCH v2 10/14] selftests: vDSO: vdso_test_correctness: Make ts_leq() and tv_leq() more generic Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-10-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=2424; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=d+jX5oKg97wnWczmWgj4ARbemuOMARMiBHxW0i+sU3s=; b=DV+oLaXPHH2fankJOmmKso1BzTDgBddBnbib+sWJ50fgl6vvYRKwkl6xHvgr2bfPUwBS1tspO rDWhgSbnMEjDsi3iQuObWq5U/d69rYalDpjM7dwhEo5Qtqzxm9qwhM6 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Upcoming changes will shuffle around the timespec and timeval types. To keep ts_leq() and tv_leq() working with all of those types, transform them into macros. Also drop ts64_leq() as it can now be replaced by the regular ts_leq(). Signed-off-by: Thomas Wei=C3=9Fschuh --- .../testing/selftests/vDSO/vdso_test_correctness.c | 47 ++++++++++--------= ---- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/t= esting/selftests/vDSO/vdso_test_correctness.c index 66cd1d4c19872e78c0e608f5e0fb5215cf902b50..5a127fc93e7368cbe8d9fb4a448= 2a6a735ffd46c 100644 --- a/tools/testing/selftests/vDSO/vdso_test_correctness.c +++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c @@ -213,30 +213,27 @@ static void test_getcpu(void) } } =20 -static bool ts_leq(const struct timespec *a, const struct timespec *b) -{ - if (a->tv_sec !=3D b->tv_sec) - return a->tv_sec < b->tv_sec; - else - return a->tv_nsec <=3D b->tv_nsec; -} - -static bool ts64_leq(const struct __kernel_timespec *a, - const struct __kernel_timespec *b) -{ - if (a->tv_sec !=3D b->tv_sec) - return a->tv_sec < b->tv_sec; - else - return a->tv_nsec <=3D b->tv_nsec; -} - -static bool tv_leq(const struct timeval *a, const struct timeval *b) -{ - if (a->tv_sec !=3D b->tv_sec) - return a->tv_sec < b->tv_sec; - else - return a->tv_usec <=3D b->tv_usec; -} +#define ts_leq(_a, _b) ({ \ + bool _ret; \ + \ + if ((_a)->tv_sec !=3D (_b)->tv_sec) \ + _ret =3D (_a)->tv_sec < (_b)->tv_sec; \ + else \ + _ret =3D (_a)->tv_nsec <=3D (_b)->tv_nsec; \ + \ + _ret; \ +}) + +#define tv_leq(_a, _b) ({ \ + bool _ret; \ + \ + if ((_a)->tv_sec !=3D (_b)->tv_sec) \ + _ret =3D (_a)->tv_sec < (_b)->tv_sec; \ + else \ + _ret =3D (_a)->tv_usec <=3D (_b)->tv_usec; \ + \ + _ret; \ +}) =20 static char const * const clocknames[] =3D { [0] =3D "CLOCK_REALTIME", @@ -352,7 +349,7 @@ static void test_one_clock_gettime64(int clock, const c= har *name) (unsigned long long)vdso.tv_sec, vdso.tv_nsec, (unsigned long long)end.tv_sec, end.tv_nsec); =20 - if (!ts64_leq(&start, &vdso) || !ts64_leq(&vdso, &end)) { + if (!ts_leq(&start, &vdso) || !ts_leq(&vdso, &end)) { printf("[FAIL]\tTimes are out of sequence\n"); nerrs++; return; --=20 2.51.0 From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16E7235505C; Thu, 13 Nov 2025 15:31:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047878; cv=none; b=Yqzf+LrDXYT6yNmFBWICiJy9yMs/FnTR8XvWXNCx+xJWSD7n0iakPl5LdglQiSxMbjjyYxIczPh2FqoLQQAtNktYLZy4nw/N3v5JY7qLCEdYy9MwHq+alBZ9zk3/QHLQYyH+Lzi0rhfOY7HR7Zqc2oY8YeHOVdK1tizT1129UGk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047878; c=relaxed/simple; bh=uJOJhxejWK+Gv4jZ7aDxLph4kD0E0+67toIKhnu+YDw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D5e+9vb0WN6ENgb7/aMOj0RN+NmCvjXXRK5+alniwg8Qryzy/ZQR3voNhMtJ4KFGjj6Fv/XUiN4QBmsxRkRhmZWddH5z5+3Nma7ehduULxRSZetk6hTK1RxqnOVC5U9c29QJfN8uMqPJ0GrCMVCV9hhJ5P9OQwm1Y2VTmFO7mKI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=VhCKUchz; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=gkOaMGeZ; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="VhCKUchz"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="gkOaMGeZ" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047874; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P30dBWA1MyC64IghHW8goqGFaOreNlbVUgKkpBmt6C8=; b=VhCKUchzW2jkYo2IElLPHEuGXMGqfgUNjhOn3H4j8jhZ1KDk6vcNLPaGEn2QLu+4mXphek AZWIszH8/X4p+wLYqngBQTLsp3+EfLq0YHPAOdKC7FBYIgYP3myBLoDpnB0HNwTKnZ5aou 7NTQT1+5sSrnz3YVVjetjhSq0a1fgmF/3xnCDwJkzJAAf9HKaMTsbxt3YnDJ1GvkZ/O+SJ 8nC6NPlM7xriJWGOIZTZvUYxzx3sbfEzEGcnqyk0Pluv2U8KS/G4kbouop58a5ufKvVKQs pCyznRBD/bkfr5zDS7RMBkAti9Z3J0NqNcZ0xZw+AoN8aizOrm+M6EDQPG8abA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047874; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P30dBWA1MyC64IghHW8goqGFaOreNlbVUgKkpBmt6C8=; b=gkOaMGeZxPabUKW71HBAwLSgJpm6Hso1r5Hq+2/X5gyICgFP82Ubzmv4DoHBC/HugS09E2 0K8fFIoTmlnKsaCQ== Date: Thu, 13 Nov 2025 16:30:27 +0100 Subject: [PATCH v2 11/14] selftests: vDSO: vdso_test_correctness: Use types from vdso_types.h Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-11-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=3377; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=uJOJhxejWK+Gv4jZ7aDxLph4kD0E0+67toIKhnu+YDw=; b=pANw5TIVGG8yGHh7JW3+43+Pphgf/H1YSMHKMeY5iLFIjrPLmRuZydx8LEmB8gs+mTH0Q6uBT k+Frb1vKJxRDLbC/nizllijtqAKGpSao8VCZJ5iVE80BFQOoA+GjExf X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The libc types are not necessarily compatible with the vDSO functions. Use the dedicated types from vdso_types.h instead. Signed-off-by: Thomas Wei=C3=9Fschuh --- .../testing/selftests/vDSO/vdso_test_correctness.c | 38 ++++++++----------= ---- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/t= esting/selftests/vDSO/vdso_test_correctness.c index 5a127fc93e7368cbe8d9fb4a4482a6a735ffd46c..276446d24f55d6b28910320e3d6= 01bac501c2ca1 100644 --- a/tools/testing/selftests/vDSO/vdso_test_correctness.c +++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c @@ -7,7 +7,6 @@ #define _GNU_SOURCE =20 #include -#include #include #include #include @@ -21,6 +20,7 @@ =20 #include "vdso_config.h" #include "vdso_call.h" +#include "vdso_types.h" #include "../kselftest.h" =20 static const char **name; @@ -29,29 +29,14 @@ static const char **name; #define __NR_clock_gettime64 403 #endif =20 -#ifndef __kernel_timespec -struct __kernel_timespec { - long long tv_sec; - long long tv_nsec; -}; -#endif - /* max length of lines in /proc/self/maps - anything longer is skipped her= e */ #define MAPS_LINE_LEN 128 =20 int nerrs =3D 0; =20 -typedef int (*vgettime_t)(clockid_t, struct timespec *); - -vgettime_t vdso_clock_gettime; - -typedef int (*vgettime64_t)(clockid_t, struct __kernel_timespec *); - -vgettime64_t vdso_clock_gettime64; - -typedef long (*vgtod_t)(struct timeval *tv, struct timezone *tz); - -vgtod_t vdso_gettimeofday; +vdso_clock_gettime_t vdso_clock_gettime; +vdso_clock_gettime64_t vdso_clock_gettime64; +vdso_gettimeofday_t vdso_gettimeofday; =20 typedef long (*getcpu_t)(unsigned *, unsigned *, void *); =20 @@ -124,17 +109,17 @@ static void fill_function_pointers(void) =20 vgetcpu =3D (getcpu_t) vsyscall_getcpu(); =20 - vdso_clock_gettime =3D (vgettime_t)dlsym(vdso, name[1]); + vdso_clock_gettime =3D (vdso_clock_gettime_t)dlsym(vdso, name[1]); if (!vdso_clock_gettime) printf("Warning: failed to find clock_gettime in vDSO\n"); =20 #if defined(VDSO_32BIT) - vdso_clock_gettime64 =3D (vgettime64_t)dlsym(vdso, name[5]); + vdso_clock_gettime64 =3D (vdso_clock_gettime64_t)dlsym(vdso, name[5]); if (!vdso_clock_gettime64) printf("Warning: failed to find clock_gettime64 in vDSO\n"); #endif =20 - vdso_gettimeofday =3D (vgtod_t)dlsym(vdso, name[0]); + vdso_gettimeofday =3D (vdso_gettimeofday_t)dlsym(vdso, name[0]); if (!vdso_gettimeofday) printf("Warning: failed to find gettimeofday in vDSO\n"); =20 @@ -252,7 +237,8 @@ static char const * const clocknames[] =3D { =20 static void test_one_clock_gettime(int clock, const char *name) { - struct timespec start, vdso, end; + struct __kernel_old_timespec vdso; + struct timespec start, end; int vdso_ret, end_ret; =20 printf("[RUN]\tTesting clock_gettime for clock %s (%d)...\n", name, clock= ); @@ -376,8 +362,10 @@ static void test_clock_gettime64(void) =20 static void test_gettimeofday(void) { - struct timeval start, vdso, end; - struct timezone sys_tz, vdso_tz; + struct __kernel_old_timeval vdso; + struct kernel_timezone vdso_tz; + struct timeval start, end; + struct timezone sys_tz; int vdso_ret, end_ret; =20 if (!vdso_gettimeofday) --=20 2.51.0 From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 539CC3570B0; Thu, 13 Nov 2025 15:31:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047878; cv=none; b=ggsdx0oACMrqe1hRRWhP5PW32HWUOEoNqDV4A4V1GDMNzZxl1wIAtALgXpN95+oUIIlPTkpOwOdOovrCWTsFM3su+TyuT40AGelO0II6+GmXU6f2GnpHDZDzE8qo3N4sDJnbjPiQjyEIL1aWJ1imU07d7yLK8i/EzdXIBRvWo28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047878; c=relaxed/simple; bh=tY9DN2SUv82NrViCPQmv/VBRBqsvVDFw04Mj21smQY8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Jm2KR41bfySLYo+jrNJdhIBD9e+TYf9jssDXM8u9wWjX77T7Bbe7hYGdYnUNGHia3lyPk/25lQi4yrkqvkDcxl98R1oUaw4e80jKJ+pdo+5g14Va/C2oXeOJGeZCx2R6cyoMxwcNzuzhaLdbIBE+gOPAeXK65rDFrXvc+SX1/tE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=skwbFSod; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=fU+7sjRf; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="skwbFSod"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fU+7sjRf" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047875; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gWkuvyexKAL9zkJaKecsm5/FPgL2CY5qnocQcUmqwFY=; b=skwbFSod4+08MuuyFUU8zqJGu8iReJ9NUnNN7I2tgX1X9q0N5+SRu7uISlmOUxV1eJQLa/ ExvPxEcvqxLUP2TqJ0AZQ9SQDjdeSCHZYpUEWxs9jccpQTIzzkARj7GZ4THl4XGLEnDMua qZ43+1Dx1xsSMZOLgPSTKqTyeAI+UwBgpkg0F2BeFUaxGGAQbtztd4oSaEtmyjH+HJ1vdv BTnebr4fzrV8rRS+bECua3LnZWdJrLYjAkGWuqL64L7Ckeqil4L6HA8ztHj7nMSnuD5cfk 9kq2qyZruJ7uNrnT/iIGeWKQul1oDO1NqNR5P1T3LJmvon1StnIC015pYymYHg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047875; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gWkuvyexKAL9zkJaKecsm5/FPgL2CY5qnocQcUmqwFY=; b=fU+7sjRffHOxHjxw9YTkQ6EYRu5d7fxex/VTTdBVaRXwU0wvZ8fjT5kPNeMYdRshq9T3ws hwBmtK1+ci8Me9Ag== Date: Thu, 13 Nov 2025 16:30:28 +0100 Subject: [PATCH v2 12/14] selftests: vDSO: vdso_test_correctness: Use system call wrappers from vdso_syscalls.h Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-12-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=3603; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=tY9DN2SUv82NrViCPQmv/VBRBqsvVDFw04Mj21smQY8=; b=EZVSO9ciO4fY5Kaz2/z11hM1t1srBYjU5Lq/azx43ptEbWWSQHzcd/SOYdJtjgRcIF4gA7e+j Ps4E5LIg0ymCv6WPstfezMf8Gj/nokF4ZUK4SbFH+hNvMnWiu3P/hu8 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Using syscall() is problematic for the reasons outlined in vdso_syscalls.h. Use the wrappers from the utility header instead. Signed-off-by: Thomas Wei=C3=9Fschuh --- .../testing/selftests/vDSO/vdso_test_correctness.c | 34 ++++++------------= ---- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/t= esting/selftests/vDSO/vdso_test_correctness.c index 276446d24f55d6b28910320e3d601bac501c2ca1..ac5fa3e906806c28d3238e6f4e7= 67e370932c5d1 100644 --- a/tools/testing/selftests/vDSO/vdso_test_correctness.c +++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c @@ -20,6 +20,7 @@ =20 #include "vdso_config.h" #include "vdso_call.h" +#include "vdso_syscalls.h" #include "vdso_types.h" #include "../kselftest.h" =20 @@ -131,21 +132,6 @@ static long sys_getcpu(unsigned * cpu, unsigned * node, return syscall(__NR_getcpu, cpu, node, cache); } =20 -static inline int sys_clock_gettime(clockid_t id, struct timespec *ts) -{ - return syscall(__NR_clock_gettime, id, ts); -} - -static inline int sys_clock_gettime64(clockid_t id, struct __kernel_timesp= ec *ts) -{ - return syscall(__NR_clock_gettime64, id, ts); -} - -static inline int sys_gettimeofday(struct timeval *tv, struct timezone *tz) -{ - return syscall(__NR_gettimeofday, tv, tz); -} - static void test_getcpu(void) { printf("[RUN]\tTesting getcpu...\n"); @@ -237,8 +223,8 @@ static char const * const clocknames[] =3D { =20 static void test_one_clock_gettime(int clock, const char *name) { + struct __kernel_timespec start, end; struct __kernel_old_timespec vdso; - struct timespec start, end; int vdso_ret, end_ret; =20 printf("[RUN]\tTesting clock_gettime for clock %s (%d)...\n", name, clock= ); @@ -269,9 +255,9 @@ static void test_one_clock_gettime(int clock, const cha= r *name) } =20 printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n", - (unsigned long long)start.tv_sec, start.tv_nsec, - (unsigned long long)vdso.tv_sec, vdso.tv_nsec, - (unsigned long long)end.tv_sec, end.tv_nsec); + (unsigned long long)start.tv_sec, (unsigned long)start.tv_nsec, + (unsigned long long)vdso.tv_sec, (unsigned long)vdso.tv_nsec, + (unsigned long long)end.tv_sec, (unsigned long)end.tv_nsec); =20 if (!ts_leq(&start, &vdso) || !ts_leq(&vdso, &end)) { printf("[FAIL]\tTimes are out of sequence\n"); @@ -305,7 +291,7 @@ static void test_one_clock_gettime64(int clock, const c= har *name) =20 printf("[RUN]\tTesting clock_gettime64 for clock %s (%d)...\n", name, clo= ck); =20 - if (sys_clock_gettime64(clock, &start) < 0) { + if (sys_clock_gettime(clock, &start) < 0) { if (errno =3D=3D EINVAL) { vdso_ret =3D VDSO_CALL(vdso_clock_gettime64, 2, clock, &vdso); if (vdso_ret =3D=3D -EINVAL) { @@ -321,7 +307,7 @@ static void test_one_clock_gettime64(int clock, const c= har *name) } =20 vdso_ret =3D VDSO_CALL(vdso_clock_gettime64, 2, clock, &vdso); - end_ret =3D sys_clock_gettime64(clock, &end); + end_ret =3D sys_clock_gettime(clock, &end); =20 if (vdso_ret !=3D 0 || end_ret !=3D 0) { printf("[FAIL]\tvDSO returned %d, syscall errno=3D%d\n", @@ -362,10 +348,8 @@ static void test_clock_gettime64(void) =20 static void test_gettimeofday(void) { - struct __kernel_old_timeval vdso; - struct kernel_timezone vdso_tz; - struct timeval start, end; - struct timezone sys_tz; + struct __kernel_old_timeval start, vdso, end; + struct kernel_timezone vdso_tz, sys_tz; int vdso_ret, end_ret; =20 if (!vdso_gettimeofday) --=20 2.51.0 From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44453357718; Thu, 13 Nov 2025 15:31:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047879; cv=none; b=fQr3azNaAzLcjfaqBGRfZ/fI1GHAJC3ao+P0GN8qsGPxZlcfQM+kRCT1/qzosrgV5Vp8cxGYLHLsktZJrqWCWYf2sG7/VhFZrj2yTP85NKC5aAm71BfMsFKi/wwZIZ2JSnUwNknrnvDORMPmOfCLJhWYv5GiwHsL5tkIvGS0vJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047879; c=relaxed/simple; bh=LJAX46aHnRmsKlsk759IEhxLTOisIPDMEme8ejGdai4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=peX09pXiLbhMLCfAYsKC9ZI5tDtgA3xPJHpBIjfMbS6A7FRuqHBO7SESu7SC2ZgFzGO8zG72lEr1xmgivy+QwIx0hQnkcVY4U32yk017gOXjNTfuXchpLN1q95kN6s03zAGLxnaMu1S5+ieKq8KhP3xs9CwDxv43CTR4TdciiLY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=kIalnQ3H; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=K1mmvDRf; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="kIalnQ3H"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="K1mmvDRf" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047875; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pKjXgtAOgZVyQ2FoIi7WihbBl5GtnPPYa5CAXSqUp0o=; b=kIalnQ3HVEZBUOnoGr99xjt4rHfMNQZ8bpRbJRkXDfEBfnBQUsXWONFUCT7w9/FX/7dA7t PGdrXv4X13SVGl6ugzBgznSknS0QfzCnD/5jbOmi4gh2X/ofygpzuhAWBb3dJWvAnhtIbA /pBt66mbUN2Bg7G33S/TbiazgvUhMgUPxepu0L4GC0qzdZm7ayhMS2dtARWTFCuCdCRJAM Rgo8xsYhkSM3xoEQwmKNEqXBZTcy/qZpopvyj7jGN3bBcmh7KonLzltb3QdpJW1PAk0IEb xbQo7pjR10TOpqS9IWWTNIpI3sMD/uGf9kKDzwOXJqOOtwU1Ba6aO+tp6BfVsQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047875; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pKjXgtAOgZVyQ2FoIi7WihbBl5GtnPPYa5CAXSqUp0o=; b=K1mmvDRfjubh8P/ToZepC/t0hou1voPH81b1lbbEQuEAwhbfv1fqVzq/xX1mDXZuWqm7i3 4MuAjrAAPjsE4pBw== Date: Thu, 13 Nov 2025 16:30:29 +0100 Subject: [PATCH v2 13/14] selftests: vDSO: vdso_test_correctness: Use facilities from parse_vdso.c Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-13-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=4422; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=LJAX46aHnRmsKlsk759IEhxLTOisIPDMEme8ejGdai4=; b=/7FiC3tqoDTQbY/cCOz83V/JQhT3c5SEBGUGvv8aP/R4y3VxmYvJMM1+hEiQPvzoIfvDnrxBc jlFzhqdy5JbBNLdqFEy4XhBNjEJvxBKPLbfotj/kQ3g7Z/0aWbutfOu X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The soname from the vDSO is not a public API. Furthermore it requires libc to implement dlsym() and friends. Use the facilities from parse_vdso.c instead which uses the official vDSO ABI to find it, aligned with the other vDSO selftests. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/vDSO/Makefile | 4 +-- .../testing/selftests/vDSO/vdso_test_correctness.c | 30 ++++++++++--------= ---- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftest= s/vDSO/Makefile index 74dfc60e636edce91cc1df9643ca8aa008ecfe65..504b30155ae7c6da3065c447238= 4f54e5547332a 100644 --- a/tools/testing/selftests/vDSO/Makefile +++ b/tools/testing/selftests/vDSO/Makefile @@ -26,13 +26,11 @@ CFLAGS_NOLIBC :=3D -nostdlib -nostdinc -ffreestanding -= fno-asynchronous-unwind-tab $(OUTPUT)/vdso_test_gettimeofday: parse_vdso.c vdso_test_gettimeofday.c $(OUTPUT)/vdso_test_getcpu: parse_vdso.c vdso_test_getcpu.c $(OUTPUT)/vdso_test_abi: parse_vdso.c vdso_test_abi.c +$(OUTPUT)/vdso_test_correctness: parse_vdso.c vdso_test_correctness.c =20 $(OUTPUT)/vdso_standalone_test_x86: vdso_standalone_test_x86.c parse_vdso.= c | headers $(OUTPUT)/vdso_standalone_test_x86: CFLAGS:=3D$(CFLAGS_NOLIBC) $(CFLAGS) =20 -$(OUTPUT)/vdso_test_correctness: vdso_test_correctness.c -$(OUTPUT)/vdso_test_correctness: LDFLAGS +=3D -ldl - $(OUTPUT)/vdso_test_getrandom: parse_vdso.c $(OUTPUT)/vdso_test_getrandom: CFLAGS +=3D -isystem $(top_srcdir)/tools/in= clude \ $(KHDR_INCLUDES) \ diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/t= esting/selftests/vDSO/vdso_test_correctness.c index ac5fa3e906806c28d3238e6f4e767e370932c5d1..310688e1379511e2c564b460c63= 79cc00b7a5f9a 100644 --- a/tools/testing/selftests/vDSO/vdso_test_correctness.c +++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c @@ -10,20 +10,22 @@ #include #include #include +#include #include -#include #include #include #include #include #include =20 +#include "parse_vdso.h" #include "vdso_config.h" #include "vdso_call.h" #include "vdso_syscalls.h" #include "vdso_types.h" #include "../kselftest.h" =20 +static const char *version; static const char **name; =20 #ifndef __NR_clock_gettime64 @@ -88,39 +90,32 @@ static void *vsyscall_getcpu(void) =20 static void fill_function_pointers(void) { - void *vdso =3D dlopen("linux-vdso.so.1", - RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD); - if (!vdso) - vdso =3D dlopen("linux-gate.so.1", - RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD); - if (!vdso) - vdso =3D dlopen("linux-vdso32.so.1", - RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD); - if (!vdso) - vdso =3D dlopen("linux-vdso64.so.1", - RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD); - if (!vdso) { + unsigned long sysinfo_ehdr =3D getauxval(AT_SYSINFO_EHDR); + + if (!sysinfo_ehdr) { printf("[WARN]\tfailed to find vDSO\n"); return; } =20 - vdso_getcpu =3D (getcpu_t)dlsym(vdso, name[4]); + vdso_init_from_sysinfo_ehdr(sysinfo_ehdr); + + vdso_getcpu =3D (getcpu_t)vdso_sym(version, name[4]); if (!vdso_getcpu) printf("Warning: failed to find getcpu in vDSO\n"); =20 vgetcpu =3D (getcpu_t) vsyscall_getcpu(); =20 - vdso_clock_gettime =3D (vdso_clock_gettime_t)dlsym(vdso, name[1]); + vdso_clock_gettime =3D (vdso_clock_gettime_t)vdso_sym(version, name[1]); if (!vdso_clock_gettime) printf("Warning: failed to find clock_gettime in vDSO\n"); =20 #if defined(VDSO_32BIT) - vdso_clock_gettime64 =3D (vdso_clock_gettime64_t)dlsym(vdso, name[5]); + vdso_clock_gettime64 =3D (vdso_clock_gettime64_t)vdso_sym(version, name[5= ]); if (!vdso_clock_gettime64) printf("Warning: failed to find clock_gettime64 in vDSO\n"); #endif =20 - vdso_gettimeofday =3D (vdso_gettimeofday_t)dlsym(vdso, name[0]); + vdso_gettimeofday =3D (vdso_gettimeofday_t)vdso_sym(version, name[0]); if (!vdso_gettimeofday) printf("Warning: failed to find gettimeofday in vDSO\n"); =20 @@ -398,6 +393,7 @@ static void test_gettimeofday(void) =20 int main(int argc, char **argv) { + version =3D versions[VDSO_VERSION]; name =3D (const char **)&names[VDSO_NAMES]; =20 fill_function_pointers(); --=20 2.51.0 From nobody Sun Feb 8 13:38:52 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89A15357730; Thu, 13 Nov 2025 15:31:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047879; cv=none; b=gNolb+jOIONy5rezLIusGTl7DrxepB0F2Z4nLnic1nlKCeVvXMRWtO7a9lvJh9JW8DjaCqJacDoAQa6kGFY3N1Z0RRCj/jv01tOpvkHZDYW6eyjzaM6TI4MpLtiFWxsNBPOW4bqC3m4LT4C3HY46dLiBNwvPcZ6K0jGzsManLrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763047879; c=relaxed/simple; bh=yQtaOuCaIsMQjQ4M8xqRBfW+q2rzwXjGt2L7OEAlzhg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZkvT1QH7rlG8LLjFGD20ZQyY027JGuSlh9TBInbYpkz+BA8cnEMHiEf+0aordM8xb0ztMNKrUQ+8sr7Eh2tVMwthB0G1r5JJkvgQlnGnRx65tn602IDUWvPOmzV/qfb1VguS/tvTYKhG1b676zzClKREUcLTnU16NT4tLDPvAx8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=fFGJkT48; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=R42RNpsE; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fFGJkT48"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="R42RNpsE" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763047876; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KCFV5muUruf97pIQlSOFXaHRzeiwsPbZEMNS88UrLoQ=; b=fFGJkT48z1X8w71KEcNIuu/ctUBU41g7kUZymnzWi2GQlX4ScSbRIX1oe8nNZNFbxAxK6n IDcjC/uEqOIvFOZ02u8On3mMdM9iRIz+C2A24gh6NPqSYNzw7KCsocW8NHbVgUlE8JNCJD 57FmL9PcrV9Fgp8MgpCY7Aq8z5kXYT52PukRTHL019hZPhIt7QEihHZtGd00QXxY7HLJlA WdZJVzulAp8eApNQk9R1TTrKwzdU7wrP0uLHoL48RvXjCZ2HvePTIelGYbzI3iHsSx6FI3 WndyfY63EGt+mb1oiVcN+7mB892zjIVVUUSge+bfmQYrIAllBVNK+CuyzCEyZw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763047876; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KCFV5muUruf97pIQlSOFXaHRzeiwsPbZEMNS88UrLoQ=; b=R42RNpsER2k3yPKpUQ5Y8fhPbHLlHpHhn04X3lOOgiY6le6eb2wb5jE3mOcnubLHBNOJGu iafC0tMTqoL79/Bw== Date: Thu, 13 Nov 2025 16:30:30 +0100 Subject: [PATCH v2 14/14] selftests: vDSO: vdso_test_correctness: Add a test for time() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251113-vdso-test-types-v2-14-0427eff70d08@linutronix.de> References: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> In-Reply-To: <20251113-vdso-test-types-v2-0-0427eff70d08@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763047863; l=2587; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=yQtaOuCaIsMQjQ4M8xqRBfW+q2rzwXjGt2L7OEAlzhg=; b=IX5QJJU8/3fdsnRR4S2afWqk1eN7EAfAr2jkgkgtSB5Msd3k2rFB5yECTk1EqVPCVseRM5EzD tri/VPHKQHqAwi1o/BCMvqtru+qC2sdkgMaBZa+qjmCn6ZazWt6QPkJ X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Extend the test to also cover the time() function. Signed-off-by: Thomas Wei=C3=9Fschuh --- .../testing/selftests/vDSO/vdso_test_correctness.c | 49 ++++++++++++++++++= ++++ 1 file changed, 49 insertions(+) diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/t= esting/selftests/vDSO/vdso_test_correctness.c index 310688e1379511e2c564b460c6379cc00b7a5f9a..67cb8f11aa3c6977616def286b9= a7d35fa6579e7 100644 --- a/tools/testing/selftests/vDSO/vdso_test_correctness.c +++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c @@ -40,6 +40,7 @@ int nerrs =3D 0; vdso_clock_gettime_t vdso_clock_gettime; vdso_clock_gettime64_t vdso_clock_gettime64; vdso_gettimeofday_t vdso_gettimeofday; +vdso_time_t vdso_time; =20 typedef long (*getcpu_t)(unsigned *, unsigned *, void *); =20 @@ -119,6 +120,10 @@ static void fill_function_pointers(void) if (!vdso_gettimeofday) printf("Warning: failed to find gettimeofday in vDSO\n"); =20 + vdso_time =3D (vdso_time_t)vdso_sym(version, name[2]); + if (!vdso_time) + printf("Warning: failed to find time in vDSO\n"); + } =20 static long sys_getcpu(unsigned * cpu, unsigned * node, @@ -391,6 +396,49 @@ static void test_gettimeofday(void) VDSO_CALL(vdso_gettimeofday, 2, &vdso, NULL); } =20 +static void test_time(void) +{ + __kernel_old_time_t start, end, vdso_ret, vdso_param; + + if (!vdso_time) + return; + + printf("[RUN]\tTesting time...\n"); + + if (sys_time(&start) < 0) { + printf("[FAIL]\tsys_time failed (%d)\n", errno); + nerrs++; + return; + } + + vdso_ret =3D VDSO_CALL(vdso_time, 1, &vdso_param); + end =3D sys_time(NULL); + + if (vdso_ret < 0 || end < 0) { + printf("[FAIL]\tvDSO returned %d, syscall errno=3D%d\n", + (int)vdso_ret, errno); + nerrs++; + return; + } + + printf("\t%lld %lld %lld\n", + (long long)start, + (long long)vdso_ret, + (long long)end); + + if (vdso_ret !=3D vdso_param) { + printf("[FAIL]\tinconsistent return values: %lld %lld\n", + (long long)vdso_ret, (long long)vdso_param); + nerrs++; + return; + } + + if (!(start <=3D vdso_ret) || !(vdso_ret <=3D end)) { + printf("[FAIL]\tTimes are out of sequence\n"); + nerrs++; + } +} + int main(int argc, char **argv) { version =3D versions[VDSO_VERSION]; @@ -401,6 +449,7 @@ int main(int argc, char **argv) test_clock_gettime(); test_clock_gettime64(); test_gettimeofday(); + test_time(); =20 /* * Test getcpu() last so that, if something goes wrong setting affinity, --=20 2.51.0