Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7F85C433E0 for ; Fri, 12 Mar 2021 13:35:07 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7ADD560190 for ; Fri, 12 Mar 2021 13:35:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7ADD560190 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.97125.184325 (Exim 4.92) (envelope-from ) id 1lKhwM-0003V1-Qy; Fri, 12 Mar 2021 13:34:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 97125.184325; Fri, 12 Mar 2021 13:34:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lKhwM-0003Uu-Ny; Fri, 12 Mar 2021 13:34:54 +0000 Received: by outflank-mailman (input) for mailman id 97125; Fri, 12 Mar 2021 13:34:54 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lKhwM-0003Up-BN for xen-devel@lists.xenproject.org; Fri, 12 Mar 2021 13:34:54 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 61a7c494-ef73-4297-9d95-5fadc8e905bb; Fri, 12 Mar 2021 13:34:52 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1DC5EB034; Fri, 12 Mar 2021 13:34:52 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 61a7c494-ef73-4297-9d95-5fadc8e905bb X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1615556092; h=from:from:reply-to: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=fsOOmVOBABtxanD9QlgqtucNM8425swHUVRB7f2ll4M=; b=Lw1TyaZNuh3VPuznwgAbCQVpxgnkMfd5H2eKAk4yxQztjLRjdnCEdoTG8lijkSjLQn/VPa K3cNziUl63LTlfNK+CO3Vkc7F/ODV/Xp9veWrEMmcbFjif69wpBNKfGGXIbMBgAAWQfH8E MctENzAm5GGt7cVxK04zrF2U5kg7SFM= Subject: Re: [PATCH v3 1/2][4.15] x86/PV: conditionally avoid raising #GP for early guest MSR reads To: Andrew Cooper Cc: Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Ian Jackson , "xen-devel@lists.xenproject.org" References: <7a84bc56-0045-2111-6888-8db830335ad1@suse.com> <90f87aa8-09da-1453-bd82-c722465c2881@suse.com> <7504b027-f106-33e1-214a-eecf8ea5ff5d@citrix.com> From: Jan Beulich Message-ID: Date: Fri, 12 Mar 2021 14:34:52 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <7504b027-f106-33e1-214a-eecf8ea5ff5d@citrix.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 12.03.2021 12:19, Andrew Cooper wrote: > On 12/03/2021 07:54, Jan Beulich wrote: >> Prior to 4.15 Linux, when running in PV mode, did not install a #GP >> handler early enough to cover for example the rdmsrl_safe() of >> MSR_K8_TSEG_ADDR in bsp_init_amd() (not to speak of the unguarded read >> of MSR_K7_HWCR later in the same function). The respective change >> (42b3a4cb5609 "x86/xen: Support early interrupts in xen pv guests") was >> backported to 4.14, but no further - presumably since it wasn't really >> easy because of other dependencies. >> >> Therefore, to prevent our change in the handling of guest MSR accesses >> to render PV Linux 4.13 and older unusable on at least AMD systems, make >> the raising of #GP on this paths conditional upon the guest having >> installed a handler, provided of course the MSR can be read in the first >> place (we would have raised #GP in that case even before). Producing >> zero for reads isn't necessarily correct and may trip code trying to >> detect presence of MSRs early, but since such detection logic won't work >> without a #GP handler anyway, this ought to be a fair workaround. >> >> Signed-off-by: Jan Beulich >> Release-Acked-by: Ian Jackson > > I am still of the firm belief that this is the wrong course of action. > > It is deliberately papering over error handling bugs which, in the > NetBSD case, literally created memory corruption scenarios.  (Yes - that > was a WRMSR not RDMSR, but the general point still stands, particularly > in light of your expectation to do the same to the WRMSR). > > It is one thing to not realise that we have a trainwreck here.  Its > totally another to take wilful action to keep current and all future > guests broken in the same way. > > The *only* case where it is acceptable to skip error handling is if the > VM admin has specifically signed their life away to say that they'll > accept the, now discovered, potential-memory-corrupion consequences. > > Rogers patch already does this. With _much_ bigger impact - it requires changing the behavior for the entire lifetime of the domain, rather than just very early boot. And as you may have seen, despite my fear that it may not be enough, Roger and I have agreed to leave the WRMSR path alone. Jan