From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Andrey Konovalov <andreyknvl@google.com>,
Alexander Potapenko <glider@google.com>,
Dmitry Vyukov <dvyukov@google.com>,
kasan-dev@googlegroups.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] kasan: report only the first error by default
Date: Thu, 23 Mar 2017 16:06:59 +0300 [thread overview]
Message-ID: <d9be02d7-af87-208a-c51b-c890b549434b@virtuozzo.com> (raw)
In-Reply-To: <20170323124154.GE9287@leverpostej>
On 03/23/2017 03:41 PM, Mark Rutland wrote:
> On Thu, Mar 23, 2017 at 02:49:16PM +0300, Andrey Ryabinin wrote:
>> + kasan_multi_shot
>> + [KNL] Enforce KASAN (Kernel Address Sanitizer) to print
>> + report on every invalid memory access. Without this
>> + parameter KASAN will print report only for the first
>> + invalid access.
>> +
>
> The option looks fine to me.
>
>> static int __init kmalloc_tests_init(void)
>> {
>> + /* Rise reports limit high enough to see all the following bugs */
>> + atomic_add(100, &kasan_report_count);
>
>> +
>> + /*
>> + * kasan is unreliable now, disable reports if
>> + * we are in single shot mode
>> + */
>> + atomic_sub(100, &kasan_report_count);
>> return -EAGAIN;
>> }
>
> ... but these magic numbers look rather messy.
>
> [...]
>
>> +atomic_t kasan_report_count = ATOMIC_INIT(1);
>> +EXPORT_SYMBOL_GPL(kasan_report_count);
>> +
>> +static int __init kasan_set_multi_shot(char *str)
>> +{
>> + atomic_set(&kasan_report_count, 1000000000);
>> + return 1;
>> +}
>> +__setup("kasan_multi_shot", kasan_set_multi_shot);
>
> ... likewise.
>
> Rather than trying to pick an arbitrarily large number, how about we use
> separate flags to determine whether we're in multi-shot mode, and
> whether a (oneshot) report has been made.
>
> How about the below?
Yes, it deferentially looks better.
Can you send a patch with a changelog, or do you want me to care of it?
> Thanks,
> Mark.
>
> diff --git a/mm/kasan/report.c b/mm/kasan/report.c
> index f479365..f1c5892 100644
> --- a/mm/kasan/report.c
> +++ b/mm/kasan/report.c
> @@ -13,6 +13,7 @@
> *
> */
>
> +#include <linux/bitops.h>
> #include <linux/ftrace.h>
We also need <linux/init.h> for __setup().
> #include <linux/kernel.h>
> #include <linux/mm.h>
> @@ -293,6 +294,40 @@ static void kasan_report_error(struct kasan_access_info *info)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-03-23 13:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-22 16:06 [PATCH] kasan: report only the first error Andrey Ryabinin
2017-03-22 16:34 ` Andrey Konovalov
2017-03-22 16:54 ` Andrey Ryabinin
2017-03-22 17:07 ` Andrey Konovalov
2017-03-22 17:33 ` Alexander Potapenko
2017-03-22 17:42 ` Dmitry Vyukov
2017-03-23 11:49 ` [PATCH v2] kasan: report only the first error by default Andrey Ryabinin
2017-03-23 12:41 ` Mark Rutland
2017-03-23 13:06 ` Andrey Ryabinin [this message]
2017-03-23 13:29 ` Mark Rutland
2017-03-23 15:44 ` [PATCH v3] " Andrey Ryabinin
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=d9be02d7-af87-208a-c51b-c890b549434b@virtuozzo.com \
--to=aryabinin@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@google.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mark.rutland@arm.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