From patchwork Tue Nov 30 22:08:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 12648293 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA3EAC433F5 for ; Tue, 30 Nov 2021 22:15:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4CB206B008A; Tue, 30 Nov 2021 17:08:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 47A636B008C; Tue, 30 Nov 2021 17:08:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 36A506B0092; Tue, 30 Nov 2021 17:08:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0044.hostedemail.com [216.40.44.44]) by kanga.kvack.org (Postfix) with ESMTP id 27E2C6B008A for ; Tue, 30 Nov 2021 17:08:34 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id DFD2285D44 for ; Tue, 30 Nov 2021 22:08:23 +0000 (UTC) X-FDA: 78866986086.04.B3FF36C Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf21.hostedemail.com (Postfix) with ESMTP id 3E919D0369F7 for ; Tue, 30 Nov 2021 22:08:20 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1638310102; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xAlgAJIkgdSw/H62J4ONvMmg8WxewXYkqfQfZPdbW8s=; b=Fjt3KF2AE9L8abL87e/sthlvRPuIz3/0wTs/HSkbbBxV0dkxxuai3S0j8hVXgv7J5xWLwx 7YkXYpw7rpYHEX130k/jyyGvkGlaRLdP1MaIzvhzsx0T8wNIITbyXlDeWY23FP9Cc/7C14 cT9MC9WlOTZpg5dB9aK0P05Zie7j/ok= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko , Vincenzo Frascino , Catalin Marinas , Peter Collingbourne Cc: Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Andrew Morton , linux-mm@kvack.org, Will Deacon , linux-arm-kernel@lists.infradead.org, Evgenii Stepanov , linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH 29/31] kasan, arm64: allow KASAN_VMALLOC with HW_TAGS Date: Tue, 30 Nov 2021 23:08:20 +0100 Message-Id: <8afdf7eb0bae77d2e94210d689d524580cf5ed9a.1638308023.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 3E919D0369F7 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Fjt3KF2A; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf21.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev X-Stat-Signature: zqnu8ktkw4cx8wc6g1iysmhbr7h4dtrh X-HE-Tag: 1638310100-37281 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: From: Andrey Konovalov vmalloc tagging support for HW_TAGS KASAN is now complete. Allow enabling CONFIG_KASAN_VMALLOC. Also adjust CONFIG_KASAN_VMALLOC description: - Mention HW_TAGS support. - Remove unneeded internal details: they have no place in Kconfig description and are already explained in the documentation. Signed-off-by: Andrey Konovalov --- arch/arm64/Kconfig | 3 +-- lib/Kconfig.kasan | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index c05d7a06276f..5981e5460c51 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -205,8 +205,7 @@ config ARM64 select IOMMU_DMA if IOMMU_SUPPORT select IRQ_DOMAIN select IRQ_FORCED_THREADING - select KASAN_VMALLOC if KASAN_GENERIC - select KASAN_VMALLOC if KASAN_SW_TAGS + select KASAN_VMALLOC select MODULES_USE_ELF_RELA select NEED_DMA_MAP_STATE select NEED_SG_DMA_LENGTH diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan index 3f144a87f8a3..7834c35a7964 100644 --- a/lib/Kconfig.kasan +++ b/lib/Kconfig.kasan @@ -178,17 +178,17 @@ config KASAN_TAGS_IDENTIFY memory consumption. config KASAN_VMALLOC - bool "Back mappings in vmalloc space with real shadow memory" - depends on (KASAN_GENERIC || KASAN_SW_TAGS) && HAVE_ARCH_KASAN_VMALLOC + bool "Check accesses to vmalloc allocations" + depends on HAVE_ARCH_KASAN_VMALLOC help - By default, the shadow region for vmalloc space is the read-only - zero page. This means that KASAN cannot detect errors involving - vmalloc space. - - Enabling this option will hook in to vmap/vmalloc and back those - mappings with real shadow memory allocated on demand. This allows - for KASAN to detect more sorts of errors (and to support vmapped - stacks), but at the cost of higher memory usage. + This mode makes KASAN check accesses to vmalloc allocations for + validity. + + With software KASAN modes, checking is done for all types of vmalloc + allocations. Enabling this option leads to higher memory usage. + + With hardware tag-based KASAN, only VM_ALLOC mappings are checked. + There is no additional memory usage. config KASAN_KUNIT_TEST tristate "KUnit-compatible tests of KASAN bug detection capabilities" if !KUNIT_ALL_TESTS