Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935511AbdCVRog (ORCPT ); Wed, 22 Mar 2017 13:44:36 -0400 Received: from mail-vk0-f43.google.com ([209.85.213.43]:33237 "EHLO mail-vk0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965261AbdCVRoE (ORCPT ); Wed, 22 Mar 2017 13:44:04 -0400 MIME-Version: 1.0 In-Reply-To: References: <20170322160647.32032-1-aryabinin@virtuozzo.com> From: Dmitry Vyukov Date: Wed, 22 Mar 2017 18:42:53 +0100 Message-ID: Subject: Re: [PATCH] kasan: report only the first error To: Alexander Potapenko Cc: Andrey Konovalov , Andrey Ryabinin , Andrew Morton , Mark Rutland , kasan-dev , Linux Memory Management List , LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v2MHioXr030170 Content-Length: 2441 Lines: 65 On Wed, Mar 22, 2017 at 6:33 PM, Alexander Potapenko wrote: > On Wed, Mar 22, 2017 at 6:07 PM, Andrey Konovalov wrote: >> On Wed, Mar 22, 2017 at 5:54 PM, Andrey Ryabinin >> wrote: >>> On 03/22/2017 07:34 PM, Andrey Konovalov wrote: >>>> On Wed, Mar 22, 2017 at 5:06 PM, Andrey Ryabinin >>>> wrote: >>>>> Disable kasan after the first report. There are several reasons for this: >>>>> * Single bug quite often has multiple invalid memory accesses causing >>>>> storm in the dmesg. >>>>> * Write OOB access might corrupt metadata so the next report will print >>>>> bogus alloc/free stacktraces. >>>>> * Reports after the first easily could be not bugs by itself but just side >>>>> effects of the first one. >>>>> >>>>> Given that multiple reports only do harm, it makes sense to disable >>>>> kasan after the first one. Except for the tests in lib/test_kasan.c >>>>> as we obviously want to see all reports from test. >>>> >>>> Hi Andrey, >>>> >>>> Could you make it configurable via CONFIG_KASAN_SOMETHING (which can >>>> default to showing only the first report)? >>> >>> I'd rather make this boot time configurable, but wouldn't want to without >>> a good reason. >> >> That would work for me. Also note that KASAN now supports panic_on_warn=1, which achieves more or less the same. Of course, WARNINGs may be not that bad, but KASAN reports may be not tool bad as well (e.g. off-by-one reads). >>>> I sometimes use KASAN to see what bad accesses a particular bug >>>> causes, and seeing all of them (even knowing that they may be >>>> corrupt/induced) helps a lot. >>> >>> I'm wondering why you need to see all reports? >> >> To get a better picture of what are the consequences of a bug. For >> example whether it leads to some bad or controllable memory >> corruption. Sometimes it's easier to let KASAN track the memory >> accesses then do that manually. > Another case is when you're seeing an OOB read at boot time, which has > limited impact, and you don't want to wait for the code owner to fix > it to move forward. >>> >>>> >>>> Thanks! >>>> > > > > -- > Alexander Potapenko > Software Engineer > > Google Germany GmbH > Erika-Mann-Straße, 33 > 80636 München > > Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle > Registergericht und -nummer: Hamburg, HRB 86891 > Sitz der Gesellschaft: Hamburg