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=1796381242; b=Ges3fw+oV8F0Qg/sGD66vuv4AqSN2jfKEEqPhRiJsgZLz5VZzdxrmH8EFIbIJJxX+Jxc g4pOd4y7dvpfoeroIjqLWZKEA9N3yoTh1T22IRQPaA7j7klRhm1+tnlXO2DF0Ro/OiCyp +Fg0fLvPSLBmxMr72Qnm8xfAb3DSu7JNW+zm4SQsE+fJCzLzt3Ezpz6yMMbUBkPYOQ5ev SXp5Q/HH23ZlQmtWKYHmHL2YxpPMieIUMrShMQM0WVHOyW/jAQk9YXlFYw/TJSo79h5n3 aWgfoO8lhyCzNmqz+uMb9hcfWWfhQIuGXWKiGZS2syPCAjd2AYCABE/IF3px3qm13TQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381242; 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=Lsd0Eafx2+qPaVXJ/ZUF4vUz2JFHiLmMp9bKz1CF0io=; b=2XdfUAHXeK4DeDv7OHhLkMOgDeuoXXzcXOxw0yd6hG7JZS4/KjhT05S1faHJgyiGMPXE zWMK0LN/II2tvNvZRUqd5EdZZlgqHoVc0+/526ddgOLtmf6048uIy41dF5QETmUs+IE3+ 53hFNF8yP4suvlhPAa26HXsyMfFYd0WdUFV7UdsjwploVgtYIi2c3FS8mrfoF9HWEAFPv JsYxCQ3XPKZ6zCXn3tiQB3wepwlLYPGRvPznLAIAzxy1Xr3mocyeMn30cszqHSL+L1SY4 HOBVNW0Bw/XxY0pfK5xQzSsdi8Gbzi61EPO4BetklH3K+2RtX1JQXJiKAfgrvSds70g== 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=k1d8e6Cn; 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 0B114606A332; Fri, 4 Dec 2026 10:47:22 +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=k1d8e6Cn Received: by smtp.kernel.org (Postfix) with ESMTPSA id 729C91F000CE; Fri, 4 Dec 2026 10:47:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381241; bh=Lsd0Eafx2+qPaVXJ/ZUF4vUz2JFHiLmMp9bKz1CF0io=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=k1d8e6Cnb8xvn61Zoj/+427jY3uX2cPZ2p94GnA/hDzh1NuR8HslXhl6VIQak1YO1 chS8SIyklr/ZOSbAY24RfLJwbhH7zObbktfiLwfyHvai0kzK6eol+dKFQ25xvqHDyd gxgOeS8M4cWJDp0x1pPnX9CnTHGSKNPN9gQ4IM9w= 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 7.3 570/742] powerpc/xmon: Avoid unsequenced accesses to tsk in show_task() Date: Fri, 4 Dec 2026 19:07:14 +0900 Message-ID: <20261204100650.283558777@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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;