From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941540AbcIZPQc (ORCPT ); Mon, 26 Sep 2016 11:16:32 -0400 Received: from foss.arm.com ([217.140.101.70]:34114 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935159AbcIZPQ0 (ORCPT ); Mon, 26 Sep 2016 11:16:26 -0400 From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: Mark Rutland , Ingo Molnar , Josh Poimboeuf , Peter Zijlstra 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 Message-Id: <1474902979-18436-2-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474902979-18436-1-git-send-email-mark.rutland@arm.com> References: <1474902979-18436-1-git-send-email-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Ingo Molnar Cc: Josh Poimboeuf Cc: Peter Zijlstra 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