From patchwork Tue Dec 7 18:32:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 12695183 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 DE068C433EF for ; Tue, 7 Dec 2021 18:34:17 +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=jYHJ6qStk0gq2voGOIr0HhrORjgZg8Z8jQqk9ybJnyg=; b=lAi2ySeRcVPH7r X23meK3bPIoMGpfy7w3aPyu6SlILHO6Tgg5RvpAK3XpMCTLLa9CmXYc7Ik6Ki4V6uLJf8Us4LpLIx q3O6VQpY0EunzgtBp5HWs48I3TZT2J6zLGABW4lIQ2BWvix+O1Q5/EblU3jNTe1Q/0UCeQeoMZiIs l3xyo1xaTdXdDYixYPjk0F6c4McHCxexKnMnVmDDjOGOql7uc0xY0XAfFlUL37eHyg9A16BEyx9OE JOLJpSKogD4Huo5zPV0jcx/wx8IHAlcteN3n/s0oA7l8w7rn/QCKxJlaJ+oDlYZTMHtXnacOLxoB/ l7/Nm5Xdt/3DqCR9J8Ug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mufGj-009mcR-Di; Tue, 07 Dec 2021 18:32:49 +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 1mufGR-009mXy-UX for linux-arm-kernel@lists.infradead.org; Tue, 07 Dec 2021 18:32:33 +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 500221063; Tue, 7 Dec 2021 10:32:31 -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 29CBE3F73B; Tue, 7 Dec 2021 10:32:30 -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, mark.rutland@arm.com, ryabinin.a.a@gmail.com, will@kernel.org Subject: [PATCH v2 0/2] arm64: kasan: log potential KASAN shadow aliases Date: Tue, 7 Dec 2021 18:32:24 +0000 Message-Id: <20211207183226.834557-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-20211207_103232_093832_08780046 X-CRM114-Status: UNSURE ( 7.48 ) 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 dfff800000000017 | KASAN: null-ptr-deref in range [0x00000000000000b8-0x00000000000000bf] Since v1 [1]: * Use kasan_non_canonical_hook() * Drop move of kasan_shadow_to_mem() * Update commit messages [1] https://lore.kernel.org/r/20211202112731.3346975-1-mark.rutland@arm.com Thanks, Mark. Mark Rutland (2): arm64: mm: use die_kernel_fault() in do_mem_abort() arm64: mm: log potential KASAN shadow alias arch/arm64/mm/fault.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) Tested-by: Andrey Konovalov Acked-by: Will Deacon