From patchwork Wed Aug 24 08:47:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Aota X-Patchwork-Id: 12953067 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 82549C00140 for ; Wed, 24 Aug 2022 08:49:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA922940008; Wed, 24 Aug 2022 04:49:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D58E5940007; Wed, 24 Aug 2022 04:49:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C20BA940008; Wed, 24 Aug 2022 04:49:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AF6A1940007 for ; Wed, 24 Aug 2022 04:49:42 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5EBC1411BE for ; Wed, 24 Aug 2022 08:49:42 +0000 (UTC) X-FDA: 79833863004.22.97D79EE Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by imf20.hostedemail.com (Postfix) with ESMTP id 733B21C0009 for ; Wed, 24 Aug 2022 08:49:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1661330981; x=1692866981; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=4kZqvFG4tMiUnKB0w/rq1VrH8DwwrNQlje7Rk/MmMEQ=; b=Dv3dsDbkjqZdjsvbf/GF/G4dgsElWYBhW5ZxuJ9FkWrt7qBQ4dhCBK+6 cQSdTxJOUmOK6+ChgM/Ki4/aOHWkTvzavMMHDnprvQx98virdT675XS+9 ZIy4POHt62o6UMLyBJA887KhAI7kcLSDRzUg8ePZHYMJecfd0UH1lhAeM tMp61pI/vs9TU6lClnwIp5WRFjO1OqKHF55PM5NkIbq3jf+2pasRoLqnS HXULv9Y8Ob+qrx8ByA9/XqNWXvkXrhkWzFgsHp3sohU1fRdVdRYweCE9P pJi58pdlXtMsCvezvTH4cD5Fet+7aOj0mMTlgvXCxtobxCyldpLHYRpn7 Q==; X-IronPort-AV: E=Sophos;i="5.93,260,1654531200"; d="scan'208";a="209519723" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 24 Aug 2022 16:49:39 +0800 IronPort-SDR: drxNh1roBn2G8A1uWN01lovhR8+lg9S/GZU2I81FLMvEVzaCY/onbfM1clSmQhgzNUh6+AOpw9 cZjZNeLzh5JRg0Dq8TDFkrMz7q9VsaqRSAACMfAIgJwLFrMFii9ehrbIucGXonIvq3Ctecl52k RkzNv/3M3QHW0YrFwxu3ialUEtWHNP21xizjH1oqBLIJeiKhoxlv51gEvaTLtTwNRzvyFIlB9x oZLZ2uUOGdtXXP52/1ESKIa4Oo1hi37+9XWEd8e2mS3UJanJgn7fI3xdpBg5rxTjV+UOPSj3ni jo92Lf4lw5iHTBlymkE3+9TC Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 24 Aug 2022 01:04:55 -0700 IronPort-SDR: aYy2ngGZRuaX5ZfUaVy9yvWD6gCrfGdmzX0SPZuoL8pJkiUMnuvy4EgHMN6Lc9MNN3IxeS834n mYPhxj5L67mTOCYOzq1s7Ll23K91bcy67c1imwcelZ79fzjufyor3NguFArPAV3FCH8hQBwXf7 qUC6KnkHFJMI0KYBl9BFQk+0zZbTuZ7NrgSjbSjKhKTWu3risa3NNgyfeWdY9eE9oks5ZGMRZ9 xIb1xOLPu3SS2eDJE4ByQc/JM85yGuU1kl9C0P7RAn/+jvvvQc6OPIsXNFrVN3DgHRIxkRUSph pYQ= WDCIronportException: Internal Received: from bsq92j3.ad.shared (HELO naota-xeon.wdc.com) ([10.225.50.4]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Aug 2022 01:49:38 -0700 From: Naohiro Aota To: linux-mm@kvack.org, akpm@linux-foundation.org, x86@kernel.org Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Naohiro Aota , Anshuman Khandual Subject: [PATCH] x86/mm: disable instrumentations of mm/pgprot.c Date: Wed, 24 Aug 2022 17:47:26 +0900 Message-Id: <20220824084726.2174758-1-naohiro.aota@wdc.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none ("invalid DKIM record") header.d=wdc.com header.s=dkim.wdc.com header.b=Dv3dsDbk; spf=pass (imf20.hostedemail.com: domain of "prvs=228449805=naohiro.aota@wdc.com" designates 216.71.153.144 as permitted sender) smtp.mailfrom="prvs=228449805=naohiro.aota@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661330982; a=rsa-sha256; cv=none; b=1e1cFpn4UUdBYe2W5oY43uaban0/X+mrOBiq888fkQUvsUK/LYi/eAnmflVF89rS87DHa2 YSp38RFGf/cQ7nPDylVSjrTlfdSooL2PyEHa0yJuMBAPKIpXv4O0tLQZb3G79Ngi7V2M7X PIv+/EESAci32mrF8hbnuWRkNOVPDb0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661330982; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=ndScdZ7QN4uXS3P6wcYE4DN5/eR76+dnA3Wca3ILbLk=; b=Z98oFUMR+LbccdRr7FLWAyoGP8A7Oko7YPVE91hrw/ZPaNY99fC6FiedVxfkk5S16x9GSz 3qXjV9WyWutEIGLWVs2x3kIUCAFBVZIMu51LKCA4MT+ZHH+M5wAQgTSXl0FjI6vkv1b5AF KNkDc8ii834msjrOpsjTi3q35CoyzdA= X-Stat-Signature: j71546bie7yf9q3ic9ddg4uf83w35cbk X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 733B21C0009 Authentication-Results: imf20.hostedemail.com; dkim=none ("invalid DKIM record") header.d=wdc.com header.s=dkim.wdc.com header.b=Dv3dsDbk; spf=pass (imf20.hostedemail.com: domain of "prvs=228449805=naohiro.aota@wdc.com" designates 216.71.153.144 as permitted sender) smtp.mailfrom="prvs=228449805=naohiro.aota@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com X-HE-Tag: 1661330981-566719 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: The commit 4867fbbdd6b3 ("x86/mm: move protection_map[] inside the platform") moved accesses to protection_map[] from mem_encrypt_amd.c to pgprot.c. As a result, the accesses are now targets of KASAN (and other instrumentations), leading to the crash during the boot process. Disable the instrumentations for pgprot.c like commit 67bb8e999e0a ("x86/mm: Disable various instrumentations of mm/mem_encrypt.c and mm/tlb.c"). Before this patch, my AMD machine cannot boot since v6.0-rc1 with KASAN enabled, without anything printed. After the change, it successfully boots up. Cc: Anshuman Khandual Signed-off-by: Naohiro Aota --- arch/x86/mm/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile index f8220fd2c169..829c1409ffbd 100644 --- a/arch/x86/mm/Makefile +++ b/arch/x86/mm/Makefile @@ -4,10 +4,12 @@ KCOV_INSTRUMENT_tlb.o := n KCOV_INSTRUMENT_mem_encrypt.o := n KCOV_INSTRUMENT_mem_encrypt_amd.o := n KCOV_INSTRUMENT_mem_encrypt_identity.o := n +KCOV_INSTRUMENT_pgprot.o := n KASAN_SANITIZE_mem_encrypt.o := n KASAN_SANITIZE_mem_encrypt_amd.o := n KASAN_SANITIZE_mem_encrypt_identity.o := n +KASAN_SANITIZE_pgprot.o := n # Disable KCSAN entirely, because otherwise we get warnings that some functions # reference __initdata sections. @@ -17,6 +19,7 @@ ifdef CONFIG_FUNCTION_TRACER CFLAGS_REMOVE_mem_encrypt.o = -pg CFLAGS_REMOVE_mem_encrypt_amd.o = -pg CFLAGS_REMOVE_mem_encrypt_identity.o = -pg +CFLAGS_REMOVE_pgprot.o = -pg endif obj-y := init.o init_$(BITS).o fault.o ioremap.o extable.o mmap.o \