linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] stacktrace: Use PF_KTHREAD to check for kernel threads
@ 2019-07-02 15:53 Thomas Gleixner
  2019-07-02 16:17 ` Mark Rutland
  2019-07-03  7:07 ` [tip:core/stacktrace] " tip-bot for Thomas Gleixner
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Gleixner @ 2019-07-02 15:53 UTC (permalink / raw)
  To: LKML; +Cc: Josh Poimboeuf, Peter Zijlstra, Steven Rostedt

!current->mm is not a reliable indicator for kernel threads as they might
temporarily use a user mm. Check for PF_KTHREAD instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
--- a/kernel/stacktrace.c
+++ b/kernel/stacktrace.c
@@ -228,7 +228,7 @@ unsigned int stack_trace_save_user(unsig
 	};
 
 	/* Trace user stack if not a kernel thread */
-	if (!current->mm)
+	if (current->flags & PF_KTHREAD)
 		return 0;
 
 	arch_stack_walk_user(consume_entry, &c, task_pt_regs(current));

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-03  7:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02 15:53 [PATCH] stacktrace: Use PF_KTHREAD to check for kernel threads Thomas Gleixner
2019-07-02 16:17 ` Mark Rutland
2019-07-03  7:07 ` [tip:core/stacktrace] " tip-bot for Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).