13
13
#include <linux/ftrace.h>
14
14
#include <linux/init.h>
15
15
#include <linux/kernel.h>
16
+ #include <linux/lockdep.h>
16
17
#include <linux/mm.h>
17
18
#include <linux/printk.h>
18
19
#include <linux/sched.h>
@@ -148,6 +149,8 @@ static void start_report(unsigned long *flags, bool sync)
148
149
disable_trace_on_warning ();
149
150
/* Update status of the currently running KASAN test. */
150
151
update_kunit_status (sync );
152
+ /* Do not allow LOCKDEP mangling KASAN reports. */
153
+ lockdep_off ();
151
154
/* Make sure we don't end up in loop. */
152
155
kasan_disable_current ();
153
156
spin_lock_irqsave (& report_lock , * flags );
@@ -160,12 +163,13 @@ static void end_report(unsigned long *flags, void *addr)
160
163
trace_error_report_end (ERROR_DETECTOR_KASAN ,
161
164
(unsigned long )addr );
162
165
pr_err ("==================================================================\n" );
163
- add_taint (TAINT_BAD_PAGE , LOCKDEP_NOW_UNRELIABLE );
164
166
spin_unlock_irqrestore (& report_lock , * flags );
165
167
if (panic_on_warn && !test_bit (KASAN_BIT_MULTI_SHOT , & kasan_flags ))
166
168
panic ("panic_on_warn set ...\n" );
167
169
if (kasan_arg_fault == KASAN_ARG_FAULT_PANIC )
168
170
panic ("kasan.fault=panic set ...\n" );
171
+ add_taint (TAINT_BAD_PAGE , LOCKDEP_NOW_UNRELIABLE );
172
+ lockdep_on ();
169
173
kasan_enable_current ();
170
174
}
171
175
0 commit comments