Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp534655pxj; Wed, 2 Jun 2021 05:31:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMbuXQapwQ+XkuDjx46SeMMODQUKhM/+eV6ztwGckcVH59PoMV/WuhePTiRmOUxXykAXtd X-Received: by 2002:a05:6402:612:: with SMTP id n18mr24519686edv.83.1622637111266; Wed, 02 Jun 2021 05:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622637111; cv=none; d=google.com; s=arc-20160816; b=uIP65GsDUzjC4Btb03VP+nYj8lb9U+eJnPfYEho0na5n8bnVDGWOUL+MVnsfoj/9xT 7KDuaP1kxC5AqL9qdLz6qWTgzoFsMqj/E6cA6zMnEDzEBmGMVPqHFGUBhhdl7M9ew59U CW73zeIsx+OK+CmaWGPZEJtG7OxK2fSfdIQ8k2B527oQSJwnRljgLH42RURwf/Hb4GWf AT/IWWhQQfo+KPGFhH63Su6J750JiBZCnZ9rtpR7gaAYaOi4loBgPjsuz9ebKnNBUxdr bU81PDKxtBCdpny6FImpy9gp03ilVWgyIMkBnl+I/SSqqm/rVsTA56qRAijhRU8ftzPw tiaw== 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=FgEY4csnfMiTaVbU1WFo7uBvyH/cKykPw3Skdbt2rUs=; b=JVK+ybrH8rYlkFBWi4papFdXKIRUK1U9n7cTyXEoqZs4aVhv9aYux1m+CVitU7VUEK YsVu7o+yAsQltU34LTh//Y0fn+rLiG/itcssNzCq1BXUI38r2LDhFS3clwW8xdsouO1s zkgAz4h2rXEa2Pl7WyrEq/qjd0XCKxnA+VuXe0p6nLZ2IaGkBkbBK/7XbxjLepeL+Kqw RCK/N7dj/vCg8cRC27iTxESq0CjVHSb0t7owVzzsIjhcC7328OOgnJtr5NPOaoU8Jv2F kbXHW2mLzbccHDWYF69UL9UJdTAHvUfHYr1oRWhjTaIJoYnRkrfoi6KnD7vVteiNTjZ/ VKTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oR1MekKq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si15005580ejf.585.2021.06.02.05.31.23; Wed, 02 Jun 2021 05:31:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oR1MekKq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229961AbhFBMbZ (ORCPT + 99 others); Wed, 2 Jun 2021 08:31:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbhFBMbY (ORCPT ); Wed, 2 Jun 2021 08:31:24 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58FD5C06175F for ; Wed, 2 Jun 2021 05:29:25 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id ba2so974967edb.2 for ; Wed, 02 Jun 2021 05:29:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FgEY4csnfMiTaVbU1WFo7uBvyH/cKykPw3Skdbt2rUs=; b=oR1MekKqjbPZCPJ5qjjyhhoejJ4w6URmvkSJAmYNHI5rve2EYdnP2/ZZRDqliN/os3 84IRO5h+akRYsf9o51toZIaeLKcGDQDU+WbtbtKqglBFp/tzd0S3+sgKwCfxdD6BVJKu +6bf0RgQySZN9Ks5wKNy4+Go3BJI4ARnp4Tna3Pa3Z2AEDw+wjlmbmtpfpJQVVrwlTKn F+aYwNKRH2qlDAT7Xk0/rCEsnFvkZKP/lYVzdfwoQxPT0WRuCJSGvJ4FwHXSmlVyKtvw OotDXghgvK5LKimUaH/DKBFVw4e/TMybkAWQLOnQ2QuAsJUP5K9xfiEPRqqtRLXYXnwk PYkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FgEY4csnfMiTaVbU1WFo7uBvyH/cKykPw3Skdbt2rUs=; b=I3ictan8YxJZteIzqFN2qFB4j8Pja39cj7o+bT2elovagE1v+3SyrDMN3AnMs31h6t Q91vllwtCAK5T/KwfguVUcSJXUHb2kBYgSuJwiy51YceJXEcxOCuwegPULhBfVodQ1k7 X5FJtGZujP5tjZ8nO3sdKitJjmIvvB+CY9s6K5xtwFKvpwV8NoSl6albwXpiQBlPW7Ei /Oc8qJKM+QlLypbOvin0cojxXx3usbjD3rySxFqyilJr7srA5qaXunF5cqRHNV8nqIkT XTDXJi0Uv8KbL9QX8xUzMJQ7HJYEGgAZszqolzlx8r/VLQWntemf2c2sRHhPxMrt39hB dQ7g== X-Gm-Message-State: AOAM533LDxczXVQMdLOtD7cId3gFPCNefs10synDDDzEZ123mOnkbXj3 peU4OTWeWJymUWKvt0PF+hzigyLERzyJuuVV8jc= X-Received: by 2002:aa7:d74b:: with SMTP id a11mr1480803eds.95.1622636964034; Wed, 02 Jun 2021 05:29:24 -0700 (PDT) MIME-Version: 1.0 References: <20210530044708.7155-1-kylee0686026@gmail.com> <20210530044708.7155-2-kylee0686026@gmail.com> <20210531155912.GC622@DESKTOP-PJLD54P.localdomain> In-Reply-To: <20210531155912.GC622@DESKTOP-PJLD54P.localdomain> From: Andrey Konovalov Date: Wed, 2 Jun 2021 15:29:12 +0300 Message-ID: Subject: Re: [PATCH 1/1] kasan: add memory corruption identification for hardware tag-based mode To: Kuan-Ying Lee Cc: Marco Elver , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Andrew Morton , kasan-dev , LKML , Linux Memory Management List , Walter Wu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 31, 2021 at 6:59 PM Kuan-Ying Lee wrote: > > > > > > > +config KASAN_HW_TAGS_IDENTIFY > > > + bool "Enable memory corruption identification" > > > + depends on KASAN_HW_TAGS > > > + help > > > + This option enables best-effort identification of bug type > > > + (use-after-free or out-of-bounds) at the cost of increased > > > + memory consumption. > > > > Can we rename KASAN_SW_TAGS_IDENTIFY -> KASAN_TAGS_IDENTIFY in a > > separate patch and then use that? > > > > Or do we have a problem renaming this options if there are existing > > users of it? Using the single KASAN_TAGS_IDENTIFY config option is what I would like to see. Since this is a purely debugging feature for a less popular KASAN mode, I think renaming the config name is OK. > I tend to keep KASAN_SW_TAGS_IDENTIFY and KASAN_HW_TAGS_IDENTIFY > separately. > > We need these two configs to decide how many stacks we will store. You can define KASAN_NR_FREE_STACKS to different values depending on whether HW_TAGS or SW_TAGS is in use. I don't see a problem here. > If we store as many stacks as SW tag-based kasan does(5 stacks), we might > mistake out-of-bound issues for use-after-free sometime. Becuase HW > tag-based kasan only has 16 kinds of tags. When Out-of-bound issues happened, it might > find the same tag in the stack we just stored and mistake happened. > There is high probability that this mistake will happen.