[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231030175854.12675-1-rwahl@gmx.de>
Date: Mon, 30 Oct 2023 18:58:54 +0100
From: Ronald Wahl <rwahl@....de>
To: linux-kernel@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ronald Wahl <ronald.wahl@...itan.com>
Subject: [PATCH] stacktrace: check whether task has a stack before saving it
I encountered a crash on ARM32 when trying to dump the stack of some
zombie process. This is caused by a missing check whether the task
actually has a valid stack. This commit adds this check.
Commit 214d8ca6ee85 ("stacktrace: Provide common infrastructure")
introduced this check for platforms that define CONFIG_ARCH_STACKWALK
but ARM32 is not one of them.
Signed-off-by: Ronald Wahl <ronald.wahl@...itan.com>
---
kernel/stacktrace.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c
index 9ed5ce989415..38ae52349306 100644
--- a/kernel/stacktrace.c
+++ b/kernel/stacktrace.c
@@ -298,6 +298,9 @@ unsigned int stack_trace_save_tsk(struct task_struct *task,
.skip = skipnr + (current == task),
};
+ if (!try_get_task_stack(task))
+ return 0;
+
save_stack_trace_tsk(task, &trace);
return trace.nr_entries;
}
--
2.41.0
Powered by blists - more mailing lists