From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382560; b=ZvrLCatWe/xFKfu1foCYrHt4s7B2Iq5zOKmyQgQ+q6Uri6mmPKaFIhuXRwX5oPZRMKJI uUHdW56mC63zBf9X6cePJbjTHeKZ98crOWZ9BGQg9ai2SdmEkXyJXADzOQPM0fSVk+xdQ 2a8CRvV6HMxWb8l2fXrBJ2uuIPxVBtOtSWhq4StQgtRZ/nmI/2ar4Y94X+gGlMwXx1Vma 2G3eg0HTcoAUDa172Dm4qxbU/Ad+WmloIGXCeizFwTlNm9X83KTG7n39R6T6Y67TJ3uFD Fi5yNweeRUCLeCVLWfTBYYz8ESKy7iEIttm9TNLPGwwGZt8rEmeNFeP1Ogbjodh1kpA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382560; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=coTp8t1vnGuEEfhZfihCAQfw6H6EGejIs/Dc+ceztJo=; b=FIp66Bn7MA9YzTuhMQxeQvEJG0nJw0Zf5eJOKtBoEIfib6M/3KNga5CYFXuhT4qljE1D bGKYXy9KQoEpPHxlwQ2Z11W/cbove88U4DRfNHK9pEkEveOD0OVCH1jIdd4lVza4EBVkE p99+ozCr74xJ7do0LPH+jSYk2z4yxGpDllK1FdImDv9NJthqdwmyZg84sytCJV11zdyJB dfnjAs2iYItmo2sjhkYpXpO5feez1YSfhRlF6uTHy9BuvxU4Eqg13TrbxcH62gzUKRTtL etUs+GHF4xRYcnRpVhN5APpxZy9Lsf6ZaQ64/1sGEhwtf4rB8T+VPSbJ06ryAtK156Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=pIwICZz0; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B540606A32F; Fri, 4 Dec 2026 11:09:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=pIwICZz0 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EC391F000C2; Fri, 4 Dec 2026 11:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382559; bh=coTp8t1vnGuEEfhZfihCAQfw6H6EGejIs/Dc+ceztJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pIwICZz0j1piywWyDP5D9LjnuUJTExeWqON+zAzWQxx68Bl5rcFhKzsqgL/t18mCN WaA8KJRJ4/Z4pP88JE67Ghsr7gwDJ+0X+Z9k986Lj/lotkqCnvqJZrqUQx9Wb7xEcW cr8O72gKCyC5YOsPMykiMF/Um5W/46CBY2D9KhOw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Nathan Chancellor , "Ritesh Harjani (IBM)" , Madhavan Srinivasan Subject: [PATCH 6.18 507/703] powerpc/xmon: Avoid unsequenced accesses to tsk in show_task() Date: Fri, 4 Dec 2026 19:06:46 +0900 Message-ID: <20261204100641.286699787@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nathan Chancellor commit 9ea01307e6c824eb0b8934d95d52bbacae17887d upstream. After a recent improvement in clang to warn on unsequenced accesses to volatile variables [1], an instance appears in show_task(), which can break the build with CONFIG_PPC_WERROR=y / CONFIG_WERROR=y / W=e: arch/powerpc/xmon/xmon.c:3262:3: error: unsequenced accesses to volatile qualified 'tsk' [-Werror,-Wunsequenced] 3261 | printf("%16px %16lx %16px %6d %6d %c %2d %s\n", tsk, | ~~~ 3262 | tsk->thread.ksp, tsk->thread.regs, | ^ Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11 6.5.2, unsequenced side effects on the same scalar object are undefined behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a function call is indeterminately sequenced, meaning any side effects in the arguments are unsequenced. tsk was made volatile in commit a2305e3de819 ("powerpc: mark local variables around longjmp as volatile") to ensure its value in show_tasks() was properly restored after returning from a potential longjmp(). Aside from that, the value is not being modified through other means, so rename the volatile parameter and add a local variable named tsk to hold its value throughout show_task(), clearing up the warning. Cc: stable@vger.kernel.org Fixes: a2305e3de819 ("powerpc: mark local variables around longjmp as volatile") Closes: https://github.com/ClangBuiltLinux/linux/issues/2199 Link: https://github.com/llvm/llvm-project/commit/955715460eaf9188c241c74750637fc82dfcc423 [1] Signed-off-by: Nathan Chancellor Reviewed-by: Ritesh Harjani (IBM) Signed-off-by: Madhavan Srinivasan Link: https://patch.msgid.link/20261115-xmon-wunsequenced-v1-1-42ae3fe45bf4@kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/xmon/xmon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -3240,8 +3240,9 @@ memzcan(void) printf("%.8lx\n", a - mskip); } -static void show_task(struct task_struct *volatile tsk) +static void show_task(struct task_struct *volatile vol_tsk) { + struct task_struct *tsk = vol_tsk; unsigned int p_state = READ_ONCE(tsk->__state); char state;