From patchwork Thu Mar 11 21:37:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 12132957 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=-26.3 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_GIT,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 E3F20C433E6 for ; Thu, 11 Mar 2021 21:37:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 84BED64F8E for ; Thu, 11 Mar 2021 21:37:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84BED64F8E 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 16EA18D0300; Thu, 11 Mar 2021 16:37:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0FBBE8D02B2; Thu, 11 Mar 2021 16:37:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EDA658D0300; Thu, 11 Mar 2021 16:37:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0254.hostedemail.com [216.40.44.254]) by kanga.kvack.org (Postfix) with ESMTP id CE3FC8D02B2 for ; Thu, 11 Mar 2021 16:37:45 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8DC695DC1 for ; Thu, 11 Mar 2021 21:37:45 +0000 (UTC) X-FDA: 77908905690.18.09A6FB4 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) by imf21.hostedemail.com (Postfix) with ESMTP id 34035E0011DD for ; Thu, 11 Mar 2021 21:37:43 +0000 (UTC) Received: by mail-wr1-f73.google.com with SMTP id z17so10116108wrv.23 for ; Thu, 11 Mar 2021 13:37:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=jCUwUXSRYRP2LJ367pVG9mu783jEZOVPApZYYYorTcY=; b=Plz1xq3SLytyAFVQRIdDqpfeMoVJQVQnjL8v5eLWlHpRU3ZXHwZ7nNYQwGHB8jkEl0 oec/CqXdexSMPCB/xEQc8lqn+4mP/LOkm0oqY//jnkP3wzYEtNThi7FOfPPphX4RmoFE ao0BmeAMJqqGLTJkM09Ht/ur6e2pTnhYW0cyFZmYZTeP54Hg1c8nULI2bpOngYV9skI4 nlX9Ks5TI8iw8G6P5wTshuA2NBNFjML5xjZ2/0seUMwzVpI2lSb/a5NuFtLu1Z6COWrK /Zj1Uzg5xBCAF7rntkf4bj4+xzxSqLYPE/b+KjqGXV1+z3P9U99E669EFLETrkPaiJWQ MQug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=jCUwUXSRYRP2LJ367pVG9mu783jEZOVPApZYYYorTcY=; b=MfD6uIFO9TGg3AXkAOOc5IzA/HHqOX6I5s8YqQdumELqUhuC6p4/dus1DjHkRTks60 p7zW9oNqmhlXFx4hPGnLoLVF2yCwRzWat/Yml2w0AArVeTU4zVeE3Zgwark+84/VLdwT vQ9eyFyu6T5KRzxySNQBJ6khO7d4KJ5on2L14byNtpLaNf9A+KWTfwI58zwCtOyjAUv7 /a9/1Infy1cYEoxzPGFZS1MjhPnHevAj59DknRs4xL6nn39YeBUm0k8dZvlg8iUeyEOY P/UFK2AejuutadnTcbHZtuW42KRmBkzLYvCh03xbOAsJ0+aTTJVCJeoeiQO2q5PNmVgh hCkQ== X-Gm-Message-State: AOAM5305sqTsmD7mZk5Jyl7eRrlBJ+RmuaznKcU14ctbelwL2nS8AA7k Cshavjc0tQx2xPsh/iRyFhBD+E5xbc39Aaj2 X-Google-Smtp-Source: ABdhPJy84LzHn4mR19rjSQ67/EMk7xl1CZfA7JzaPJm1mLIqYkbPLMRC4CDyeZ6DR1cH6gpwHsKjcZ2idgfZSv0y X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:95a:d8a8:4925:42be]) (user=andreyknvl job=sendgmr) by 2002:a7b:c0c4:: with SMTP id s4mr10327657wmh.9.1615498664022; Thu, 11 Mar 2021 13:37:44 -0800 (PST) Date: Thu, 11 Mar 2021 22:37:20 +0100 In-Reply-To: Message-Id: <318ca25e3e3d32482c0155b662ce4057e436f9cd.1615498565.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog Subject: [PATCH 08/11] kasan: docs: update HW_TAGS implementation details section From: Andrey Konovalov To: Andrew Morton , Alexander Potapenko , Marco Elver Cc: Andrey Ryabinin , Dmitry Vyukov , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov X-Stat-Signature: uoyyr11s36abo6fa7kgqxwtdrob4tda7 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 34035E0011DD Received-SPF: none (flex--andreyknvl.bounces.google.com>: No applicable sender policy available) receiver=imf21; identity=mailfrom; envelope-from="<3qI1KYAoKCPUXkaobvhksidlldib.Zljifkru-jjhsXZh.lod@flex--andreyknvl.bounces.google.com>"; helo=mail-wr1-f73.google.com; client-ip=209.85.221.73 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615498663-646996 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: Update the "Implementation details" section for HW_TAGS KASAN: - Punctuation, readability, and other minor clean-ups. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst index dff18e180120..f5c746a475c1 100644 --- a/Documentation/dev-tools/kasan.rst +++ b/Documentation/dev-tools/kasan.rst @@ -270,35 +270,35 @@ memory. Hardware tag-based KASAN ~~~~~~~~~~~~~~~~~~~~~~~~ -Hardware tag-based KASAN is similar to the software mode in concept, but uses +Hardware tag-based KASAN is similar to the software mode in concept but uses hardware memory tagging support instead of compiler instrumentation and shadow memory. Hardware tag-based KASAN is currently only implemented for arm64 architecture and based on both arm64 Memory Tagging Extension (MTE) introduced in ARMv8.5 -Instruction Set Architecture, and Top Byte Ignore (TBI). +Instruction Set Architecture and Top Byte Ignore (TBI). Special arm64 instructions are used to assign memory tags for each allocation. Same tags are assigned to pointers to those allocations. On every memory -access, hardware makes 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 a fault is generated and a report is printed. +access, hardware makes 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, a fault is generated, and a report is printed. Hardware 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. -Hardware tag-based KASAN currently only supports tagging of -kmem_cache_alloc/kmalloc and page_alloc memory. +Hardware tag-based KASAN currently only supports tagging of slab and page_alloc +memory. -If the hardware doesn't support MTE (pre ARMv8.5), hardware tag-based KASAN -won't be enabled. In this case all boot parameters are ignored. +If the hardware does not support MTE (pre ARMv8.5), hardware tag-based KASAN +will not be enabled. In this case, all KASAN boot parameters are ignored. -Note, that enabling CONFIG_KASAN_HW_TAGS always results in in-kernel TBI being -enabled. Even when kasan.mode=off is provided, or when the hardware doesn't +Note that enabling CONFIG_KASAN_HW_TAGS always results in in-kernel TBI being +enabled. Even when ``kasan.mode=off`` is provided or when the hardware does not support MTE (but supports TBI). -Hardware tag-based KASAN only reports the first found bug. After that MTE tag +Hardware tag-based KASAN only reports the first found bug. After that, MTE tag checking gets disabled. Shadow memory