From nobody Tue Apr 7 22:03:14 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 A5F373D16FE; Wed, 11 Mar 2026 14:51:30 +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=1773240692; cv=none; b=RrLeE3Apn+3q508sJPEHMUVRTdJcmYIZsBl1LAGqZ6h7kNZCrxRCI3q/iw8Ru2i+33Ggv/xkE/BY5jbn/K6wMx5hFxvLconxTrXE/l40uPovTcMU1Js+Mc1TSyOte1ufUgZh971LhESJ4SK0ewQ/u8AdhyM5DpuIPesE6P/JAkA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773240692; c=relaxed/simple; bh=1J8dJyFWt8Gt4ZYuSSFaCZbyPxOnOPPqnDKEabeDNdA=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=ODwm9dl8Uvsr4+B+fKcn45sz91vuCKZfFPWudDH4UDuSE978yWsBlpLI4QLMdyp4ajClj4LcgPKW7K1vbrHuRgO5KYJeTdIc+IuWHxDPKjdO5WzfDwyz0LZOSeb48uxPMvwatTgy/UaPch9APl9MfoxLlq5L3XI7cmHvywnw3RA= 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=heeFIxOl; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=wkkoPIey; 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="heeFIxOl"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wkkoPIey" Date: Wed, 11 Mar 2026 14:51:26 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773240688; h=from:from:sender:sender:reply-to: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=fBFFyMvPONzyCd9bRSerj1dwZZa8wB7VxqW6UL/73mo=; b=heeFIxOlQRquZQC7uSjZoS/LDsa17xKSN3o8viy2EJyJv6W1DO20xaOq7jQFMNWIASXJKW wXJ3XDvzDNi+AnXzBAn+nKbvHaCNtyjOpmOOvjffWjQGkIT1lkD9XNsb21sBvL0vkR8AUu Oj0rXVIJRpY1i5X13USguciYK68ylqHEggAzGtPUXfAekljaykUceU3J9abOMdpbUsRHd4 ITBrvywwGU/i/5F9rptFhK0JX+KD87FWoo8XtWzgG7VLoEAMnwJVV7sEAyMibOxTF66JoF QbXFduisIYG5tltL7CO9p3bPP8kjIzYPLWeJHyFGIAdHWA6fumaCav6B0Hs3ig== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773240688; h=from:from:sender:sender:reply-to: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=fBFFyMvPONzyCd9bRSerj1dwZZa8wB7VxqW6UL/73mo=; b=wkkoPIeyOK0MmgCwbhr2KF8t3Q4aGfBNTicbSN8L8KZmXXApa662T4kZVTvdCsQGaq/+Sv 1JKmzeW7W4VU/4AA== From: tip-bot2 for Thomas =?utf-8?q?Wei=C3=9Fschuh?= Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/vdso] selftests: vDSO: vdso_test_correctness: Add a test for time() Cc: thomas.weissschuh@linutronix.de, Thomas Gleixner , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260227-vdso-selftest-cleanups-v2-6-d84830fa8beb@linutronix.de> References: <20260227-vdso-selftest-cleanups-v2-6-d84830fa8beb@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177324068648.1647592.14145604398629769806.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/vdso branch of tip: Commit-ID: bed0053a6303d908266aaaabf4fa96e2d02a4abc Gitweb: https://git.kernel.org/tip/bed0053a6303d908266aaaabf4fa96e2d= 02a4abc Author: Thomas Wei=C3=9Fschuh AuthorDate: Fri, 27 Feb 2026 07:46:01 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 11 Mar 2026 15:23:24 +01:00 selftests: vDSO: vdso_test_correctness: Add a test for time() Extend the test to also cover the time() function. Signed-off-by: Thomas Wei=C3=9Fschuh Signed-off-by: Thomas Gleixner Signed-off-by: Borislav Petkov (AMD) Link: https://patch.msgid.link/20260227-vdso-selftest-cleanups-v2-6-d84830f= a8beb@linutronix.de --- tools/testing/selftests/vDSO/vdso_test_correctness.c | 66 +++++++++++- 1 file changed, 66 insertions(+) diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/t= esting/selftests/vDSO/vdso_test_correctness.c index a94ab4d..5c5a07d 100644 --- a/tools/testing/selftests/vDSO/vdso_test_correctness.c +++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c @@ -55,6 +55,10 @@ typedef long (*vgtod_t)(struct timeval *tv, struct timez= one *tz); =20 vgtod_t vdso_gettimeofday; =20 +typedef time_t (*vtime_t)(__kernel_time_t *tloc); + +vtime_t vdso_time; + typedef long (*getcpu_t)(unsigned *, unsigned *, void *); =20 getcpu_t vgetcpu; @@ -133,6 +137,10 @@ static void fill_function_pointers(void) if (!vdso_gettimeofday) printf("Warning: failed to find gettimeofday in vDSO\n"); =20 + vdso_time =3D (vtime_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, @@ -156,6 +164,16 @@ static inline int sys_gettimeofday(struct timeval *tv,= struct timezone *tz) return syscall(__NR_gettimeofday, tv, tz); } =20 +static inline __kernel_old_time_t sys_time(__kernel_old_time_t *tloc) +{ +#ifdef __NR_time + return syscall(__NR_time, tloc); +#else + errno =3D ENOSYS; + return -1; +#endif +} + static void test_getcpu(void) { printf("[RUN]\tTesting getcpu...\n"); @@ -422,6 +440,53 @@ 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) { + if (errno =3D=3D -ENOSYS) { + printf("[SKIP]\tNo time() support\n"); + } else { + 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]; @@ -432,6 +497,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,