From nobody Fri Jun 12 14:18:25 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 F3F46368D67; Thu, 14 May 2026 10:32:05 +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=1778754727; cv=none; b=WXrxCJ/AxsOZtbV5SSlvjA+E5szkPeaIzm2d7A9HLBCiPMwUlNZlqM7tI2BlFiyrEytSxGrROh7XvMWQ4CkxCXNyZXiSsFkXr6eQ460rV2BgBxhmetjmn+EPFIW1mvv11tQtZciGz1xvJiipWEstn5iB9jCGvXAfSbbx9GB5GQk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778754727; c=relaxed/simple; bh=BtsqV5/kHSIXSbhgw3gNRFPYBVqNmovrQXBzEYRt/Qk=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=KylWAKV2UEceudWVciz/vIaluMdGZewjeP9ZDfy37MjnSciVF5rSp4GWHJ0RADJwoGbo/TRDF6n9Vc9nsj3VJNOl0065/FXoQON8yBnjLGLN6ElWAR3dl7P/ehyLi1xm2hV8TXYjs7HoSH04z7xx1+Gy0ZgJbACzNftddqLuTI8= 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=wGgS6pjw; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=VrVjNsPO; 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="wGgS6pjw"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="VrVjNsPO" Date: Thu, 14 May 2026 10:31:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1778754717; 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=K503ry3u67hK+FLRPdyd1m652P0seiG0LZcP/gV7DrQ=; b=wGgS6pjwWvlZNVloZsmMuIVlhRGEn6QmZwmwxjnoJHn9yb6U4xbMHFpdhXarTz/kETi5sQ WS9oRD+fETO6bDFhidwgQbKKE3By99xFunCOZzj/Goqxc76yllTWHz7C4aWq0bfDCbPVqG +imXu4E26pps+IKTvMZeyFgzjzhixK/JEx/Ak9AVaj2asyUBfjswDBlcgOANi9tnB2Jq4X g62hPKxLRZ5QONQiktdCu3o/RkKJ1zK0ctrRRWfITJqzMBCGoDq7/b2Ig55tQOn0JoA/H5 bq8xYJWptZfEM2/m065qkvt5XamAcV9g32ww5swJ5IQRSQ4DVz5HC1v8c600uA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1778754717; 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=K503ry3u67hK+FLRPdyd1m652P0seiG0LZcP/gV7DrQ=; b=VrVjNsPOQggrnzTsM+bziC5UtUnuL871tTkQJi1efPHSIx38GSdte/kypExGCLkVkYX2bM SBT14QRN2nrzBKCw== 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/urgent] vdso/gettimeofday: Reload sequence counter after switch to time page in do_aux() Cc: Ricardo Ribalda , thomas.weissschuh@linutronix.de, Thomas Gleixner , "Christophe Leroy (CS GROUP)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260422-vdso-aux-timens-loop-v1-1-e2dd8c7164cc@linutronix.de> References: <20260422-vdso-aux-timens-loop-v1-1-e2dd8c7164cc@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177875471468.188840.7600628520602693493.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/urgent branch of tip: Commit-ID: 602d60ebae0f10bfbc7ba90eee026fdbd0203df3 Gitweb: https://git.kernel.org/tip/602d60ebae0f10bfbc7ba90eee026fdbd= 0203df3 Author: Thomas Wei=C3=9Fschuh AuthorDate: Wed, 22 Apr 2026 11:42:32 +02:00 Committer: Thomas Gleixner CommitterDate: Thu, 14 May 2026 12:30:53 +02:00 vdso/gettimeofday: Reload sequence counter after switch to time page in do_= aux() After switching to the real data pages, the sequence counter needs to be reloaded from there. The code using vdso_read_begin_timens() assumed this worked by 'continue' jumping to the *beginning* of the do-while retry loop. However the 'continue' jumps to the *end* of said loop, evaluating the exit condition. If the data page has a sequence counter of '1' it will match the one from the time namespace page and prematurely exit the retry loop. This would result in garbage returned to the caller. Reload the sequence counter after switching the pages by using an inner while loop again, which will loop at most once. The loop generates slightly better code than an explicit reload through 'seq =3D vdso_read_begin()'. Fixes: ed78b7b2c5ae ("vdso/gettimeofday: Add a helper to read the sequence = lock of a time namespace aware clock") Reported-by: Ricardo Ribalda Signed-off-by: Thomas Wei=C3=9Fschuh Signed-off-by: Thomas Gleixner Tested-by: Ricardo Ribalda Reviewed-by: Christophe Leroy (CS GROUP) Link: https://patch.msgid.link/20260422-vdso-aux-timens-loop-v1-1-e2dd8c716= 4cc@linutronix.de Closes: https://lore.kernel.org/lkml/CANiDSCsOy0P1if-gJZqOM5pTJ0RDcwVfru1B7= KFbTOEMqjPKJw@mail.gmail.com/ --- lib/vdso/gettimeofday.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index a5798bd..da22401 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -248,11 +248,10 @@ bool do_aux(const struct vdso_time_data *vd, clockid_= t clock, struct __kernel_ti vc =3D &vd->aux_clock_data[idx]; =20 do { - if (vdso_read_begin_timens(vc, &seq)) { + while (vdso_read_begin_timens(vc, &seq)) { + /* Re-read from the real time data page, reload seq by looping */ vd =3D __arch_get_vdso_u_timens_data(vd); vc =3D &vd->aux_clock_data[idx]; - /* Re-read from the real time data page */ - continue; } =20 /* Auxclock disabled? */