From patchwork Mon Jul 6 12:24:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11645589 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2BE7592A for ; Mon, 6 Jul 2020 12:29:12 +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 027122084C for ; Mon, 6 Jul 2020 12:29:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1NgABZ9C"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="U8cmE1A7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 027122084C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=30tm+iLRovHTo9FOpPRfp9/Lblp/ajiCRDV6PPEXBwk=; b=1NgABZ9Cy8GXfIJ+DZ7wuepQK jR6AJ3pBl5/1IZTrhJ0cOoCTfowS0GiVhuSMBwZiQZ+fx7maXhNOEwA0DH7UZSPME0kaxGKiVBWnL YVi+UTy/qni1Se8ao7DZxhLF9JBlLOwTwnRvEXXaNyOk8o6qZInmqPvl+FCmcFKPT1x5LWmPSC6wf VIKVBqL6fsXJnlvwIpxkjNNXBD/fcv64wNPLRzcYAdmGW38uuAkxkJWkg0xOy+cohlfPFdOD9Fcu7 H7gTEzseZMdi/hF+tNpZdewCX4RjNJtSk5Ua86ktE14LHB9SkklhDr3tLH91/p18zUuJJQ/c4usCH T64OrALOA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsQDq-00073x-Jy; Mon, 06 Jul 2020 12:27:46 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsQDa-0006xo-3K for linux-arm-kernel@lists.infradead.org; Mon, 06 Jul 2020 12:27:32 +0000 Received: by mail-lf1-x143.google.com with SMTP id t74so22471092lff.2 for ; Mon, 06 Jul 2020 05:27:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zrZeijvKclD0LoRMeuFsiIbPHQb2TJSstZW6Stmx2xg=; b=U8cmE1A73jeqv4M5m/MHhtQNC7PPXwy9AiAUMbghI7w2s60c49ss1sfFMC/sS3IuE/ LTVvSqWD/MJF/OTalTLlAiZ2WeLWTKacXNFK8jDsTZ5tsqWm7BwtotbJf8GOmPLYyrzV q8cfzQxv/obrru82RDF/LA21CnnwSI/cdOObenPr0bXHYd7QYEcJ0XojhRUv2u2prZ2F rp+IGqwd7ENTpgH/kWH6Pb7JhQsfQJ8+ItjJQE4kQEA0Vis4hTSot7MI6virfBVtioH2 IJq90WBLMBsz1DV4izPFji9I43yED7A9etD1Q+gUwpRCEFBdELtsBgfsUpqq3FvgPybq 5NpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zrZeijvKclD0LoRMeuFsiIbPHQb2TJSstZW6Stmx2xg=; b=mizLPjzdmTnM3/CcOV5fLSLLr9L4k2tBN88lTzsDsoAJ6IygYShga5hLx0LTQieOC1 Y8TG6dYZkT85VwOIEFkOCNNI/Z0gmTCxMcAdCmXqZ8TPNQ0UJCXh5UvI7pf5PaeZ5Sir qNx2IZw0PROLMsLbz67HGAITlZVtKlfD9ke95TY0wlA91ktNoUUiqG4JpU16H9ijwems 6ZuhLFqSnHatwn8dsIE0xvu+3QSBtj4Lz18yAHBpMnTCwGiMDSBIYU2Sb0hx5andum77 WvtgJqlzDwzXBG/ED4gkgiF4PJmjxQsjrBQjEszBSz/ocPWfOVh45m0xBDv8in+DjkCq c03g== X-Gm-Message-State: AOAM533+uU+1EqTHD3XzV8UPsVR/VenZYfPJpErCCGmS+gsYf9X+De+m MNG10hcwOeSW3emlempOoY6cgw== X-Google-Smtp-Source: ABdhPJz0fzICCNCB0619XqnsD5jnisdMI27S90ct4pKFsP9xzl3MxWiYO1w2rW9I7sFplHibxKxSsw== X-Received: by 2002:a19:7407:: with SMTP id v7mr28396547lfe.4.1594038448737; Mon, 06 Jul 2020 05:27:28 -0700 (PDT) Received: from localhost.localdomain (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id v20sm8534223lfr.74.2020.07.06.05.27.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2020 05:27:28 -0700 (PDT) From: Linus Walleij To: Florian Fainelli , Abbott Liu , Russell King , Ard Biesheuvel , Andrey Ryabinin , Mike Rapoport Subject: [PATCH 5/5 v12] ARM: Enable KASan for ARM Date: Mon, 6 Jul 2020 14:24:47 +0200 Message-Id: <20200706122447.696786-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200706122447.696786-1-linus.walleij@linaro.org> References: <20200706122447.696786-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200706_082730_250195_CA42193A X-CRM114-Status: GOOD ( 14.45 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:143 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: Arnd Bergmann , Linus Walleij , kasan-dev@googlegroups.com, Alexander Potapenko , linux-arm-kernel@lists.infradead.org, Andrey Ryabinin , Dmitry Vyukov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Andrey Ryabinin This patch enables the kernel address sanitizer for ARM. XIP_KERNEL has not been tested and is therefore not allowed for now. Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Dmitry Vyukov Cc: kasan-dev@googlegroups.com Acked-by: Dmitry Vyukov Reviewed-by: Ard Biesheuvel Tested-by: Ard Biesheuvel # QEMU/KVM/mach-virt/LPAE/8G Signed-off-by: Abbott Liu Signed-off-by: Florian Fainelli Signed-off-by: Linus Walleij --- ChangeLog v11->v12: - Resend with the other changes. ChangeLog v10->v11: - Resend with the other changes. ChangeLog v9->v10: - Rebase on v5.8-rc1 ChangeLog v8->v9: - Fix the arch feature matrix for Arm to include KASan. - Collect Ard's tags. ChangeLog v7->v8: - Moved the hacks to __ADDRESS_SANITIZE__ to the patch replacing the memory access functions. - Moved the definition of KASAN_OFFSET out of this patch and to the patch that defines the virtual memory used by KASan. --- Documentation/dev-tools/kasan.rst | 4 ++-- Documentation/features/debug/KASAN/arch-support.txt | 2 +- arch/arm/Kconfig | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst index c652d740735d..0962365e1405 100644 --- a/Documentation/dev-tools/kasan.rst +++ b/Documentation/dev-tools/kasan.rst @@ -21,8 +21,8 @@ global variables yet. Tag-based KASAN is only supported in Clang and requires version 7.0.0 or later. -Currently generic KASAN is supported for the x86_64, arm64, xtensa, s390 and -riscv architectures, and tag-based KASAN is supported only for arm64. +Currently generic KASAN is supported for the x86_64, arm, arm64, xtensa, s390 +and riscv architectures, and tag-based KASAN is supported only for arm64. Usage ----- diff --git a/Documentation/features/debug/KASAN/arch-support.txt b/Documentation/features/debug/KASAN/arch-support.txt index 6ff38548923e..a73c55fb76e6 100644 --- a/Documentation/features/debug/KASAN/arch-support.txt +++ b/Documentation/features/debug/KASAN/arch-support.txt @@ -8,7 +8,7 @@ ----------------------- | alpha: | TODO | | arc: | TODO | - | arm: | TODO | + | arm: | ok | | arm64: | ok | | c6x: | TODO | | csky: | TODO | diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d291cdb84c9d..6a6059f8bab9 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -65,6 +65,7 @@ config ARM select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU + select HAVE_ARCH_KASAN if MMU && !XIP_KERNEL select HAVE_ARCH_MMAP_RND_BITS if MMU select HAVE_ARCH_SECCOMP_FILTER if AEABI && !OABI_COMPAT select HAVE_ARCH_THREAD_STRUCT_WHITELIST