From patchwork Mon Sep 26 15:16:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 77037 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp1233007qgf; Mon, 26 Sep 2016 08:16:53 -0700 (PDT) X-Received: by 10.98.141.20 with SMTP id z20mr40254643pfd.165.1474903013235; Mon, 26 Sep 2016 08:16:53 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w64si25439518pfd.144.2016.09.26.08.16.52; Mon, 26 Sep 2016 08:16:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941541AbcIZPQc (ORCPT + 27 others); 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 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11BDD17C; Mon, 26 Sep 2016 08:16:26 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C7AF83F251; Mon, 26 Sep 2016 08:16:25 -0700 (PDT) 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 Precedence: bulk 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(+) -- 2.7.4 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);