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=-24.8 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=ham 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 DEAA5C433DB for ; Fri, 12 Mar 2021 15:09:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7C4C364DF0 for ; Fri, 12 Mar 2021 15:09:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C4C364DF0 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 181FE6B006E; Fri, 12 Mar 2021 10:09:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 159D26B0072; Fri, 12 Mar 2021 10:09:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EEE9D6B0073; Fri, 12 Mar 2021 10:09:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id CF5F76B006E for ; Fri, 12 Mar 2021 10:09:30 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 93FD718000BFB for ; Fri, 12 Mar 2021 15:09:30 +0000 (UTC) X-FDA: 77911556100.26.6C4573E Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by imf19.hostedemail.com (Postfix) with ESMTP id 729FF90009FD for ; Fri, 12 Mar 2021 15:09:26 +0000 (UTC) Received: by mail-wm1-f46.google.com with SMTP id g20so4013589wmk.3 for ; Fri, 12 Mar 2021 07:09:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gtvZkycLjntznV5+6tLS7tFxXM/9IJvZKgaaSBlNSTQ=; b=R1RmWkGT1x3hbCJUbRvCXQ89MYHdUlI1InTiHA94uSD3kBkHraP9FJuQ5AOdPyYNjI CxpdxKcbYtXwFSWerFivcZMkUpprYKgsrOx4rtyLl2XG4hm8pZp1ZB4AJaZu7BXMYkrv IZkdoO2UOBQZ9q4Bd59/0/QGnknnVLD2C3KPkdQ/kxctcFUGo/Tl5pN53hBQ6U4Mhi6n T2OW+xMGVCI0a7Dt2rBmfxSR46OJj2xqbKVXy6eEWHau9t10ygndE2xB0n/NmJVxdUF2 ldgER97oDBp2llh6cKLStXwDOtZ0iAgaSks7I8kVjt2BYdnrN93CYS2bKkJ3KBiSm3NO gpPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gtvZkycLjntznV5+6tLS7tFxXM/9IJvZKgaaSBlNSTQ=; b=hu2Mzu8prLv9GKg6Zo+rzOx0BQIky10oDZu3AWsVG9mdbb1Gw7RXEHqqCScg9cpyB5 4BPL95TdFOEJ/noqFROB8WpiyTQ5Zob2Eb+z7sNZG1GB4RUno39yQcLdIMYVyn6XZNq3 MPpgK43y6EI9g6nLwzdNJPInDN4JLjpfnEFiIFypsanSgphDbRfKqVSJJPBwG31GKgx1 T2FT8gN07tFW8ak5/XAgLmc4zAGR9soscDyKi09xHuXtArhexYvuvB3FcKmeGFXnHUec trs1VK56ll2mIswG1bevYlhc/aKWknT02YIH+oFXaoD3GR/VvbBUpNOR/g0f3ezmkkab X1Lg== X-Gm-Message-State: AOAM532gRTw7sZQ2NVW+KFYRJp3c6dRVvCLFTFtRyjABT24FnUGZKY10 GFt9M7t+91f+wmt9yft7mnRa7g== X-Google-Smtp-Source: ABdhPJwBfXueLJBMCj23l7EQ07XOv08i1is4PTUitFfFu5xK0O1WheNDM1Dolhaht3ud+Qzv7dg38Q== X-Received: by 2002:a1c:4986:: with SMTP id w128mr13516548wma.37.1615561761555; Fri, 12 Mar 2021 07:09:21 -0800 (PST) Received: from elver.google.com ([2a00:79e0:15:13:d5de:d45f:f79c:cb62]) by smtp.gmail.com with ESMTPSA id m3sm2303932wmc.48.2021.03.12.07.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 07:09:20 -0800 (PST) Date: Fri, 12 Mar 2021 16:09:15 +0100 From: Marco Elver To: Andrey Konovalov Cc: Andrew Morton , Alexander Potapenko , Andrey Ryabinin , Dmitry Vyukov , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 07/11] kasan: docs: update SW_TAGS implementation details section Message-ID: References: <69b9b2e49d8cf789358fa24558be3fc0ce4ee32c.1615559068.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <69b9b2e49d8cf789358fa24558be3fc0ce4ee32c.1615559068.git.andreyknvl@google.com> User-Agent: Mutt/2.0.5 (2021-01-21) X-Stat-Signature: 8s7teq1zrpuaroaui5pspw8ow3ci6zea X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 729FF90009FD Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=mail-wm1-f46.google.com; client-ip=209.85.128.46 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615561766-319744 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Mar 12, 2021 at 03:24PM +0100, Andrey Konovalov wrote: > Update the "Implementation details" section for SW_TAGS KASAN: > > - Clarify the introduction sentence. > - Punctuation, readability, and other minor clean-ups. > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > Documentation/dev-tools/kasan.rst | 39 +++++++++++++++---------------- > 1 file changed, 19 insertions(+), 20 deletions(-) > > diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst > index 986410bf269f..5873d80cc1fd 100644 > --- a/Documentation/dev-tools/kasan.rst > +++ b/Documentation/dev-tools/kasan.rst > @@ -235,38 +235,37 @@ quarantine (see mm/kasan/quarantine.c for implementation). > Software tag-based KASAN > ~~~~~~~~~~~~~~~~~~~~~~~~ > > -Software tag-based KASAN requires software memory tagging support in the form > -of HWASan-like compiler instrumentation (see HWASan documentation for details). > - > -Software tag-based KASAN is currently only implemented for arm64 architecture. > +Software tag-based KASAN uses a software memory tagging approach to checking > +access validity. It is currently only implemented for the arm64 architecture. > > Software tag-based KASAN uses the Top Byte Ignore (TBI) feature of arm64 CPUs > -to store a pointer tag in the top byte of kernel pointers. Like generic KASAN > -it uses shadow memory to store memory tags associated with each 16-byte memory > -cell (therefore it dedicates 1/16th of the kernel memory for shadow memory). > +to store a pointer tag in the top byte of kernel pointers. It uses shadow memory > +to store memory tags associated with each 16-byte memory cell (therefore, it > +dedicates 1/16th of the kernel memory for shadow memory). > > -On each memory allocation software tag-based KASAN generates a random tag, tags > -the allocated memory with this tag, and embeds this tag into the returned > +On each memory allocation, software tag-based KASAN generates a random tag, tags > +the allocated memory with this tag, and embeds the same tag into the returned > pointer. > > Software tag-based KASAN uses compile-time instrumentation to insert checks > -before each memory access. These checks make sure that tag of the memory that > -is being accessed is equal to tag of the pointer that is used to access this > -memory. In case of a tag mismatch software tag-based KASAN prints a bug report. > +before each memory access. These checks make sure that the tag of the memory > +that is being accessed is equal to the tag of the pointer that is used to access > +this memory. In case of a tag mismatch, software tag-based KASAN prints a bug > +report. > > -Software tag-based KASAN also has two instrumentation modes (outline, that > -emits callbacks to check memory accesses; and inline, that performs the shadow > +Software tag-based KASAN also has two instrumentation modes (outline, which > +emits callbacks to check memory accesses; and inline, which performs the shadow > memory checks inline). With outline instrumentation mode, a bug report is > -simply printed from the function that performs the access check. With inline > -instrumentation a brk instruction is emitted by the compiler, and a dedicated > -brk handler is used to print bug reports. > +printed from the function that performs the access check. With inline > +instrumentation, a ``brk`` instruction is emitted by the compiler, and a > +dedicated ``brk`` handler is used to print bug reports. > > Software tag-based KASAN uses 0xFF as a match-all pointer tag (accesses through > -pointers with 0xFF pointer tag aren't checked). The value 0xFE is currently > +pointers with the 0xFF pointer tag are not checked). The value 0xFE is currently > reserved to tag freed memory regions. > > -Software tag-based KASAN currently only supports tagging of > -kmem_cache_alloc/kmalloc and page_alloc memory. > +Software tag-based KASAN currently only supports tagging of slab and page_alloc > +memory. > > Hardware tag-based KASAN > ~~~~~~~~~~~~~~~~~~~~~~~~ > -- > 2.31.0.rc2.261.g7f71774620-goog >