From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F226C47083 for ; Wed, 2 Jun 2021 12:29:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AE62661396 for ; Wed, 2 Jun 2021 12:29:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE62661396 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 39F196B006C; Wed, 2 Jun 2021 08:29:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 34F346B006E; Wed, 2 Jun 2021 08:29:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1EFF46B0070; Wed, 2 Jun 2021 08:29:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0036.hostedemail.com [216.40.44.36]) by kanga.kvack.org (Postfix) with ESMTP id E28886B006C for ; Wed, 2 Jun 2021 08:29:25 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 701C998BE for ; Wed, 2 Jun 2021 12:29:25 +0000 (UTC) X-FDA: 78208714290.32.2973B38 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) by imf16.hostedemail.com (Postfix) with ESMTP id 895078019365 for ; Wed, 2 Jun 2021 12:29:12 +0000 (UTC) Received: by mail-ed1-f43.google.com with SMTP id o5so2703423edc.5 for ; Wed, 02 Jun 2021 05:29:24 -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=QKACWZLFLfxjVf7r/K0OYInOyXQt21gDc/BlcLH2s2M0bllqmwlIXN6l44a+zKRfUT hC2yJJDe/H3xOUiNc5w9Bi9xW8Nx0/b/rhhlRvMyszg65he0/HjwTpiXR7D56DWxFEcX /gEP8eUBrlE+Jr4HiMrT0agIpu8SPhtkE2sDpfmskOyrqHrPADN2qoIL1CEKYP2myuWB ARmL0d5EM3fmegwwwr55qKE7OUHAnInD4Qik6ZiWNTIowQs8tl2y2iIO0efZT+8hU/uV b5mCrrgkbuHZyVK5ZHtVo9vuqkIYDkoK2nuQO4gmmbsgB7Dg9p7px9fWqZI7AiLTw9ua 14yw== X-Gm-Message-State: AOAM530fA5eK9ArC/q8nL29itMFUfyUWjE/oDnDpEd7tQLGTDc2RHHw8 2rGEYcvF52b9DvEWNYcqEPnohfiirv1Xied/VGw= X-Google-Smtp-Source: ABdhPJx9DMEB/sshUJnfxFP0Z1YiUkfEObPu5nt4HKkefEkIKBXgWBHkETD01bnUxyol9nf+12ENNpev4JmeTBKyrBY= 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" Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=oR1MekKq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of andreyknvl@gmail.com designates 209.85.208.43 as permitted sender) smtp.mailfrom=andreyknvl@gmail.com X-Stat-Signature: rdz7qen3zp6uhikchgfc9popztsptr9y X-Rspamd-Queue-Id: 895078019365 X-Rspamd-Server: rspam02 X-HE-Tag: 1622636952-198708 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000009, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.