Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2555142C51C; Sat, 12 Sep 2026 14:59:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789225182; cv=none; b=jwLOOGbF54sYf2bfOBAi3k6VNQTs/JaDfIw8Uy2bqdFXjSd0xukz84bwG666jTCteUV1N33C6oW+KI1jgDuU1O5a3qKDN6NUfVZ3DAJVyuhA7nA478Th2TongMPA1Avv2nLyVz5+qrxG/B7fBIYSizOPYRrJ+w1cWv+LDWDjJ4I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789225182; c=relaxed/simple; bh=jqbINSU6H5kWGWqH8HBhRUq8zeIb71QqTGaT7zijUvM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pc3oq+5uNEn9YS0aAX0EhTip2hb1Vc4AjkUGAXv/HnDZt4iAcOOy8tLtkPP6SXu5a4rSUfdmaRnd28dqV+SIT/k//eZmFvFIaWyBJkl70+f6OlgMjhX1ubhOk4oVgejj61gLuXWXl8muqmZrK2GgtkrYTZ70MDwDLssXw46fGHg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BqF+Xatn; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BqF+Xatn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D1BE1F000FF; Sat, 12 Sep 2026 14:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789225179; bh=0hQ1mTyrHaWRkUKrGk4kYPzyFRf43oz1pA9lv6yQtgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BqF+Xatno3e5Vqjpq1iEZWpbEG8WtR70DRBm7Uhp8l/yVAuzwqoxqfCHnejtaOlub kJlKAH47VcmXou8erJNlIWr79R5RINIPZi906+CeMwSN17Uy7xY9e88MoeJcXyNR7+ 0ElIbuGSqnkpmEk7RV2iwxdtrwT0XuLugN0wDcjc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Karl Mehltretter , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 6.6 1146/1424] m68k: Fix backtraces for non-running tasks Date: Sat, 12 Sep 2026 08:59:38 +0200 Message-ID: <20260912065632.962033231@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.279695368@linuxfoundation.org> References: <20260912065607.279695368@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Karl Mehltretter [ Upstream commit 09f71dbeb287e367beea56d9ac8a3d356ef5e02a ] When no stack pointer is supplied, show_stack() starts at thread.esp0. This is the saved userspace register frame, not where a task was switched out. For kernel threads it points to the zeroed frame created by copy_thread(), so sched_show_task() prints no useful backtrace. Use thread.ksp for non-current tasks. It is saved by switch_to() and is already used by __get_wchan(). For current, start at the current stack frame, as is already done when no task is supplied. Tested on qemu-system-m68k -M virt using SysRq-t. All task dumps contained resolved frames. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Karl Mehltretter Reviewed-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven Link: https://patch.msgid.link/20260723041055.47289-1-kmehltretter@gmail.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/m68k/kernel/traps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c index a700807c9b6d9..aaea713210ed9 100644 --- a/arch/m68k/kernel/traps.c +++ b/arch/m68k/kernel/traps.c @@ -937,8 +937,8 @@ void show_stack(struct task_struct *task, unsigned long *stack, int i; if (!stack) { - if (task) - stack = (unsigned long *)task->thread.esp0; + if (task && task != current) + stack = (unsigned long *)task->thread.ksp; else stack = (unsigned long *)&stack; } -- 2.53.0