Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2281549pxb; Mon, 18 Jan 2021 13:20:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkoPEmyOpU7fQkh4l+OQy++fbjzMXKTCM520yrS7/WjRKGjvp1GW85ANzYq33JpZ9tF2Os X-Received: by 2002:a17:906:398c:: with SMTP id h12mr993007eje.469.1611004835438; Mon, 18 Jan 2021 13:20:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611004835; cv=none; d=google.com; s=arc-20160816; b=NxF8fLDKl7S7wTmzMBc2aLwnmrqo+u+3Iu4i9cY+yk2lI6Y0sK9YFyIRagospl/pdN CVdb38ZMAy1H4wJFkiKkmX7RHZyECaoBlEtGki8RZQhMZzNzoPQmMKPaOY42mYxlG+yU 4RX+RrsB4AjRZswyaHAoqO4dem4lDaTSNjXA6d3pKjJpT6WPay7oLvJ+WkQyAE68sdnn FHMAebhz3sIjP/xB0UeCYKjPvrv1hPMB9ga7aT+ODFxvDM3OwC8d6HbRZaPoTbQ4BpGA UqhlbFVBqxec25MuvbE7TrzAMko8Kz9Wr29XfqNlhluGqfxXW+wilqm5rwkLzjORtt9m PFdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=nc7XZFEUWAibXlD7FrQvZB4TXorEkgfGFnvFOWn2Hqw=; b=lSR9+wqzTAUpRi2eLdCVsMCXxAQvLRaELLRXwNdVANLzjc/KXPN1dSdtA2Lo1VHs6b syasjeRQYEU1SgHRukPKkNKU7SmrX+3wwtdoQJml5nwPoGuqiFh5rvzXQMCv8YtPozEP 2p63YQQmf9yEO7mw1Rsx2dqRO9j5P5ZBloMgiOrta0liz051ulndD10H7sQU1j1ZNh1X Hbg6ce70mnGMSSLIGWPpVoU8HcWQSviCMRG+Gj+OZ6LSSszYWM68dvWbyymnTBFHIMpR fANFzmQatlhlaYlRkUZwBQnk9Ed0AhD4lY/hY3dBM+QOzKZcn8GnX8Db4yL/jvt6gPJd Galg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LSZPSc7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y36si7476989ede.158.2021.01.18.13.20.11; Mon, 18 Jan 2021 13:20:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LSZPSc7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438050AbhARVRx (ORCPT + 99 others); Mon, 18 Jan 2021 16:17:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:34322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438039AbhARVRn (ORCPT ); Mon, 18 Jan 2021 16:17:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C12A22D6D; Mon, 18 Jan 2021 21:17:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611004623; bh=Bf5ce9CwufzdXB6Cszk/JHnQAMJKk7yu7BGgTzZuCSo=; h=From:To:Cc:Subject:Date:From; b=LSZPSc7BWIsNzEaHLKe7yEIG9KNqgbKXfKyRktjAby0y7HZvmvU7E9JqGpqKwv8Rh QSEva9QcRNHTxZuQ6dcW+X4uTTN4r0q44YGcHF8iqjwICLiD3nNIozaOGvtG4727Bu fnppCuI1Qm8TJPShRUXdGqj2iUAsxkCdMWtA2zLZAFOGKL7b0oXDNmD/O/fmTWwO2N JxysIMDWOQGshoSqH9ybxjBpBCXNyTOElGKJ5OzxGorwDtuWtBsJ9viFNEGkohy3Aq KPGW8VFAx16F7KPqfgIJWs+gU1JKxdHyZk8MdZM5GDIq9mcqtDG0w5eT83Yo12LT/c VeMQF3Q1JAatA== From: Mark Brown To: linux-kernel@vger.kernel.org Cc: Mark Brown , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , x86@kernel.org, linux-s390@vger.kernel.org, live-patching@vger.kernel.org Subject: [PATCH] stacktrace: Move documentation for arch_stack_walk_reliable() to header Date: Mon, 18 Jan 2021 21:10:21 +0000 Message-Id: <20210118211021.42308-1-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Patch-Hashes: v=1; h=sha256; i=Kh6NyXsqh0zq94gMuzBCs8afziAecd1XZurszyuxEhw=; m=lBSJGIM2NPehiVUZenL6miw4iuwRv6ZZam6wKeaI2Fc=; p=nPcWpKdBDbrmbYT1hqEf1yR8qtxRXTJfKeEoIt+tgd4=; g=f1dfd626035b5ec1394ca2d18e3f85690f794e7e X-Patch-Sig: m=pgp; i=broonie@kernel.org; s=0xC3F436CA30F5D8EB; b=iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmAF+SQACgkQJNaLcl1Uh9Cs6wf/aqA G6y6D8pTtW7LLVv2mo8pg0eS7xvIoxAytK6r1e333xaWzTG/baO+RT+iFPwQ5yX1piIWMoq8vSyNH JxKA1KV5Z+t6GdISS7IOuhOtjmWbEinFJWrE2yxtAmav3G/mf9h/mWu5EXLO5x9yrpxJc7gABI/gt c39Sqj0qy7Yi/ObkyNxvs/xvtxWkamPxiRI8rNh0s2HNribSDoBzs2DoDzMLQnxq2830LUJreef3y rDm9nBpx/r9sKn3SAM+RNr8Oj14q0ikuS1bEjyfFtccDIE9ryO4hkhaPPltzThoSxLIQfhUUZQdCe LjzErGmpayPVgqavyekkxzbMvn/6eRg== Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently arch_stack_wallk_reliable() is documented with an identical comment in both x86 and S/390 implementations which is a bit redundant. Move this to the header and convert to kerneldoc while we're at it. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger Cc: Josh Poimboeuf Cc: Jiri Kosina Cc: Miroslav Benes Cc: Petr Mladek Cc: Joe Lawrence Cc: x86@kernel.org Cc: linux-s390@vger.kernel.org Cc: live-patching@vger.kernel.org Signed-off-by: Mark Brown --- arch/s390/kernel/stacktrace.c | 6 ------ arch/x86/kernel/stacktrace.c | 6 ------ include/linux/stacktrace.h | 19 +++++++++++++++++++ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/arch/s390/kernel/stacktrace.c b/arch/s390/kernel/stacktrace.c index 7f1266c24f6b..101477b3e263 100644 --- a/arch/s390/kernel/stacktrace.c +++ b/arch/s390/kernel/stacktrace.c @@ -24,12 +24,6 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, } } -/* - * This function returns an error if it detects any unreliable features of the - * stack. Otherwise it guarantees that the stack trace is reliable. - * - * If the task is not 'current', the caller *must* ensure the task is inactive. - */ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, void *cookie, struct task_struct *task) { diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c index 8627fda8d993..15b058eefc4e 100644 --- a/arch/x86/kernel/stacktrace.c +++ b/arch/x86/kernel/stacktrace.c @@ -29,12 +29,6 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, } } -/* - * This function returns an error if it detects any unreliable features of the - * stack. Otherwise it guarantees that the stack trace is reliable. - * - * If the task is not 'current', the caller *must* ensure the task is inactive. - */ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, void *cookie, struct task_struct *task) { diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h index 50e2df30b0aa..9edecb494e9e 100644 --- a/include/linux/stacktrace.h +++ b/include/linux/stacktrace.h @@ -52,8 +52,27 @@ typedef bool (*stack_trace_consume_fn)(void *cookie, unsigned long addr); */ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, struct task_struct *task, struct pt_regs *regs); + +/** + * arch_stack_walk_reliable - Architecture specific function to walk the + * stack reliably + * + * @consume_entry: Callback which is invoked by the architecture code for + * each entry. + * @cookie: Caller supplied pointer which is handed back to + * @consume_entry + * @task: Pointer to a task struct, can be NULL + * + * This function returns an error if it detects any unreliable + * features of the stack. Otherwise it guarantees that the stack + * trace is reliable. + * + * If the task is not 'current', the caller *must* ensure the task is + * inactive and its stack is pinned. + */ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, void *cookie, struct task_struct *task); + void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie, const struct pt_regs *regs); -- 2.20.1