linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Miehlbradt <nicholas@linux.ibm.com>
To: glider@google.com, elver@google.com, dvyukov@google.com,
	akpm@linux-foundation.org, mpe@ellerman.id.au, npiggin@gmail.com,
	christophe.leroy@csgroup.eu
Cc: iii@linux.ibm.com, linux-kernel@vger.kernel.org,
	Nicholas Miehlbradt <nicholas@linux.ibm.com>,
	linux-mm@kvack.org, kasan-dev@googlegroups.com,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 09/13] powerpc: Disable KMSAN checks on functions which walk the stack
Date: Thu, 14 Dec 2023 05:55:35 +0000	[thread overview]
Message-ID: <20231214055539.9420-10-nicholas@linux.ibm.com> (raw)
In-Reply-To: <20231214055539.9420-1-nicholas@linux.ibm.com>

Functions which walk the stack read parts of the stack which cannot be
instrumented by KMSAN e.g. the backchain. Disable KMSAN sanitization of
these functions to prevent false positives.

Signed-off-by: Nicholas Miehlbradt <nicholas@linux.ibm.com>
---
 arch/powerpc/kernel/process.c    |  6 +++---
 arch/powerpc/kernel/stacktrace.c | 10 ++++++----
 arch/powerpc/perf/callchain.c    |  2 +-
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 392404688cec..3dc88143c3b2 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -2276,9 +2276,9 @@ static bool empty_user_regs(struct pt_regs *regs, struct task_struct *tsk)
 
 static int kstack_depth_to_print = CONFIG_PRINT_STACK_DEPTH;
 
-void __no_sanitize_address show_stack(struct task_struct *tsk,
-				      unsigned long *stack,
-				      const char *loglvl)
+void __no_sanitize_address __no_kmsan_checks show_stack(struct task_struct *tsk,
+							unsigned long *stack,
+							const char *loglvl)
 {
 	unsigned long sp, ip, lr, newsp;
 	int count = 0;
diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c
index e6a958a5da27..369b8b2a1bcd 100644
--- a/arch/powerpc/kernel/stacktrace.c
+++ b/arch/powerpc/kernel/stacktrace.c
@@ -24,8 +24,9 @@
 
 #include <asm/paca.h>
 
-void __no_sanitize_address arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
-					   struct task_struct *task, struct pt_regs *regs)
+void __no_sanitize_address __no_kmsan_checks
+	arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
+			struct task_struct *task, struct pt_regs *regs)
 {
 	unsigned long sp;
 
@@ -62,8 +63,9 @@ void __no_sanitize_address arch_stack_walk(stack_trace_consume_fn consume_entry,
  *
  * If the task is not 'current', the caller *must* ensure the task is inactive.
  */
-int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consume_entry,
-						   void *cookie, struct task_struct *task)
+int __no_sanitize_address __no_kmsan_checks
+	arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, void *cookie,
+				 struct task_struct *task)
 {
 	unsigned long sp;
 	unsigned long newsp;
diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c
index 6b4434dd0ff3..c7610b38e9b8 100644
--- a/arch/powerpc/perf/callchain.c
+++ b/arch/powerpc/perf/callchain.c
@@ -40,7 +40,7 @@ static int valid_next_sp(unsigned long sp, unsigned long prev_sp)
 	return 0;
 }
 
-void __no_sanitize_address
+void __no_sanitize_address __no_kmsan_checks
 perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs)
 {
 	unsigned long sp, next_sp;
-- 
2.40.1


  parent reply	other threads:[~2023-12-14  6:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14  5:55 [PATCH 00/13] kmsan: Enable on powerpc Nicholas Miehlbradt
2023-12-14  5:55 ` [PATCH 01/13] kmsan: Export kmsan_handle_dma Nicholas Miehlbradt
2024-02-19 19:37   ` Christophe Leroy
2023-12-14  5:55 ` [PATCH 02/13] hvc: Fix use of uninitialized array in udbg_hvc_putc Nicholas Miehlbradt
2023-12-14  8:36   ` Christophe Leroy
2023-12-21 12:09     ` Michael Ellerman
2023-12-14  5:55 ` [PATCH 03/13] powerpc: Disable KMSAN santitization for prom_init, vdso and purgatory Nicholas Miehlbradt
2023-12-14  5:55 ` [PATCH 04/13] powerpc: Disable CONFIG_DCACHE_WORD_ACCESS when KMSAN is enabled Nicholas Miehlbradt
2023-12-14  8:42   ` Christophe Leroy
2023-12-14  5:55 ` [PATCH 05/13] powerpc: Unpoison buffers populated by hcalls Nicholas Miehlbradt
2023-12-14  5:55 ` [PATCH 06/13] powerpc/pseries/nvram: Unpoison buffer populated by rtas_call Nicholas Miehlbradt
2023-12-14  5:55 ` [PATCH 07/13] powerpc/kprobes: Unpoison instruction in kprobe struct Nicholas Miehlbradt
2023-12-15  7:51   ` Naveen N Rao
2023-12-14  5:55 ` [PATCH 08/13] powerpc: Unpoison pt_regs Nicholas Miehlbradt
2023-12-14  5:55 ` Nicholas Miehlbradt [this message]
2023-12-14  9:00   ` [PATCH 09/13] powerpc: Disable KMSAN checks on functions which walk the stack Christophe Leroy
2024-01-10  4:16     ` Nicholas Miehlbradt
2023-12-15  9:02   ` Aneesh Kumar K.V
2023-12-14  5:55 ` [PATCH 10/13] powerpc: Define KMSAN metadata address ranges for vmalloc and ioremap Nicholas Miehlbradt
2023-12-14  9:17   ` Christophe Leroy
2024-01-10  3:54     ` Nicholas Miehlbradt
2023-12-15  9:27   ` Aneesh Kumar K.V
2023-12-14  5:55 ` [PATCH 11/13] powerpc: Implement architecture specific KMSAN interface Nicholas Miehlbradt
2023-12-14  9:20   ` Christophe Leroy
2023-12-14  5:55 ` [PATCH 12/13] powerpc/string: Add KMSAN support Nicholas Miehlbradt
2023-12-14  9:25   ` Christophe Leroy
2024-01-10  4:09     ` Nicholas Miehlbradt
2023-12-14  5:55 ` [PATCH 13/13] powerpc: Enable KMSAN on powerpc Nicholas Miehlbradt
2023-12-14  9:27   ` Christophe Leroy
2024-02-20  6:39 ` [PATCH 00/13] kmsan: Enable " Christophe Leroy

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=20231214055539.9420-10-nicholas@linux.ibm.com \
    --to=nicholas@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=iii@linux.ibm.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).