From nobody Tue Feb 10 02:59: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 508B43019D6 for ; Fri, 30 Jan 2026 13:30:09 +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=1769779810; cv=none; b=fxOnr3SYnab/BDDRaTnTozigjzwj9FFHhRatvDS214KMIHWV4fok2edF4+OlthD/cJdKeOzETXBfC/BlqepoO78TjeMaCIk8cK+6JiZG3kGHTs6BKavD4lerqVz9RLKdvt1evx0j/H3QK/+KbKmOO1pw5bMHzkrFvqUPBaShnAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769779810; c=relaxed/simple; bh=26nK5ZuTSH07Hc66Z0TGP4MV/KjUVkYvGOV4qaYkpHE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ZDrlSpcsU+WeMM64tdTF5gaVK9/RpXzVTlCXl1DPc012MusZXQ3FOsG/qMW4MkhKcL9+kjDuzohCUaW+uTH/ebyRAiNCFengJ12unhot0d4JJzzjneI9B7BGpYA/r3E3Jxrt0/lDNhskfs+JYslvswXfipGpQF0/oS1rLxgg984= 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=UA/LVt28; 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="UA/LVt28" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-48025e12b5bso35329785e9.2 for ; Fri, 30 Jan 2026 05:30:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769779808; x=1770384608; 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=ah0eS4SkK+p5W7jb3OOf6k8LtqY2IjJqo0gqvKUDvkY=; b=UA/LVt28VdvUGx7LrOwb++LDTM5EKu+uZH2uIkzO9tyHque+VS3R6XSwL4Gi/ORfwv uoB4VCmcBI1bh4PxzvutsKJIWSqTGawLtYm5kSQl3tfb9Y9ydokw4dHPbVZLEa85pMk2 qYTfEdbV5mSFV7HDANrpf49gGzMl3/NTSf1WPv/sEVefwrbhB0DVr+Qe5AFtYWeg2TEV L2JT8KDd0A7CkOAfClsxQl+kI7UpcZOosI8E0D/UncUkVqW2DVxq8ZonHCDUQXwTWGJJ 6Oq2iWMXIkAzgmEWySvdTyWreHsTub9NFEcI2uzQyddDDn7+mwO0jkgnA6I3T0vGYxEe fGiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769779808; x=1770384608; 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=ah0eS4SkK+p5W7jb3OOf6k8LtqY2IjJqo0gqvKUDvkY=; b=dn9QvBObHcPcVRWOp4cpaiQDoXczU/eyungiIdxMdyv/EZEHNvOAMB/CxD5ooGriG5 6vFs69S8H7HELHm6+8l97hlU9pZ+Fhi0LsWO5CDMmx03/e7yrFf51gk04hQfHvyBiqNC YP2+gFM9gh3eeK+sgcDFWpkbDddiKVDH9V7bWfxV/h9ciDts4CxRhp7VbT0/+0gJokBA QL2FjL2cjZAMED5VFeKkrDP4OtOW/MGygMEoAzdGJYZ1ktuILdPeJThDTngyu3eYB81u 3/UeoA0rh8eiCBO9ttQp61j5S4JldhBM7mBABfWsealMsPsvZB8IfXu5uSi1pbp8JplL He/g== X-Forwarded-Encrypted: i=1; AJvYcCXaeKPHqY7NRlO6QZlLQZArHN25SjdZq/hKOYYJnMyjGcVxWlwAnhbwzCQTo//nqykIyErbyoux5Yajpbw=@vger.kernel.org X-Gm-Message-State: AOJu0YyJ8YtElCg6rje3e3bFZH5MKiXjEcnqPgMSQ1n+WseSCZOh3aJr +2thI5cnL9PAAOGglVVJqyb68Qs8TNhQ7h+HHmWJduFaNGkS8zX4Dm9FQGZmm9UhxJKD7y+VrE3 YSw== X-Received: from wmby7.prod.google.com ([2002:a05:600c:c047:b0:477:a678:a39a]) (user=elver job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:3b1d:b0:477:9cdb:e32e with SMTP id 5b1f17b1804b1-482db46014dmr37732115e9.9.1769779807742; Fri, 30 Jan 2026 05:30:07 -0800 (PST) Date: Fri, 30 Jan 2026 14:28:24 +0100 In-Reply-To: <20260130132951.2714396-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: <20260130132951.2714396-1-elver@google.com> X-Mailer: git-send-email 2.53.0.rc1.225.gd81095ad13-goog Message-ID: <20260130132951.2714396-2-elver@google.com> Subject: [PATCH v3 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, David Laight , Catalin Marinas , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Boqun Feng 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: Reviewed-by: Boqun Feng Signed-off-by: Marco Elver Tested-by: David Laight --- 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.53.0.rc1.225.gd81095ad13-goog