From nobody Thu Apr 9 03:30:03 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 D35A63C4563; Wed, 11 Mar 2026 09: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=1773221470; cv=none; b=d3SyLsKKlHOhfVEiprbz+Abl95QzkYevda3Mt/wh9X/6mpeHUtugEUGRFfRSbGy91zPmrKFfMIpbo3FZM0dZQ03hv/izO27YFzdjXRE96XB01GmA9FMms72CqY3pWV8kXENSJlzp2poGH5l9HHPIwWRN2TtzelYGFku4/4ShS3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773221470; c=relaxed/simple; bh=7WApfW8P4U4q/5KknHP3fT+TyxuzIiPPpJ15NaxtI2s=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=rmgrX7h3cIusf49Vdn+QqJnm5DxMwr0XaES5YX2jzNjlVAk8bpQKpwrIfYmBghxE1ijursL+vZOEket549hU91VONA9G+u5qbe9VtsLt5+2ubzKcxKbzjGnbzXv388aWm9I5a4DSUq7DstqDTKJ3/r6v1xqTssAg55ANOe3DyNM= 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=M3PrJ1be; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=uUVSydpT; 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="M3PrJ1be"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="uUVSydpT" Date: Wed, 11 Mar 2026 09:31:05 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773221467; 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=faE/p8zNYrhzOX7mGF2mGVYt/oKtJQBTKZBscYdTcAw=; b=M3PrJ1bes1LsNw7P9EScLq2h44shaECb+zXWr8zsEzampLfMfiyxZJr4euH9iTW6hNfLYY YQ95iwyuEWb2Yg6vXwufG+4CATC0dqXIsjwE4vYGvQaTZy3Wmzg6ppPySlrkCj/H7OB0/c Hew46phe2HaIXz2vrrbJU2m+u8EWsBIKRYeYWETWE4hCQ8IbbBCWQe5ZCmvNgJbIafmBvA YH7oXCOStAEE1KgjRlIxspcOa4ZqwyPdA7fb8NoKQiwzddNVz79QVS4xgNU+ovuRNehpF7 w8aaU9o3kma0CdnvhHCniDa//Eem5tDG8VJDk+G6DDYfq0QK+kKMsLlo5nKnkA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773221467; 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=faE/p8zNYrhzOX7mGF2mGVYt/oKtJQBTKZBscYdTcAw=; b=uUVSydpTwLYsyk3F52y03uDeuZ7Ix3mYLGUFCrSQs7+I+eprlWNTybx4RHLCHMXQKN+fzL 2PDQlu2ROwYkE2Dg== 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 , 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: <177322146579.1647592.14707074796089546326.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: f7178f159b2a36d070fd43b0d751e4e4415ec39e Gitweb: https://git.kernel.org/tip/f7178f159b2a36d070fd43b0d751e4e44= 15ec39e Author: Thomas Wei=C3=9Fschuh AuthorDate: Fri, 27 Feb 2026 07:46:01 +01:00 Committer: Thomas Gleixner CommitterDate: Wed, 11 Mar 2026 10:27:40 +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 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,