From patchwork Fri Jan 15 17:52:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 12023525 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 275B4C433E0 for ; Fri, 15 Jan 2021 17:55:26 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DDA3A22262 for ; Fri, 15 Jan 2021 17:55:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDA3A22262 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0a2Fsc3gquRn7p07b8rF87AAvhhKe8BaLEnCw9C8zvE=; b=LYKlY//EybDfdq8uXcpTZfv54 X6F5DhzqQRr081qHiMhyvLqSDStt7Wwa+tE1wgd1MRZ0rx14FMKZ+6pXGr4KxHH/eBkiatebEUfF0 EK4EPC+k21s0pDwBXF1irl37f3NohvNwGzOiLLPSmkjiLV/mLHMOf0q/xF9lOCG9KCiQVJHSm7YSb sjkcEKjabYKyyedXNFOmo+7Q6NWyt+9aL2KxxHCeo/tqKOsb7wN0WfY0ex1Y6fFAYoFkBRV4MOC8A mcJW5jVvFXHonwjA5S21Zb222E+aXH8yj7uZDzO8uUN55A4rZi2MAcb4Uoc6n4OHVN98hIzSfFbao xwMtT5Frg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l0THk-0003Uu-7e; Fri, 15 Jan 2021 17:53:20 +0000 Received: from mail-wm1-x34a.google.com ([2a00:1450:4864:20::34a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l0THX-0003Q1-Js for linux-arm-kernel@lists.infradead.org; Fri, 15 Jan 2021 17:53:10 +0000 Received: by mail-wm1-x34a.google.com with SMTP id z12so3259252wmf.9 for ; Fri, 15 Jan 2021 09:53:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=d+lRqXXla6mV/kMKnUzgl/DAB69C3QZUVHCf/SWSD4s=; b=KgXsADO6gYG+QvJv8VSvdUb8Ltjmd7v7h/iXf4vB+MUx9Hgoo/jNS+Vf6CaL2wEuKc iZx+uRlsmSmChjKZB8PeM+2dY6z/JyFIFLWBbNw1VAx4D2M/iXObjUzCZ7fBSfeX3u0r 5YfdIu95gEZandu93MmDpCwNWtqhZpPlSmmjfvOZLYE9Sbuujc+aqXC2qj2elqLEJ9VM RaDCLzvWaX5/2oD76eVUv0i6nIfmJk8vOryRmLyptUhh9nWI1mtpqlx+Yn/uT4oybi6f oNtAzPYrqpulLvHqnis8loKBQl943FBAFrdnh9YV5x3XZP96MO3+h0totSFQGrfhOew9 8ylg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=d+lRqXXla6mV/kMKnUzgl/DAB69C3QZUVHCf/SWSD4s=; b=KaT7Ecogm8edMLfYkybRU4ZOgAiaT48yw5SgBnlAjgkarThANJ1bYoxmJhw6lMYKQF ethnpaAHSPOrGH/irgk+OqkC15jzn1CbgfBtvMIr/CWLSXZRxfyHP3jX83uc/MWj+ORH gjV8y2K9r+1EBFZZDAujt4LxMIwgp9VE4argJNtPB4PI5jvj4DJ1/f2Chn1WcOWiv5fC HXjNvnXHc9OzBYxl7iF4BfIwB/GasfIsJ6ud2GFYxxKqEd//j0QbvrQ0bnozZ9gvM3yy Q5o/5GxX14BoBp9mT6GRqRzICJsE+U3ECRIOjBGakh5GeIBiYRWvAWr17rZwcUbQpW5j leKQ== X-Gm-Message-State: AOAM530gVPwnDuOkkb8TJ2KN5JBIFj+fbzJxI9crmdSifDuLkPmkU4sm jPHMcD2c/mk7/sJUxqTDlJ2rPTky+CiCG+cj X-Google-Smtp-Source: ABdhPJxUL79lbHyM9ib1bYpCh98XNU7ltPS1uDYDg7Hf/2+vn3e8C3YxAqL9xZFwJzAt5tybo0F8O9/8zxE6C0yc X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:adf:e60f:: with SMTP id p15mr14224523wrm.60.1610733184113; Fri, 15 Jan 2021 09:53:04 -0800 (PST) Date: Fri, 15 Jan 2021 18:52:39 +0100 In-Reply-To: Message-Id: <3b4ea6875bb14d312092ad14ac55cb456c83c08e.1610733117.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog Subject: [PATCH v4 02/15] kasan: clarify HW_TAGS impact on TBI From: Andrey Konovalov To: Andrew Morton , Catalin Marinas , Vincenzo Frascino , Dmitry Vyukov , Alexander Potapenko , Marco Elver X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210115_125307_697712_9896D821 X-CRM114-Status: GOOD ( 12.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Branislav Rankov , Andrey Konovalov , Kevin Brodsky , Will Deacon , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, Andrey Ryabinin , Peter Collingbourne , Evgenii Stepanov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Mention in the documentation that enabling CONFIG_KASAN_HW_TAGS always results in in-kernel TBI (Top Byte Ignore) being enabled. Also do a few minor documentation cleanups. Link: https://linux-review.googlesource.com/id/Iba2a6697e3c6304cb53f89ec61dedc77fa29e3ae Reviewed-by: Marco Elver Reviewed-by: Alexander Potapenko Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst index 0fc3fb1860c4..26c99852a852 100644 --- a/Documentation/dev-tools/kasan.rst +++ b/Documentation/dev-tools/kasan.rst @@ -147,15 +147,14 @@ negative values to distinguish between different kinds of inaccessible memory like redzones or freed memory (see mm/kasan/kasan.h). In the report above the arrows point to the shadow byte 03, which means that -the accessed address is partially accessible. - -For tag-based KASAN this last report section shows the memory tags around the -accessed address (see `Implementation details`_ section). +the accessed address is partially accessible. For tag-based KASAN modes this +last report section shows the memory tags around the accessed address +(see the `Implementation details`_ section). Boot parameters ~~~~~~~~~~~~~~~ -Hardware tag-based KASAN mode (see the section about different mode below) is +Hardware tag-based KASAN mode (see the section about various modes below) is intended for use in production as a security mitigation. Therefore it supports boot parameters that allow to disable KASAN competely or otherwise control particular KASAN features. @@ -305,6 +304,13 @@ reserved to tag freed memory regions. Hardware tag-based KASAN currently only supports tagging of kmem_cache_alloc/kmalloc 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. + +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 +support MTE (but supports TBI). + What memory accesses are sanitised by KASAN? --------------------------------------------