From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD784C433F5 for ; Thu, 30 Sep 2021 18:00:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 86CAF619F7 for ; Thu, 30 Sep 2021 18:00:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 86CAF619F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 18E089400C2; Thu, 30 Sep 2021 14:00:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1184694003A; Thu, 30 Sep 2021 14:00:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED33A9400C2; Thu, 30 Sep 2021 13:59:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0238.hostedemail.com [216.40.44.238]) by kanga.kvack.org (Postfix) with ESMTP id DAFCD94003A for ; Thu, 30 Sep 2021 13:59:59 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9C71E1837DFE4 for ; Thu, 30 Sep 2021 17:59:59 +0000 (UTC) X-FDA: 78645003318.22.91C76E4 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf23.hostedemail.com (Postfix) with ESMTP id 4D99E90003BA for ; Thu, 30 Sep 2021 17:59:59 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 5B559619F6; Thu, 30 Sep 2021 17:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633024798; bh=XqDuBOd5I+ZLfLeu4Zc8sAqKLHJkcyPDVnlaZ94W4Bw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DQe0F7QUVdz2wES6cxy6eiIAFN9CWXMQztKUAENKkZ+QfqIj9vebhKMI62Iwg3TIf b7FZ68MX07LelJYt67SneH0Am6SJfghn1tQwqKBxp+QgLiXtLxaE6BdSXamRRlzUfl 4jt5M6vDeJCK9B4npitCqTOGfaFWfc3yWz2HX3IMDsXtqBuEYNGXHBsa9FCaZhvJJz UuuOSgbZChp0i2LFbIqhIZCzJkchGeboWS5qrIH0ndD8BgKJAXZ4ay7Gqt2KaESnBY 0AXRZURRsq5e2JMU7LLp+Je/Ohm5yKxFt6+4uiyiEu98LfrTae3Hha7EEI6TFmNwji GcIzSrQcIk4Dg== Date: Thu, 30 Sep 2021 10:59:57 -0700 From: "Darrick J. Wong" To: Sean Christopherson Cc: Stephen , kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: kvm crash in 5.14.1? Message-ID: <20210930175957.GA10573@magnolia> References: <2b5ca6d3-fa7b-5e2f-c353-f07dcff993c1@gmail.com> <16c7a433-6e58-4213-bc00-5f6196fe22f5@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DQe0F7QU; spf=pass (imf23.hostedemail.com: domain of djwong@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=djwong@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4D99E90003BA X-Stat-Signature: 39egpsbd5q1hfhnysnu5cysh1sztmzh3 X-HE-Tag: 1633024799-745322 Content-Transfer-Encoding: quoted-printable 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: On Wed, Sep 29, 2021 at 03:21:09PM +0000, Sean Christopherson wrote: > On Tue, Sep 28, 2021, Stephen wrote: > > Hello, > >=20 > > I got this crash again on 5.14.7 in the early morning of the 27th. > > Things hung up shortly after I'd gone to bed. Uptime was 1 day 9 hour= s 9 > > minutes. >=20 > ... >=20 > > BUG: kernel NULL pointer dereference, address: 0000000000000068 > > #PF: supervisor read access in kernel mode > > #PF: error_code(0x0000) - not-present page > > PGD 0 P4D 0 > > Oops: 0000 [#1] SMP NOPTI > > CPU: 21 PID: 8494 Comm: CPU 7/KVM Tainted: G=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 E=A0=A0=A0=A0 5.14.7 #32 > > Hardware name: Gigabyte Technology Co., Ltd. X570 AORUS ELITE WIFI/X5= 70 > > AORUS ELITE WIFI, BIOS F35 07/08/2021 > > RIP: 0010:internal_get_user_pages_fast+0x738/0xda0 > > Code: 84 24 a0 00 00 00 65 48 2b 04 25 28 00 00 00 0f 85 54 06 00 00 = 48 > > 81 c4 a8 00 00 00 44 89 e0 5b 5d 41 5c 41 5d 41 5e 41 5f c3 <48> 81 7= 8 > > 68 a0 a3 > >=20 > I haven't reproduced the crash, but the code signature (CMP against an = absolute > address) is quite distinct, and is consistent across all three crashes.= I'm pretty > sure the issue is that page_is_secretmem() doesn't check for a null pag= e->mapping, > e.g. if the page is truncated, which IIUC can happen in parallel since = gup() doesn't > hold the lock. >=20 > I think this should fix the problems? >=20 > diff --git a/include/linux/secretmem.h b/include/linux/secretmem.h > index 21c3771e6a56..988528b5da43 100644 > --- a/include/linux/secretmem.h > +++ b/include/linux/secretmem.h > @@ -23,7 +23,7 @@ static inline bool page_is_secretmem(struct page *pag= e) > mapping =3D (struct address_space *) > ((unsigned long)page->mapping & ~PAGE_MAPPING_FLAGS); >=20 > - if (mapping !=3D page->mapping) > + if (!mapping || mapping !=3D page->mapping) I'll roll this out on my vm host and try to re-run the mass fuzztest overnight, though IT claims they're going to kill power to the whole datacenter until Monday(!)... --D > return false; >=20 > return mapping->a_ops =3D=3D &secretmem_aops;