From nobody Sun Feb 8 14:10:13 2026 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13A3718DB2A for ; Mon, 26 Jan 2026 00:33:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769387590; cv=none; b=tve+Vs9VP2gZ0v+RnjSGtjGMapfzGX/bXIJqrQlEmEGOcPRsgd5Pb9qCWgNXH/c83dRApz0bkfFmQFs5HESOGERzo4ktyLpLQ/AumZgPiV16NR9Hn3D38Au7HWm23eOWUKmxfOikwqy+YO9q5TJ66Aa3JDj1tgRCXptVKuoS70A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769387590; c=relaxed/simple; bh=LHP7vc+QAjKrcQ/nSd8XnShnI8hVZmkUtqzqx890SiM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=bi+RRpDZ1hlnS0kJ0KXuqphjYJTZ7ijZHfK/CVpBBkF89P8dX6QdtjSzOVWH+hNwbXMCOaYnnXkflQjXjHDwS4enWsNVeYewYHQFhDSyBIO/4g4iObUzKREteZ/hhuXtW+84MeN4Vr1h2KCj9yj0c1WbTfXAmnaH/1s9ftR+Zyw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--elver.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=AcETk8PD; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--elver.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AcETk8PD" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-4804157a3c9so43412925e9.1 for ; Sun, 25 Jan 2026 16:33:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769387587; x=1769992387; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=y+0aVR3neN19eb/78h0OkLoTFjYmtJx01fQbpzy1/E0=; b=AcETk8PDSMv8aVjSO+RdYOzTLb8vqVLKzAkIFVQ9+RAZJKz/9iYUVFDqUf6B3o3mM+ vw6y82JsMTl5hk8I83HFvpXzeqMsMOpLk4/GR2gVQ1xbSjfhENJu+hozVCk6h8DK1m8Z 3LZGmMatTig0blpyjcExkLhq2y65OCRtMc2Y/R0zmC3e+h48yJRitfTMjycJpZGk1HrR OMCO70jYyqTWXbPZqI4h05rQz2yn6Tmz7Tkbrf4sSfapav2CEJt1QBsfq+mkpY990IWL asvrt68VulZ0UIpqjvy6ERf8yBcD8MWrbYt2g99MvKCItp6VBZtt/Jk8EoqwWVP1ZzaQ ogug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769387587; x=1769992387; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=y+0aVR3neN19eb/78h0OkLoTFjYmtJx01fQbpzy1/E0=; b=LJZGNmPih3O/76zEB2p0xh5+ZgcFf8VEdcRbXO4u5YN1UVhd+O4/dCY/dva9w8bgUt HUViLhhJMM4666IMSrIb1XcKU8d/d+PfmkBcUNCu1CpRpPF7K8Vqw1trJhwu4MTBISA+ BQnQ2rA14uqWquWAUFSse4j2+8Fawv4n0XEoGfI12Lg653SLvWeglwuehCvb7RIy4k0R gFiPhddgS22wruxkxrnboj8faKtA0VUXHcQlgbP/3gMfk3zOjqZsU/qGxElRl5BMC85F 9b1DTpwWgJaV7THOp+W/K+NF7wWfVEiLKOWPz6r4nPDS0WNyWnKvk7rXMmXmjQ9XXFIf 54HQ== X-Forwarded-Encrypted: i=1; AJvYcCW1iHOSQwo1VbqLzi9fYhRDv5xv15mb535N3LENZ8tPnsIKCV85HeBVgxeGrNIjeYkmRxahyBYAXZxzhJU=@vger.kernel.org X-Gm-Message-State: AOJu0YwFSKzX0dOjTb1DK8596eabcV3kNQMJosL2ufDPG6WexSP1f7FM TS3deKPTDvaXJnY07TQDz/K+OyAptFX7oKLSBCKirsqU2p2RzjKePLER/TxzHvb0kOyi4MPOc7W 8pQ== X-Received: from wmne21.prod.google.com ([2002:a05:600c:4395:b0:477:a181:1922]) (user=elver job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600d:6405:10b0:475:dde5:d91b with SMTP id 5b1f17b1804b1-4805f624d56mr26596795e9.17.1769387587598; Sun, 25 Jan 2026 16:33:07 -0800 (PST) Date: Mon, 26 Jan 2026 01:25:10 +0100 In-Reply-To: <20260126002936.2676435-1-elver@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260126002936.2676435-1-elver@google.com> X-Mailer: git-send-email 2.52.0.457.g6b5491de43-goog Message-ID: <20260126002936.2676435-2-elver@google.com> Subject: [PATCH 1/3] arm64: Fix non-atomic __READ_ONCE() with CONFIG_LTO=y From: Marco Elver To: elver@google.com, Peter Zijlstra , Will Deacon Cc: Ingo Molnar , Thomas Gleixner , Boqun Feng , Waiman Long , Bart Van Assche , llvm@lists.linux.dev, Catalin Marinas , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The implementation of __READ_ONCE() under CONFIG_LTO=3Dy incorrectly qualified the fallback "once" access for types larger than 8 bytes, which are not atomic but should still happen "once" and suppress common compiler optimizations. The cast `volatile typeof(__x)` applied the volatile qualifier to the pointer type itself rather than the pointee. This created a volatile pointer to a non-volatile type, which violated __READ_ONCE() semantics. Fix this by casting to `volatile typeof(*__x) *`. With a defconfig + LTO + debug options build, we see the following functions to be affected: xen_manage_runstate_time (884 -> 944 bytes) xen_steal_clock (248 -> 340 bytes) ^-- use __READ_ONCE() to load vcpu_runstate_info structs Fixes: e35123d83ee3 ("arm64: lto: Strengthen READ_ONCE() to acquire when CO= NFIG_LTO=3Dy") Cc: Signed-off-by: Marco Elver --- arch/arm64/include/asm/rwonce.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/rwonce.h b/arch/arm64/include/asm/rwonc= e.h index 78beceec10cd..fc0fb42b0b64 100644 --- a/arch/arm64/include/asm/rwonce.h +++ b/arch/arm64/include/asm/rwonce.h @@ -58,7 +58,7 @@ default: \ atomic =3D 0; \ } \ - atomic ? (typeof(*__x))__u.__val : (*(volatile typeof(__x))__x);\ + atomic ? (typeof(*__x))__u.__val : (*(volatile typeof(*__x) *)__x);\ }) =20 #endif /* !BUILD_VDSO */ --=20 2.52.0.457.g6b5491de43-goog