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=1796389469; b=n84D8uOSocB0xmVbYTvyUcbiEpHQ15kJR4tGRDfobWvZ8f/ilLrPcq7n2seKM4uI7rM0 JGfNfDingSGxQ/Kt/b7qDN7/SmCwKO1ZeE3oCnK4NqI32L594f2U+85HybUvCwm/8OOsz agdXwU5/p/t12bblErPvcf6bJv4F3eAo3pFJiFY2nEBoNEetrbxJaKtTPd5tb5hKptmtk JoHoZ6oiEb9006oM5UArzpHsVzzSAEBxsMmFwe7xKgE19KCc5VJK0IX2oQzfewjso5WlN ZZAYvN0YtlA2q0L3ZU9uYf3LJ+7ZGR6HMx7CZohGu4XRZ0q0bFu9byTGAZzSb4LmpZQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389469; 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=fMhGG2JtL8hfL4OYdhE4n6uJNZaDpdk8qRfuO/qwXVw=; b=i0xOwLI2GKJHL30EhwNTaEUyXaqK3E6bpwzSWB0AyMDl2SIJC9Lcf7WDZArbLYVk2s3U jIP2B6x0wxzHiSAKksqqcJhWoLPYUdH3k6NdhhAHwA2xKW0JxW971TRAtwBUC7zzIZ2sw uiqv6l+XSYrqCTRjEMMaFMxAdEGDkK9mpowz6Ho4nRuTFeP4AwAtzTyV0SoIdAoDT5a0l Mm+oNsW6yF0Ed0zPCO9Ro2S1Lg5MOGjMDeR5Cdf+3cQXpfvEMmP/jbzkASP9HasupfZgk hPJHlu22LQ1qdfpzkSViJnrSt+1lHGyoOsASm/e4lki/ZM0Xno6Q6OsDMSPnOhyBHng== 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=qYaY+igH; 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 F1936606A32C; Fri, 4 Dec 2026 13:04:28 +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=qYaY+igH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06B291F000C2; Fri, 4 Dec 2026 13:04:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389468; bh=fMhGG2JtL8hfL4OYdhE4n6uJNZaDpdk8qRfuO/qwXVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qYaY+igHsfGFmv6ibG2ttuWSBY6KU5N5+rXqmSlqGgi+I1YwbczLxLgHQ9plzZiM6 AX7JS//wKO+YUmDA8UDgJgtuC1Lnc68mwrKcbw0vnXbjHfcs8FeAqm07REPSYWA3N4 bEOm7/5POElmKjOh2RmZyBKAqZvZ8D+uPKVCumV4= 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.1 0976/1059] powerpc/xmon: Avoid unsequenced accesses to tsk in show_task() Date: Fri, 4 Dec 2026 19:08:27 +0900 Message-ID: <20261204100709.292888926@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-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 @@ -3261,8 +3261,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;