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=1796383953; b=1T0HWqC72afRXw1w22M6AdtHqtJAxOeQ3jPXxFrmC+LrCi6o0zPvufRf9pSylNY3xzLr PTj77DI2k6pITyPOwB280o12nWrRdS1R27xkNhaSaz1sDghPNdO9Xo5z/DN/h+w8aBF/8 LdogJ+jei3z2UYxr6XEvXMOIjiRWQhcz5Qc7sD8MgipX7ZgU4rMQg6gfQtFbtydOYhgyx 9s3kYB7kgJnAF27VrUiHK2wPu7QqEoCXgTSaRiI1CIl3LYrxk0O6QvrMb0YWPCgHtFnhD oGcJGQa4znjhItiM83VmggVmZdiwMiT6TIpFwQgF5oBCO6RgA7AQ4PBnRcoMUBPt5Nw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383953; 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=cAVYYHrGPTl5Pkat6xRXg3eL8jwlVH6IjmfeveRHiGQ=; b=xSjSzDQQxWFe4ejVeCcUB+LJJ4i7oWyqiipRFVznykUB3OHHFNwByAmPpfyy4rnZLa9y LgiAYuBI40IXkjHZrI4icwSOc/qQzQlc/WGwqF9YNHd0KerPO7S8lQ3XP7RivcHlRJuql f4lbU2py91Kfnh+P5rXsn1IR9ZRcp1WMc1F+T51hKVf2emfGoz6ntifcj89koREhFiIv4 46xnSJDSkxQr4jicnxJL38rwBIsksleVhJbZJm7HjsDh8X/9GIxfNz6D8gZOJadpYKJwB NvsauPdQxJhRMgJyZdwD2+crEFgakt779SZr057zPtK+w2EPQrRXJ361gG3W9gZEl5g== 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=GL3pVt8W; 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 C7AF7606A338; Fri, 4 Dec 2026 11:32:33 +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=GL3pVt8W Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC2B01F00897; Fri, 4 Dec 2026 11:32:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383953; bh=cAVYYHrGPTl5Pkat6xRXg3eL8jwlVH6IjmfeveRHiGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GL3pVt8WaqtOtL5zY3QL4rwVF0wSzTjw5DKwrWwFGC4cCDm4OBv1aPMmUtbgUTJdJ D8vlSEKwfGW6lGym93tkc1AJUmqnF/zPM+MOjRLyleYEoy2Ro2UhIPv5TVx4StIwGp hqZ7qzgzJuVYZTWBQWkGY8d0vyd2vCvYS9cbcXZY= 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.12 435/555] powerpc/xmon: Avoid unsequenced accesses to tsk in show_task() Date: Fri, 4 Dec 2026 19:07:58 +0900 Message-ID: <20261204100626.164632187@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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.12-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 @@ -3257,8 +3257,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;