Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1075120pxa; Sat, 22 Aug 2020 10:06:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4GvzdqUluezs3rTU2willRhxXJbtKeg0tEZQXyuopg/dt5/x72rFDVk8DEsDbDfaW8NPD X-Received: by 2002:a50:a165:: with SMTP id 92mr8187294edj.320.1598116009352; Sat, 22 Aug 2020 10:06:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598116009; cv=none; d=google.com; s=arc-20160816; b=elo7f6c2c/r7P7OlEJG28BPBIMy63WA+GuMiQWlSIZaLiPgtMfqafPq/u3JGznc4nW cc8RuLEL7u1dRpaR/3SdOrO8sOLSRsp+kY3tA8UxB931MMUnZ0epq5Gef3XoveivbX3g CGW+Qyd2ui3/rBI4AgtQuXVqMN1bcLPGT+TvV3fcQasVPUZ5R1OuO2Xv3FcVodWmzaxh Txd1EKm0H1SwwHjhbzrN3Iq+FE/WWFwZDkEvxcH+g4kwqrwE+sH/6Zl9d9qXqgRn/OmR 1dzYibAJ49/raMddeU6cJCieYXTsQya2Wv4jkuBqBUjg1nuFHSxxSoWD1FodQGkqrUlx CJcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=mYMOB7HX1rTD/7IL0tDVLZi1tkzDryfVr8QJuZX4E/Y=; b=UsIUo+7k9YSTcdQLSwlHuoV3ljIRRmUpbBxCz9pjjsJK1lvX2paZ2zcSN4guME/meW HbDB3kGyWu6t5WTozDw9oGekRKGhuQyBaMAP16wwwutJCpgEoY7ptHjH1uChHaOqL4VB GM2AZHsvIHYtAeA3swcYj51lCI9njYncWa/uDPT/Xy9Vw5Ue1Sk2yhCGYvKUsuSndbFk xW/cqUzfg4IidsQwUcXAiDek1gHzjSLrRibm20k8SnbkxgP6GjaDPQ5Vq3FcIYP7zkUJ LsHXtDAmmJpI5PaF4mjJd8x3x3hskXWpDQQH4hkTe5zPL6WB8sDJkE/9cmDZC7WJdRWE 14ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1U5piPjS; 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 dp16si5637308ejc.687.2020.08.22.10.06.26; Sat, 22 Aug 2020 10:06:49 -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=default header.b=1U5piPjS; 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 S1728501AbgHVQmc (ORCPT + 99 others); Sat, 22 Aug 2020 12:42:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:49828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727856AbgHVQmb (ORCPT ); Sat, 22 Aug 2020 12:42:31 -0400 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2508C214F1 for ; Sat, 22 Aug 2020 16:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598114551; bh=4mV79t1nyNS6DI3ftmSBBylHHzDQoo7iQ88XRvUd9G0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=1U5piPjSZhvq5FmJgwthshH6cvV/BZwqr7eGrOikfQkwqWjcJSAHZh/RVScvclL4t wnEr/ph6+73siXM638f8pASfEhZtwJqicj6DM1w2ZJINdSNkAo81irDEg0Mkt/VtuJ MCvI/IUgphKBCe9PB7JCmSaCNVDt2gSHKqNPct5E= Received: by mail-wm1-f54.google.com with SMTP id p14so4587033wmg.1 for ; Sat, 22 Aug 2020 09:42:31 -0700 (PDT) X-Gm-Message-State: AOAM532bdxPmwDnFebjrDGRG0G1AzQRgwzKAHl1SFxe6FknacHmEliDg YPdElK6vO4lSPbEPvlXEa0sgZlkkEiaGetf2h06Nkw== X-Received: by 2002:a1c:7e02:: with SMTP id z2mr8313834wmc.138.1598114549600; Sat, 22 Aug 2020 09:42:29 -0700 (PDT) MIME-Version: 1.0 References: <20200821025050.32573-1-sean.j.christopherson@intel.com> <20200821074743.GB12181@zn.tnic> <3eb94913-662d-5423-21b1-eaf75635142a@redhat.com> <20200821081633.GD12181@zn.tnic> <3b4ba9e9-dbf6-a094-0684-e68248050758@redhat.com> <20200821092237.GF12181@zn.tnic> <1442e559-dde4-70f6-85ac-58109cf81c16@redhat.com> <20200821094802.GG12181@zn.tnic> <81985f69-190d-eea6-f1ff-206a43b06851@redhat.com> In-Reply-To: <81985f69-190d-eea6-f1ff-206a43b06851@redhat.com> From: Andy Lutomirski Date: Sat, 22 Aug 2020 09:42:16 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] x86/entry/64: Disallow RDPID in paranoid entry if KVM is enabled To: Paolo Bonzini Cc: Borislav Petkov , Sean Christopherson , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , X86 ML , "H. Peter Anvin" , LKML , Dave Hansen , Chang Seok Bae , Peter Zijlstra , Sasha Levin , kvm list , Tom Lendacky Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 21, 2020 at 3:07 AM Paolo Bonzini wrote: > > On 21/08/20 11:48, Borislav Petkov wrote: > >> It's not like we grab MSRs every day. The user-return notifier restores > >> 6 MSRs (7 on very old processors). The last two that were added were > >> MSR_TSC_AUX itself in 2009 (!) and MSR_IA32_TSX_CTRL last year. > > What about "If it is a shared resource, there better be an agreement > > about sharing it." is not clear? > > > > It doesn't matter how many or which resources - there needs to be a > > contract for shared use so that shared use is possible. It is that > > simple. > > Sure, and I'll make sure to have that discussion the next time we add a > shared MSR in 2029. > > In the meanwhile: > > * for the syscall MSRs, patches to share them were reviewed by hpa and > peterz so I guess there's no problem. > > * for MSR_TSC_AUX, which is the one that is causing problems, everybody > seems to agree with just using LSL (in the lack specific numbers on > performance improvements from RDPID). > > * for MSR_IA32_TSX_CTRL.RTM_DISABLE, which is the only one that was > added in the last 10 years, I'm pretty sure there are no plans for using > the Trusty Sidechannel eXtension in the kernel. So that should be fine > too. (The CPUID_CLEAR bit of the MSR is not shared). > Regardless of how anyone feels about who owns what in arch/x86 vs arch/x86/kvm, the x86 architecture is a mess that comes from Intel and AMD, and we have to deal with it. On VMX, when a VM exits, the VM's value of MSR_TSC_AUX is live, and we can take an NMI, MCE, or abominable new #SX, #VE, #VC, etc on the next instruction boundary. And unless we use the atomic MSR switch mechanism, the result is that we're going through the entry path with guest-controlled MSRs. So I think we can chalk this one up to obnoxious hardware.