diff mbox series

[mm,10/22] kasan: move disable_trace_on_warning to start_report

Message ID 7c066c5de26234ad2cebdd931adfe437f8a95d58.1646237226.git.andreyknvl@google.com (mailing list archive)
State New
Headers show
Series kasan: report clean-ups and improvements | expand

Commit Message

andrey.konovalov@linux.dev March 2, 2022, 4:36 p.m. UTC
From: Andrey Konovalov <andreyknvl@google.com>

Move the disable_trace_on_warning() call, which enables the
/proc/sys/kernel/traceoff_on_warning interface for KASAN bugs,
to start_report(), so that it functions for all types of KASAN reports.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
---
 mm/kasan/report.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Alexander Potapenko March 2, 2022, 6 p.m. UTC | #1
On Wed, Mar 2, 2022 at 5:37 PM <andrey.konovalov@linux.dev> wrote:

> From: Andrey Konovalov <andreyknvl@google.com>
>
> Move the disable_trace_on_warning() call, which enables the
> /proc/sys/kernel/traceoff_on_warning interface for KASAN bugs,
> to start_report(), so that it functions for all types of KASAN reports.
>
> Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
>
Reviewed-by: Alexander Potapenko <glider@google.com>


---

>  mm/kasan/report.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/kasan/report.c b/mm/kasan/report.c
> index 0b6c8a14f0ea..9286ff6ae1a7 100644
> --- a/mm/kasan/report.c
> +++ b/mm/kasan/report.c
> @@ -129,6 +129,8 @@ static DEFINE_SPINLOCK(report_lock);
>
>  static void start_report(unsigned long *flags, bool sync)
>  {
> +       /* Respect the /proc/sys/kernel/traceoff_on_warning interface. */
> +       disable_trace_on_warning();
>         /* Update status of the currently running KASAN test. */
>         update_kunit_status(sync);
>         /* Make sure we don't end up in loop. */
> @@ -421,7 +423,6 @@ static void __kasan_report(unsigned long addr, size_t
> size, bool is_write,
>         void *untagged_addr;
>         unsigned long flags;
>
> -       disable_trace_on_warning();
>         start_report(&flags, true);
>
>         tagged_addr = (void *)addr;
> --
> 2.25.1
>
> --
> You received this message because you are subscribed to the Google Groups
> "kasan-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to kasan-dev+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/kasan-dev/7c066c5de26234ad2cebdd931adfe437f8a95d58.1646237226.git.andreyknvl%40google.com
> .
>
diff mbox series

Patch

diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index 0b6c8a14f0ea..9286ff6ae1a7 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -129,6 +129,8 @@  static DEFINE_SPINLOCK(report_lock);
 
 static void start_report(unsigned long *flags, bool sync)
 {
+	/* Respect the /proc/sys/kernel/traceoff_on_warning interface. */
+	disable_trace_on_warning();
 	/* Update status of the currently running KASAN test. */
 	update_kunit_status(sync);
 	/* Make sure we don't end up in loop. */
@@ -421,7 +423,6 @@  static void __kasan_report(unsigned long addr, size_t size, bool is_write,
 	void *untagged_addr;
 	unsigned long flags;
 
-	disable_trace_on_warning();
 	start_report(&flags, true);
 
 	tagged_addr = (void *)addr;