mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: linux-kernel@vger.kernel.org
Cc: Mark Rutland <mark.rutland@arm.com>,
	Ingo Molnar <mingo@kernel.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: [PATCH 1/3] sched: document that show_stack() should not be passed a NULL task
Date: Mon, 26 Sep 2016 16:16:17 +0100	[thread overview]
Message-ID: <1474902979-18436-2-git-send-email-mark.rutland@arm.com> (raw)
In-Reply-To: <1474902979-18436-1-git-send-email-mark.rutland@arm.com>

As noted in commit:

  81539169f283329f ("x86/dumpstack: Remove NULL task pointer convention")

... having a NULL task parameter imply current leads to subtle bugs in stack
walking code (so far seen on both 86 and arm64), makes callsites harder to
read, and is unnecessary as all callers have access to current.

As a step towards removing the problematic NULL-implies-current idiom entirely,
document that new code should pass current explicitly.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org
---
 include/linux/sched.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index abb795a..4bc5571 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -367,6 +367,9 @@ extern void show_regs(struct pt_regs *);
  * TASK is a pointer to the task whose backtrace we want to see (or NULL for current
  * task), SP is the stack pointer of the first frame that should be shown in the back
  * trace (or NULL if the entire call-chain of the task should be shown).
+ *
+ * Note: passing a NULL task is deprecated, and new code should pass current
+ * explicitly.
  */
 extern void show_stack(struct task_struct *task, unsigned long *sp);
 
-- 
2.7.4

  reply	other threads:[~2016-09-26 15:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26 15:16 [PATCH 0/3] Kill off show_stack() NULL-implies-current idiom Mark Rutland
2016-09-26 15:16 ` Mark Rutland [this message]
2016-09-26 15:16 ` [PATCH 2/3] drivers/tty: Explicitly pass current to show_stack Mark Rutland
2016-09-26 15:16 ` [PATCH 3/3] lib: dump_stack: explicitly " Mark Rutland
2016-09-26 20:01 ` [PATCH 0/3] Kill off show_stack() NULL-implies-current idiom Josh Poimboeuf
2016-09-26 21:33   ` Mark Rutland
2016-09-27 17:57   ` Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474902979-18436-2-git-send-email-mark.rutland@arm.com \
    --to=mark.rutland@arm.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome