[Devel] [PATCH RHEL7 COMMIT] kasan: introduce single-shot mode and enable it by default

Vladimir Davydov vdavydov at virtuozzo.com
Tue Sep 8 08:30:58 PDT 2015

The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.8
commit 424abcd8f3b368e13e0043602ab636e3b5cf928f
Author: Andrey Ryabinin <aryabinin at odin.com>
Date:   Tue Sep 8 19:30:58 2015 +0400

    kasan: introduce single-shot mode and enable it by default
    The first error is always the most significant. The following
    errors usually are the consequences of the first or duplicates.
    This introduces single-shot mode, which means that we will print
    only the first error. It's enabled by default, but user
    still can switch to the old behavior via 'kasan_print_till_death'
    boot option.
    Signed-off-by: Andrey Ryabinin <aryabinin at odin.com>
    Reviewed-by: Vladimir Davydov <vdavydov at parallels.com>
 mm/kasan/report.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index 17af572c233c..515ab3864eb0 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -216,14 +216,28 @@ static void kasan_report_error(struct kasan_access_info *info)
 	spin_unlock_irqrestore(&report_lock, flags);
+static bool print_till_death;
+static int __init kasan_setup(char *arg)
+	print_till_death = true;
+	return 0;
+__setup("kasan_print_till_death", kasan_setup);
 void kasan_report(unsigned long addr, size_t size,
 		bool is_write, unsigned long ip)
 	struct kasan_access_info info;
+	static bool reported = false;
 	if (likely(!kasan_enabled()))
+	if (likely(!print_till_death)) {
+		if (reported)
+			return;
+		reported = true;
+	}
 	info.access_addr = (void *)addr;
 	info.access_size = size;
 	info.is_write = is_write;

More information about the Devel mailing list