Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp524304pxb; Thu, 30 Sep 2021 11:01:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvyVzX1k3p4crzYWwJNbck9AZZ1R6klEOAfFw2qbYUp7Jl35ZHo693vEr6Qt8LsmpCyCO0 X-Received: by 2002:a62:6d86:0:b0:448:152d:83a4 with SMTP id i128-20020a626d86000000b00448152d83a4mr5669393pfc.38.1633024874945; Thu, 30 Sep 2021 11:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633024874; cv=none; d=google.com; s=arc-20160816; b=pHQQBUvFK6YDAa8nSfqwguOPf365YNup6jgm46MTlZQB51HO+MbS/Nq6j0C/+lFUBQ 56v59SLTK8SLLj5LH5ehwpbfdwdtR4VK+La+VG7r9VhTMiA3e0z0ksakmVGxYyvyyosz ACfoqdBtD+Pu/JJHL6DikbhSicHcj/zylcAzOS8J9mcg4euz13Xg4uMiXv1mkG1AeDov lheOnV1LdpsczBL3eetvH0kYW5XN4RIHOEmRZmGYS5Ym7aNejfiHUuezxSvkJZmYxr8t tZish3wa1ipYwdNj+orPzmFVBB0olRlVKo8Qzq581b1sO+FxV48ZLvz5TgFy4oJefrOG P0lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=nZc3mIyPcNGrBTZOAlXwgg1BCrD02mbGuwW1QVV0luc=; b=Wl9OJsRykA7Lc2WTGT7fEeMpSeK1OCXbygpe9csNTaYRRmPYL+cjqJSfVAltT6pMTs bw2WPhLt1403KN0xlxZzETWkaDa149jJp00x40p9Lunj0o48igca/MDw0IgAiRnKASIR tX/XSfrGQhaA8HF5TWWEv8FzbRghGicz0pOHZ9EAOdmchP7JeGM16Ql1qqO1Ce4mcBQY byO2sJjRVa61ThBLdLXn2vYdTMOtP1oS7NIS35LEOYIscNxgubXeUCsz9H+mJVV53BqW uzYIKMFEvs0bES3Dnq8+HP5+viu8sjFqtBCZVBRF1wKpgksug5nsVdCrUKXg/noEyvEr p47g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DQe0F7QU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u3si4746283plq.96.2021.09.30.11.01.01; Thu, 30 Sep 2021 11:01:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DQe0F7QU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352942AbhI3SBm (ORCPT + 99 others); Thu, 30 Sep 2021 14:01:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:50336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352908AbhI3SBl (ORCPT ); Thu, 30 Sep 2021 14:01:41 -0400 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 Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 29, 2021 at 03:21:09PM +0000, Sean Christopherson wrote: > On Tue, Sep 28, 2021, Stephen wrote: > > Hello, > > > > 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 hours 9 > > minutes. > > ... > > > 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??????????? E???? 5.14.7 #32 > > Hardware name: Gigabyte Technology Co., Ltd. X570 AORUS ELITE WIFI/X570 > > 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 78 > > 68 a0 a3 > > > 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 page->mapping, > e.g. if the page is truncated, which IIUC can happen in parallel since gup() doesn't > hold the lock. > > I think this should fix the problems? > > 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 *page) > mapping = (struct address_space *) > ((unsigned long)page->mapping & ~PAGE_MAPPING_FLAGS); > > - if (mapping != page->mapping) > + if (!mapping || mapping != 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; > > return mapping->a_ops == &secretmem_aops;