lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240311112330.372158-1-changbin.du@huawei.com>
Date: Mon, 11 Mar 2024 19:23:30 +0800
From: Changbin Du <changbin.du@...wei.com>
To: Ingo Molnar <mingo@...hat.com>, Andrew Morton <akpm@...ux-foundation.org>,
	Peter Zijlstra <peterz@...radead.org>, Juri Lelli <juri.lelli@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>
CC: Dietmar Eggemann <dietmar.eggemann@....com>, Steven Rostedt
	<rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>, Mel Gorman
	<mgorman@...e.de>, Daniel Bristot de Oliveira <bristot@...hat.com>, Valentin
 Schneider <vschneid@...hat.com>, <kasan-dev@...glegroups.com>,
	<linux-mm@...ck.org>, Alexander Potapenko <glider@...gle.com>,
	<linux-kernel@...r.kernel.org>, Changbin Du <changbin.du@...wei.com>, Marco
 Elver <elver@...gle.com>
Subject: [PATCH] mm: kmsan: fix instrumentation recursion on preempt_count

This disables msan check for preempt_count_{add,sub} to fix a
instrumentation recursion issue on preempt_count:

  __msan_metadata_ptr_for_load_4() -> kmsan_virt_addr_valid() ->
	preempt_disable() -> __msan_metadata_ptr_for_load_4()

With this fix, I was able to run kmsan kernel with:
  o CONFIG_DEBUG_KMEMLEAK=n
  o CONFIG_KFENCE=n
  o CONFIG_LOCKDEP=n

KMEMLEAK and KFENCE generate too many false positives in unwinding code.
LOCKDEP still introduces instrumenting recursions issue. But these are
other issues expected to be fixed.

Cc: Marco Elver <elver@...gle.com>
Signed-off-by: Changbin Du <changbin.du@...wei.com>
---
 kernel/sched/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9116bcc90346..5b63bb98e60a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5848,7 +5848,7 @@ static inline void preempt_latency_start(int val)
 	}
 }
 
-void preempt_count_add(int val)
+void __no_kmsan_checks preempt_count_add(int val)
 {
 #ifdef CONFIG_DEBUG_PREEMPT
 	/*
@@ -5880,7 +5880,7 @@ static inline void preempt_latency_stop(int val)
 		trace_preempt_on(CALLER_ADDR0, get_lock_parent_ip());
 }
 
-void preempt_count_sub(int val)
+void __no_kmsan_checks preempt_count_sub(int val)
 {
 #ifdef CONFIG_DEBUG_PREEMPT
 	/*
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ