Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3543032pxb; Mon, 24 Jan 2022 11:50:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzImYPyquCwaRP7uMQxzt1JiCuzqqtLgCP/Ev7tDjI1uAv1C85asUNyqe2DSDXxem9O0D7k X-Received: by 2002:a17:90b:4c0b:: with SMTP id na11mr3460672pjb.118.1643053830871; Mon, 24 Jan 2022 11:50:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643053830; cv=none; d=google.com; s=arc-20160816; b=iguv75MNu8Y5nMC0R4DmQi7LoCdXUCoPRdD43ajebkBcMSPkXNz72DedI7OvFb2zT8 lqxR7NPtu2LCK5KKW+xS1ke+T+6HK1aTv/bZWtre/iYJH7s0C8D71gEHDXPKp4h9Bcfk SuUH3l2ZLORSg04h/gKkXDVDdNHaxx3Exq7B8aGZdl46JL7GQxkykt75ET7f0kDOldh8 T+vtvnGktBvf1JvZqBHYIzP/WUBDgvKvVdf3AqJLxbrqQufs6Qj/tLkZYEJMyCUq55hv 1aWYHIG7Sta41fiugQBVCrHoTzzUqtAGdxWoAzOBDfWqWCWDNLmd3iJjGuoOPppkBgcm 7/5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AV0M9szKvSlfXhwybxJe1jA9V5abexpCELFOGxjWDjg=; b=pyCMQZXthmpLXjpt/bl479Gf99i7YCBBwVEcd0iDeG8++Zo/wkjrl+pT2LXMWjQKIu 7op38uoOS57OqHWzd4BMR2R4hDZtH8zW85CUYKloEZ36ozEAYZRuaInnbTXd1tJ47Eb4 MUumE9zAeXPR3lqd6KYeaMo1TOoYsdedDmLVifbvMSzGjxntDUWwmhkKxyrYbX2hN8af Zm5gEfPiiYvLBpVFZPdpZoXCrehWZNUCPpr28fCWjaXaxxuJPihRMji11K/y88ygSjCi QVXiZyQOxZ71Na8npPEnq/4TeZJ/57ZMLqpsp4Nwer6T/tfTNsmHpsHe7/NS4NjbEZCH piPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=kHtoih+8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y71si3130550pgd.313.2022.01.24.11.50.18; Mon, 24 Jan 2022 11:50:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=kHtoih+8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245074AbiAXSIo (ORCPT + 99 others); Mon, 24 Jan 2022 13:08:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241590AbiAXSIe (ORCPT ); Mon, 24 Jan 2022 13:08:34 -0500 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 294B1C061401 for ; Mon, 24 Jan 2022 10:08:34 -0800 (PST) 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=1643047712; 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=AV0M9szKvSlfXhwybxJe1jA9V5abexpCELFOGxjWDjg=; b=kHtoih+85VSani+/Feh3wScio+0zQDfc2aofB+P5jSAV+ttGVQkGZhp3C/HMS6z69O3B32 ERbfIEtS/m2RPB4d2I95ih4mF9ftMocF+r53tZrCXsAtPi0XRVIbNBqhLIibBFMqSkDaef LNuZMZUBmPRTPv1kLb03MgxE56rNLSY= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, linux-mm@kvack.org, Vincenzo Frascino , Catalin Marinas , Will Deacon , Mark Rutland , linux-arm-kernel@lists.infradead.org, Peter Collingbourne , Evgenii Stepanov , linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH v6 38/39] kasan: documentation updates Date: Mon, 24 Jan 2022 19:05:12 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Konovalov Update KASAN documentation: - Bump Clang version requirement for HW_TAGS as ARM64_MTE depends on AS_HAS_LSE_ATOMICS as of commit 2decad92f4731 ("arm64: mte: Ensure TIF_MTE_ASYNC_FAULT is set atomically"), which requires Clang 12. - Add description of the new kasan.vmalloc command line flag. - Mention that SW_TAGS and HW_TAGS modes now support vmalloc tagging. - Explicitly say that the "Shadow memory" section is only applicable to software KASAN modes. - Mention that shadow-based KASAN_VMALLOC is supported on arm64. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst index 8089c559d339..7614a1fc30fa 100644 --- a/Documentation/dev-tools/kasan.rst +++ b/Documentation/dev-tools/kasan.rst @@ -30,7 +30,7 @@ Software tag-based KASAN mode is only supported in Clang. The hardware KASAN mode (#3) relies on hardware to perform the checks but still requires a compiler version that supports memory tagging instructions. -This mode is supported in GCC 10+ and Clang 11+. +This mode is supported in GCC 10+ and Clang 12+. Both software KASAN modes work with SLUB and SLAB memory allocators, while the hardware tag-based KASAN currently only supports SLUB. @@ -206,6 +206,9 @@ additional boot parameters that allow disabling KASAN or controlling features: Asymmetric mode: a bad access is detected synchronously on reads and asynchronously on writes. +- ``kasan.vmalloc=off`` or ``=on`` disables or enables tagging of vmalloc + allocations (default: ``on``). + - ``kasan.stacktrace=off`` or ``=on`` disables or enables alloc and free stack traces collection (default: ``on``). @@ -279,8 +282,8 @@ Software tag-based KASAN uses 0xFF as a match-all pointer tag (accesses through 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 slab and page_alloc -memory. +Software tag-based KASAN currently only supports tagging of slab, page_alloc, +and vmalloc memory. Hardware tag-based KASAN ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -303,8 +306,8 @@ Hardware tag-based KASAN uses 0xFF as a match-all pointer tag (accesses through 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 slab and page_alloc -memory. +Hardware tag-based KASAN currently only supports tagging of slab, page_alloc, +and VM_ALLOC-based vmalloc memory. 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. @@ -319,6 +322,8 @@ checking gets disabled. Shadow memory ------------- +The contents of this section are only applicable to software KASAN modes. + The kernel maps memory in several different parts of the address space. The range of kernel virtual addresses is large: there is not enough real memory to support a real shadow region for every address that could be @@ -349,7 +354,7 @@ CONFIG_KASAN_VMALLOC With ``CONFIG_KASAN_VMALLOC``, KASAN can cover vmalloc space at the cost of greater memory usage. Currently, this is supported on x86, -riscv, s390, and powerpc. +arm64, riscv, s390, and powerpc. This works by hooking into vmalloc and vmap and dynamically allocating real shadow memory to back the mappings. -- 2.25.1