Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp24486imw; Tue, 12 Jul 2022 13:54:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vVhlOANFTxk/jAbyYJtLBm3+WsqLk3DV6GudkaZz99QePRnsmrT5u3JKkrVDWF88vhF+lk X-Received: by 2002:a05:6a00:1312:b0:528:2948:e974 with SMTP id j18-20020a056a00131200b005282948e974mr25422662pfu.79.1657659281163; Tue, 12 Jul 2022 13:54:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657659281; cv=none; d=google.com; s=arc-20160816; b=mU5sG/2Vnfb9qw3/OUbNofNoXG5X/e/CS3xv/xxnptrz7NZnSkRwu/KFQnfelmFcp5 Orlv2xqU1qpo90Hoc/4Q+w5NSNgAq3yD8nikj9vC+1YgGmtUFZTFTi+1jntXyQeQBRfM EVCQj4+MyHUduyV4ChzhQipL3Crrv0THs0gMeZDs2bWKWXgb9CzQLH1zlKyyN9urFdKy mkTXurjG6V+lYetUHJLsbDM/dkHM0yWrwKPfDAMLkqHjBElZkA4ORTyP2MJh9zi2O1Cz 8hUkf9i9OUfgm5SpxI5TnWEsRN5fang6MsS2LNgSBHWnwSfYkPZmuWLH5Pyb6ACXl0jn No1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gtA9X+fkjEw/LyXx7cshYRPvYgSQ7aQHvwyjYuYISkY=; b=B1V6ltUL/JkucdNtI1PXNq5L5SE8q2naXESTe3yR/J4lcjACSnGH+zUxQ++VMfCvhf X5nermGFpDjNY9nb989kKCwDF2swklTUoor09aT+67RvjdNAObesIqfXWOpgRlZBxxfs g7EjOLe6us7oMXWAE+doRk3bB03DDPa5JC8rG/Cs3KCOx1P3Z1s3Q34+NycBI4dw4d8V /muVRRv3TrLQe9MCmuic0wGG6YupqdeQz3JgjLmh298J11BIFeTVnwx0C+Brmhy7CbLc aKsBC7c64fSa1SdgjNqdl2tlxf27rsg1Kaz5QWTN55cKgBP/Loa2C30fRS+UI8AkUXg6 tWTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=n9RIa554; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oa18-20020a17090b1bd200b001debd181bb9si66222pjb.138.2022.07.12.13.54.28; Tue, 12 Jul 2022 13:54:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=n9RIa554; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231540AbiGLUiZ (ORCPT + 99 others); Tue, 12 Jul 2022 16:38:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229681AbiGLUiY (ORCPT ); Tue, 12 Jul 2022 16:38:24 -0400 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B37C1B968F for ; Tue, 12 Jul 2022 13:38:23 -0700 (PDT) Received: by mail-il1-x12a.google.com with SMTP id v1so5560476ilg.11 for ; Tue, 12 Jul 2022 13:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gtA9X+fkjEw/LyXx7cshYRPvYgSQ7aQHvwyjYuYISkY=; b=n9RIa554dycPGIKBOybZCxXvgE7O3FOURYuK5Rnd/mSxb6YmPx4NecnpLLC17ZO13g z2A3RBDfsGBdtTvmzt3QWmSQZahjAWF62t9H+KbGXH2iBNkyI5TTBHickAHetTgp+gm1 e4d5G7Qu0bfcSaX20DM9iU8hk1RtRpOgraFK+HU4nkHoRbsXkTby588r0/xTUbYX5TZP ICqKI5uM6ndDxfDavEceu3s5Zc1Twx7qSiApci11ooZBvr9YqtCX+qyTmfm58kk8k6j7 PaAQFdD2y9HOeCmn3N+DOd1eVwAM76SIKI9tEIkKwUIFXBkiVg1Njzo9F2A+S8HSvhkc Imrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gtA9X+fkjEw/LyXx7cshYRPvYgSQ7aQHvwyjYuYISkY=; b=ZPu1UGrM6B+VHDLyPlsI8DeuoxSn3DlSPZZhwoEsTfEMFEsxZTzTu1g/9af4U6ZP4I iIKk6BTdVNZ4PvTIM052+t+VAp4o3qBWUmihg2XxSHhxOar5/gDKURKtIF1HmgtPWn2l 9J1Dn9OAGbMiCmJetsBHb8HT2uf95Lt4FXn0Oonnj+wwMn870cfAR0qURHNEA8EoA4bw umIw5ZbIryPKCbHteMKqnGs/B4bEndB/gV/N7U1lLoJ/mRmRiOv66Nc5XuJuf0pjMc8u 6BcNBh7dxBDCtZG4oF+/C/a9+TqK/Kl5spu0wYKOoEb3Smt48japRwCf6cZ+fv9vZ7mk M/Ww== X-Gm-Message-State: AJIora8bArJyhVHwNsJTdum11XOQQbzjpv3aDXEh0ZmiBahsllENL/sV bX+UH79OPrWPzlH4th/W6FsSdsT1eRNMJ3W6XIE= X-Received: by 2002:a92:c562:0:b0:2dc:7ca1:a54c with SMTP id b2-20020a92c562000000b002dc7ca1a54cmr15605ilj.28.1657658303138; Tue, 12 Jul 2022 13:38:23 -0700 (PDT) MIME-Version: 1.0 References: <5949bc710889be1324d5dada995a263fd3c29cb5.camel@mediatek.com> In-Reply-To: <5949bc710889be1324d5dada995a263fd3c29cb5.camel@mediatek.com> From: Andrey Konovalov Date: Tue, 12 Jul 2022 22:38:12 +0200 Message-ID: Subject: Re: [PATCH 21/32] kasan: simplify invalid-free reporting To: Kuan-Ying Lee Cc: "andrey.konovalov@linux.dev" , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , "kasan-dev@googlegroups.com" , Peter Collingbourne , Evgenii Stepanov , Florian Mayer , Andrew Morton , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrey Konovalov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 21, 2022 at 9:17 AM Kuan-Ying Lee wrote: > > On Tue, 2022-06-14 at 04:14 +0800, andrey.konovalov@linux.dev wrote: > > From: Andrey Konovalov > > > > Right now, KASAN uses the kasan_report_type enum to describe report > > types. > > > > As this enum only has two options, replace it with a bool variable. > > > > Also, unify printing report header for invalid-free and other bug > > types > > in print_error_description(). > > > > Signed-off-by: Andrey Konovalov > > --- > > mm/kasan/kasan.h | 7 +------ > > mm/kasan/report.c | 16 +++++++--------- > > 2 files changed, 8 insertions(+), 15 deletions(-) > > > > diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h > > index e8329935fbfb..f696d50b09fb 100644 > > --- a/mm/kasan/kasan.h > > +++ b/mm/kasan/kasan.h > > @@ -146,16 +146,11 @@ static inline bool kasan_requires_meta(void) > > #define META_MEM_BYTES_PER_ROW (META_BYTES_PER_ROW * > > KASAN_GRANULE_SIZE) > > #define META_ROWS_AROUND_ADDR 2 > > > > -enum kasan_report_type { > > - KASAN_REPORT_ACCESS, > > - KASAN_REPORT_INVALID_FREE, > > -}; > > - > > struct kasan_report_info { > > - enum kasan_report_type type; > > void *access_addr; > > void *first_bad_addr; > > size_t access_size; > > + bool is_free; > > bool is_write; > > unsigned long ip; > > }; > > diff --git a/mm/kasan/report.c b/mm/kasan/report.c > > index f951fd39db74..7269b6249488 100644 > > --- a/mm/kasan/report.c > > +++ b/mm/kasan/report.c > > @@ -175,14 +175,12 @@ static void end_report(unsigned long *flags, > > void *addr) > > > > Hi Andrey, > > Do we need to distinguish "double free" case from "invalid free" or > we just print "double-free or invalid-free"? > > I sent a patch[1] to separate double free case from invalid > free last week and I saw it has been merged into akpm tree. > > [1] > https://lore.kernel.org/linux-mm/20220615062219.22618-1-Kuan-Ying.Lee@mediatek.com/ Hi Kuan-Ying, Yes, thank you for the patch! I will rebase my series onto it. Thanks!