Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3840115pxb; Fri, 11 Feb 2022 08:53:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTEY/V9q7RDh8mDvK7sZXQOsQdR39Y5JS6NtVLp8eO/H9xRFfQwl+2V+7WglNirOjRpJm0 X-Received: by 2002:a05:6a00:1681:: with SMTP id k1mr2607058pfc.48.1644598385035; Fri, 11 Feb 2022 08:53:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644598385; cv=none; d=google.com; s=arc-20160816; b=MtTh7u2ZMaLTG80G4r5x9nOQ9Ki9bP12IiNb2LrhBi9LlFog9tf66nNTmMWbZfCTiM RecU76yNqNtu6Iibj/b3N1s+LRqbd08iVQoIzGmYuCLyOE1jJdJAY0bZ6oLyAf3K+QXM a1BEOFAFt9X42EolJIcImbR13Ucq+1QgUtUT3tMRtY4XwSA3Fpok+DvwDGLUYmk8ALyn 890oTOUcGZ9mAQUbS721/vWnGOe7jJhwa4E6Lal3LTy+vov3aiEtTL7YNL70YE77j/o1 s03VLcJpr0k7ZtfI8aQXMDCU0aWO/a+crOT0QQNHmZYoRX2VZZdbMkp78ol/LRhX4Nv7 w1iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=mcgICshyxTEM99QbGCGkkiKtT/0wC3VZNERlXjvTdTI=; b=S3JQKzM4Ggm8sVRLyk0iTjgbwmgfFyJlFgGUMVQn93gFPjXfnGqRJgR6bSAVxcnZVH eP7TM/zNPfpYp2HfqGNAX3haAAGf3gfDxq4KZ/TPIawmsqJ4LVcaoDim8Kshyjqg2jVC K2T/kHd2ec+Lfihqgbo8K5dOigKSbcBKf9tc9z+iMiXAx1NhvsVfKhOVMpLwQHxJwKib GX6MRPhiCrRyoUQZkw8grfqFg1B200IQ2Pm1mLUGsX+UOED/U6/hHDcseqKJWpsCKtgf GMixob/qbcwBosvBs1naRsuEeqemy8UbIgT5vfOlfNR48JXIcHcFCNF8D7raGGcB7xil PBXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dbGkudwM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i9si5612472plg.270.2022.02.11.08.52.50; Fri, 11 Feb 2022 08:53:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dbGkudwM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233695AbiBKLVY (ORCPT + 99 others); Fri, 11 Feb 2022 06:21:24 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233545AbiBKLVX (ORCPT ); Fri, 11 Feb 2022 06:21:23 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E0A3AE75 for ; Fri, 11 Feb 2022 03:21:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644578482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mcgICshyxTEM99QbGCGkkiKtT/0wC3VZNERlXjvTdTI=; b=dbGkudwMu3ciaABen/jsVHNkX2dnsZFcO+f0nHlAphfxsjNQkSzvMtL4W2oWrc5e6d+UEF z+VYGDEuk0gVJXmNnV+SyUwgdFT/BItWqEYVwo/1zzZwTFzTHlG2juUtxEFBQmVlTHnTgJ D6VKbrBdJ7V+Lt7JSrx3GO/jkC0fPyg= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-120-iqpbbm1rP6-yQkhOMXrJdA-1; Fri, 11 Feb 2022 06:21:20 -0500 X-MC-Unique: iqpbbm1rP6-yQkhOMXrJdA-1 Received: by mail-ej1-f72.google.com with SMTP id ho37-20020a1709070ea500b006cd51be5cd8so3965993ejc.6 for ; Fri, 11 Feb 2022 03:21:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=mcgICshyxTEM99QbGCGkkiKtT/0wC3VZNERlXjvTdTI=; b=uOmx/W7r/3Udy0t6kQFDFgsuVBtFLNXnx9lF4IshdJRZCtMrCd2Ukx85eS7o2YcvmV uN96dIyoU94oA9NNYaSoYe5UY8M+zBKCQ+vsOqmwaI5T8PiU4iVE1NRp80zdvvHn+E45 nN0mbDNSIZsgU6ejJ2MNg5OEOfRbuTPR2lnWVKIkBcTPjHWgE2xP1Lt8lttELRJa2KDt oHxUA0o4OCOIbKPgwMrYFn/m74OzggE8D6onQvRCb2HDgnlp2A+agIAHbyVpJTpSfx0u MEfVS5ZgIOlQedQl05dzDSu07OV60VwoqQRmWXsmIDkAP4LJRLXB6tEWuH9pistQ+cnk Efaw== X-Gm-Message-State: AOAM532TlU7cNlLBKfnucIZlcYAJb39e/+aWb9fJOv++u4E4FTJUpEeI OZrjz1OggV7ADhIluspPjOemUx0dRTvioZaUFO22BSUC7exAZaRpxznalxzgh0rUMpmJQ5iMf0V sCfw9wUxmOhFUY+eObpYSnMO4 X-Received: by 2002:a05:6402:515a:: with SMTP id n26mr1316481edd.191.1644578479770; Fri, 11 Feb 2022 03:21:19 -0800 (PST) X-Received: by 2002:a05:6402:515a:: with SMTP id n26mr1316459edd.191.1644578479546; Fri, 11 Feb 2022 03:21:19 -0800 (PST) Received: from ?IPV6:2001:b07:6468:f312:63a7:c72e:ea0e:6045? ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.googlemail.com with ESMTPSA id qh12sm4389384ejb.172.2022.02.11.03.21.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Feb 2022 03:21:19 -0800 (PST) Message-ID: <18042cd3-c1fe-a54a-8682-2b5d1523c3d9@redhat.com> Date: Fri, 11 Feb 2022 12:21:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 05/12] KVM: MMU: avoid NULL-pointer dereference on page freeing bugs Content-Language: en-US To: Sean Christopherson Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, vkuznets@redhat.com, mlevitsk@redhat.com, dmatlack@google.com References: <20220209170020.1775368-1-pbonzini@redhat.com> <20220209170020.1775368-6-pbonzini@redhat.com> From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/11/22 01:24, Sean Christopherson wrote: >> >> sp = to_shadow_page(*root_hpa & PT64_BASE_ADDR_MASK); >> + if (WARN_ON(!sp)) > > Should this be KVM_BUG_ON()? I.e. when you triggered these, would continuing on > potentially corrupt guest data, or was it truly benign-ish? It only triggered on the mode_switch SVM unit test (with npt=0); so, in a very small test which just hung after the bug. The WARN however was the 10-minute difference between rmmod and reboot... I didn't use KVM_BUG_ON because we're in a pretty deep call stack (kvm_mmu_new_pgd, itself called from nested vmentry) and all sort of stuff will happen before bailing out. My mental model is to use KVM_BUG_ON in situations for which error propagation is possible and clean. Paolo