From patchwork Thu Jan 14 19:36:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 12020747 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=-16.6 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT 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 D5B4BC43381 for ; Thu, 14 Jan 2021 19:36:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9064B23A52 for ; Thu, 14 Jan 2021 19:36:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9064B23A52 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 CE3718D011B; Thu, 14 Jan 2021 14:36:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C93E28D011A; Thu, 14 Jan 2021 14:36:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0C728D011B; Thu, 14 Jan 2021 14:36:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0099.hostedemail.com [216.40.44.99]) by kanga.kvack.org (Postfix) with ESMTP id 9487D8D011A for ; Thu, 14 Jan 2021 14:36:41 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 61D68181AC9B6 for ; Thu, 14 Jan 2021 19:36:41 +0000 (UTC) X-FDA: 77705387802.10.hand77_5c0ca7927529 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 2A01316A4C1 for ; Thu, 14 Jan 2021 19:36:41 +0000 (UTC) X-HE-Tag: hand77_5c0ca7927529 X-Filterd-Recvd-Size: 5789 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Thu, 14 Jan 2021 19:36:40 +0000 (UTC) Received: by mail-wr1-f74.google.com with SMTP id q18so3051934wrc.20 for ; Thu, 14 Jan 2021 11:36:40 -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=HqcwClnACemM2BreGXjbZuHbh6LokgqSKM886rsXhYMs0v4uwRJA/1I64zVxzJOjLN 0dI01vPBjEImR5HaBOvV2GaFYeK7da2uzLOajZcjbp9ZVjEf0p8KiMcMO5/ag5qv/SLc BO+3zoUsJEZsaX8uA3f6J6eut+UmGtFPik3sWGDaCDXar5io/R7Kr1xIP5z+4xEf2JO7 YlMp1/UwDbbjGlycrk76vLmKAtCFCmCeFejImudBUceZcvxjkCmlTSDov7BYFHDymrwn lZisrTqwqpUJ8QgHmAaEG1Vzj9OVqFxk9FbyHYj8ePt8DqewkN3tr49f3NfolSHqvzON xDhA== 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=caOJyGGiDm25+nmdGDZcnlBQYKH/ISrAvPKkFgnmvMjuE30FAUL1WrqlueoLBgiZ58 Q4mCOY9ltL92J3dAkR2G2cOvtbMJWh0JhYROdok7ZkhB7vhw1C8VQjYomxyKLQbI+5KD V4b4GfnGDRFafuvppINy4qVPBUc4tDg49NeljEeSkmKZhydeQIVSHRQ+Stz/+T+36M+u N3CpjV9pNTIzZy7wHVWNC7iFTJFp1banSRFCXHsiU6dyB+D01g+eVkN9C1+8w3yrKH/Q RWi9JwcJow97OS6dYH7kbY/8WB0FRUxUy/EjIBgpTzaFNkj8A9FTWU7joU8tubvkEVU4 5WeQ== X-Gm-Message-State: AOAM532F+QePm5pSWWGzcYjQuHBAeQgd5UEMyJqIIhnRT2ZUXMSvgPZF gzptODDLFCLFp2/YBfhXFxMAuHx+4eIC2J3P X-Google-Smtp-Source: ABdhPJzEQ53k5yQWEB0feLLtg91cuk/HNH37rQctEtucW5Gn8rr/RgxVl8rzUbLV1aVSGSQLaLIavCg3VRRcl28l X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a7b:cf3a:: with SMTP id m26mr2355477wmg.55.1610652999318; Thu, 14 Jan 2021 11:36:39 -0800 (PST) Date: Thu, 14 Jan 2021 20:36:18 +0100 In-Reply-To: Message-Id: <2ae5e3db477b08bddfe36a5fc7fb10955cd49f95.1610652890.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog Subject: [PATCH v3 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 Cc: Will Deacon , Andrey Ryabinin , Peter Collingbourne , Evgenii Stepanov , Branislav Rankov , Kevin Brodsky , kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov 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: 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? --------------------------------------------