Received: by 10.223.176.5 with SMTP id f5csp1732556wra; Thu, 8 Feb 2018 02:32:45 -0800 (PST) X-Google-Smtp-Source: AH8x224QezzciOIZatmm2ki6OnwgLeGE2iv/PlI5u/JgS6LERn60y73iJc4RhRqRrbyV7VKR49xG X-Received: by 10.101.98.85 with SMTP id q21mr162352pgv.298.1518085965057; Thu, 08 Feb 2018 02:32:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518085965; cv=none; d=google.com; s=arc-20160816; b=Uu4uLe1YFWjPfIrnQVFy6hd70yjZ+rXUnCYala67tWeUtmZCSUuPdwPmsqXJ2IK59x 89zWm3gYbhRnuy6IZfFgrr6X1rD4B5QOaaOf4dWwEfPTcfAJ1c/hEfMIectSMXfSLrgQ lX5sDIpYQOztXwJIxSAKJOMRIYg11W5LV3HD/HQUDBGfrgV063mmQfR4PhKZefmDg646 SS4wWyMB32NYp/Ngx0y7IVGYabEW3IAR/pZMephqpPObE4nF264QVJ/Nzv5NzjWSm/7n YaIDN2JoB7WE9/6JXWY6hNgJmDjdI4oeLvuwx69VLAscuKHHvks/Wx8rsi7aJLDCpQoF 2Q2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=Kg0Xo8qUebpFoYNEJwYUBY7i+VCkKHh9a7nP/oLs4QU=; b=H1EWD5/ak8IdGIp1eYMe0sbq1QpQM8ha+JiM1V6vN0zyPiwiIuxpOmLICvbB+Y2Zmm b7k0u9QvqKoRSDZOLxOoIudUvaCAp6IO9uFKn6nfeQcc5WAI1ODX38v6UyAIX/u2rTff +iFQCsD4EU9C7mBADQF5vYPvW2k8QdquZ4+MPnH7Li0DkhN3G2OPU5CCAvXYd/vgiV6x ocA7TihYfUBNxFuwmBnkY+xOHGO9hEuUR+LLF8s7rRPhZmXNb2LIAFI1zt99/6j1V/F1 1jeqmdo222Mzp87gA4VnfFuLxn8ZTnOb6rnmr2knRG4LvV2+X1oeL6VyyyujRtSfvvYk Y4YA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j19-v6si1081091pll.799.2018.02.08.02.32.31; Thu, 08 Feb 2018 02:32:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751995AbeBHKbX (ORCPT + 99 others); Thu, 8 Feb 2018 05:31:23 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57560 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750806AbeBHKbW (ORCPT ); Thu, 8 Feb 2018 05:31:22 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9B95E87AD2; Thu, 8 Feb 2018 10:31:21 +0000 (UTC) Received: from [10.36.116.177] (ovpn-116-177.ams2.redhat.com [10.36.116.177]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E8626B07A5; Thu, 8 Feb 2018 10:31:18 +0000 (UTC) Subject: Re: [PATCH] KVM: X86: Fix SMRAM accessing even if VM is shutdown To: Xiao Guangrong , Wanpeng Li , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Dmitry Vyukov References: <1517984706-47244-1-git-send-email-wanpengli@tencent.com> <233cfca3-971e-c3c2-f0fe-b50dd69d2546@redhat.com> From: Paolo Bonzini Message-ID: <5664ca7f-f391-0301-3a0d-666b73f17b15@redhat.com> Date: Thu, 8 Feb 2018 11:31:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Feb 2018 10:31:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Feb 2018 10:31:21 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pbonzini@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/02/2018 09:57, Xiao Guangrong wrote: >> Maybe it should return RET_PF_EMULATE, which would cause an emulation >> failure and then an exit with KVM_EXIT_INTERNAL_ERROR. > > So the root cause is that a running vCPU accessing the memory whose memslot > is being updated (met the condition KVM_MEMSLOT_INVALID is set on the its > memslot). > > The normal #PF handler breaks KVM_RUN and returns -EFAULT to userspace, > we'd better to make ept-misconfig's handler follow this style as well. Why return -EFAULT and not attempt emulation (which will fail)? Paolo