From patchwork Thu Dec 2 11:27:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 12694487 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A53D9C433F5 for ; Thu, 2 Dec 2021 11:28:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=bGFT5kf2XGytxZKaf8nOC575mCv6xGXNMZC9565830w=; b=j1U1eZFiWNquuC I1B4Bf725GEoaKQ/ndJy0ext2z2qFUjqlK9jNd8wU6XvP0hKs9bsggZ1j48cEJHh+vozoWF2wlQbb ZbfUL5dbXeoVYlesoA7aGCiDEs2/tzigGtNSyBO/EzcmpZ3uDCvH6IubaKsk3QMVPbyj8t2aB4jSY U/K4+jAoOehU+JW8HS642TJH98Q+7VJc+eyX81LKcm6rE/b8qrEQTH4QmT/6oE/K0ggDy0hUQ/Sga fYwURZMK8fDfke0l5pVwMmUARiIO6CINlOtnX/4GLx8PvB5gkRh4hdnSOgwTTIOCbmMO8DoEjkMXm uu+C6zkZNzPk9/HT7RIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mskFZ-00Byob-Jt; Thu, 02 Dec 2021 11:27:41 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mskFW-00Bynb-3l for linux-arm-kernel@lists.infradead.org; Thu, 02 Dec 2021 11:27:39 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A7E6A1435; Thu, 2 Dec 2021 03:27:36 -0800 (PST) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 661123F7D7; Thu, 2 Dec 2021 03:27:35 -0800 (PST) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: andreyknvl@gmail.com, catalin.marinas@arm.com, dvyukov@google.com, glider@google.com, linux-kernel@vger.kernel.org, mark.rutland@arm.com, ryabinin.a.a@gmail.com, will@kernel.org Subject: [PATCH 0/3] arm64: kasan: log potential KASAN shadow aliases Date: Thu, 2 Dec 2021 11:27:28 +0000 Message-Id: <20211202112731.3346975-1-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211202_032738_232466_0D564E3A X-CRM114-Status: UNSURE ( 6.35 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When using KASAN_GENERIC or KASAN_SW_TAGS, many representable pointer values (e.g. NULL) don't have a legitimate shadow address. If KASAN instrumentation attempts to access the shadow for such pointers, it will fault on an unusual-looking address, e.g. | Unable to handle kernel paging request at virtual address dfff800000000001 To make this easier to debug, this series makes the arm64 fault handling code log the corresponding memory range for potential shadow acceses, e.g. | Unable to handle kernel paging request at virtual address dfff800000000001 | Possible KASAN shadow access for range [0000000000000008..000000000000000f] Thanks, Mark. Mark Rutland (3): kasan: move kasan_shadow_to_mem() to shared header arm64: mm: use die_kernel_fault() in do_mem_abort() arm64: mm: log potential KASAN shadow alias arch/arm64/mm/fault.c | 13 ++++++++----- include/linux/kasan.h | 6 ++++++ mm/kasan/kasan.h | 6 ------ 3 files changed, 14 insertions(+), 11 deletions(-)