Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp989037iob; Fri, 13 May 2022 18:45:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpAV2jpv5gjE+WgYFP1fDUZE7pX+vMO5Y5OzvpptGX/y6jwMxrBrZBqPRlRurwKpTI+f4x X-Received: by 2002:a05:600c:4f4d:b0:394:6ead:3523 with SMTP id m13-20020a05600c4f4d00b003946ead3523mr6822295wmq.109.1652492758056; Fri, 13 May 2022 18:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652492758; cv=none; d=google.com; s=arc-20160816; b=lBnHVxA4s9u9cW5Kzw9mV0dFDcolmw/IazqrnAlEmXsHKf2ZixL/L2sZVMDKuRu6L3 P56WESRU1rUjvH5mENWL+mrlwgoCGVaHgFohqMA/AZkAX57x2alfRL3DAwMWJxtVi2QE K7NuEGwer/QZ5OOKqs2rVq08ckc+vdb6rAqyTxSQjnu4QnR3az2jePz/tm0/DnVw7yEs pw4ZfT/vi+v7nYj66nfE/TXVw4rc2k8k00ja4qNBj9g8AkIZlu/A/7Q547RXKJJtbnZx 5vCzULOxPKpnD/urkCw3oOMnhPv3OZwTwz2UZPvEGh3NLEfcurKEXgKNqVXapUk0guYY irfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=mPYVRQJ3KtRd/5hxYP29jNpNRSc6Jp59FqIYzhOqd1M=; b=NAF7zu8IKCfaohtSIyHzxUHzN1XixCcCmX3CPN7PBNfMdCFijP6rhpA4YiCjsGoYee 2dd5PP8jApwL+wwf7er1nV52aJaUTNXb3pSclgWauWrE8z5wUI6qUkYZY9l75XTSwMBJ QNG8z2Hta/rcNcqkyzBTUZ/AuAUmT/i8zoZeKXyPhImPnYfgo6WQE5m1PYJ959D6g8U8 CcXoO0Yx4e7Mr1wKn5I1DFdbGlhYj1JYbGDVS3ARHAbV3WAgiJNtW9iaHVJlHIK6qXRg NUqmLof57uJo5ZhOuntaKwBu3hpcAJzNNb2bwoE6ji4i+yndV8MstbHM5DD7Vspn/lfO rpUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=K4s3gtmi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id ba16-20020a0560001c1000b0020a96536c26si3694038wrb.80.2022.05.13.18.45.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 18:45:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=K4s3gtmi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2A501437041; Fri, 13 May 2022 17:10:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376896AbiEMDvT (ORCPT + 99 others); Thu, 12 May 2022 23:51:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376766AbiEMDuy (ORCPT ); Thu, 12 May 2022 23:50:54 -0400 Received: from mail-oo1-xc34.google.com (mail-oo1-xc34.google.com [IPv6:2607:f8b0:4864:20::c34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CB2B5F7B for ; Thu, 12 May 2022 20:50:49 -0700 (PDT) Received: by mail-oo1-xc34.google.com with SMTP id v33-20020a4a9764000000b0035f814bb06eso2499391ooi.11 for ; Thu, 12 May 2022 20:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=mPYVRQJ3KtRd/5hxYP29jNpNRSc6Jp59FqIYzhOqd1M=; b=K4s3gtmiKAy6Wr3Hi7/dyuWMLJQ68rvmjcX+TiIHR5UrAl0xw99fjetBgRnTod5Ggv +o1WIV2fdnYlnTPmvG7x3GB3WtU0V3a2jul/mAwsYZNK4XligHFDze3EzOEdk9z+pG5y XzNVkL1ojJb1ROdHxH73QjcV6N7ZT3A30nRRPlPsNRvHEfCL/mu5eJCryNvLRsFA8APp 6UUVtz/7Xy/zoYJSasRJAZCVkQfk0t+i+SmnURivBrQ5MSUUlKBa2pYaNp186yuCFBM5 vrJozt6+Ks2AvyJV2Mfap3sW3o21n0DMIp11+GoWZ5Vb64TDgahD1DzeewknvUHxyIm+ v8VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=mPYVRQJ3KtRd/5hxYP29jNpNRSc6Jp59FqIYzhOqd1M=; b=0MMYB7Oi2TY0pXU6o39tl20xdw3vfXQZi35MN6IHbt+Vg+qW6wITbRkoCqIijaisOD 4ixMrGwRDYAI3tC/9nExZO1/BlE156d8/YwvE2ErnCCDBTA5vzKc+S31L88WOshsglTI PUp49N8HSL+cs3+HwcaG7IF6LFwK27GRHerZ6yUMQknf8INopBLCFtrl9Jbmm4skSdn6 nw0lw5xCYuNo6IXkOSi7J2huFWw4SVIJs4gTeuth2zCWVEFIMJS8j5NCqa/CLDOhBlPA LPuwUTeZKlmSER3TQb/z8s/LneQvxJzx2Z8odKibuSNsWs/+91BHTZwD62Gr6Ft8HHxg Omew== X-Gm-Message-State: AOAM5316Rut5c2cOlgAcei4HFCGl1cCX+F+zofkehNvJM46+Rn9PMhbH Ym1qpAFklIT2IsVQwF7M8QdSLbAio4kG0fdeqN+AjA== X-Received: by 2002:a4a:d40d:0:b0:33a:33be:9c1e with SMTP id n13-20020a4ad40d000000b0033a33be9c1emr1198631oos.96.1652413847699; Thu, 12 May 2022 20:50:47 -0700 (PDT) MIME-Version: 1.0 References: <20220512184514.15742-1-jon@nutanix.com> <07BEC8B1-469C-4E36-AE92-90BFDF93B2C4@nutanix.com> In-Reply-To: From: Jim Mattson Date: Thu, 12 May 2022 20:50:36 -0700 Message-ID: Subject: Re: [PATCH v4] x86/speculation, KVM: remove IBPB on vCPU load To: Jon Kohler Cc: Sean Christopherson , Jonathan Corbet , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , X86 ML , "H. Peter Anvin" , Kees Cook , Andrea Arcangeli , Josh Poimboeuf , Kim Phillips , Lukas Bulwahn , Peter Zijlstra , Ashok Raj , KarimAllah Ahmed , David Woodhouse , "linux-doc@vger.kernel.org" , LKML , "kvm @ vger . kernel . org" , Waiman Long Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 Thu, May 12, 2022 at 8:19 PM Jon Kohler wrote: > > > > > On May 12, 2022, at 11:06 PM, Jim Mattson wrote: > > > > On Thu, May 12, 2022 at 5:50 PM Jon Kohler wrote: > > > >> You mentioned if someone was concerned about performance, are you > >> saying they also critically care about performance, such that they are > >> willing to *not* use IBPB at all, and instead just use taskset and hop= e > >> nothing ever gets scheduled on there, and then hope that the hyperviso= r > >> does the job for them? > > > > I am saying that IBPB is not the only viable mitigation for > > cross-process indirect branch steering. Proper scheduling can also > > solve the problem, without the overhead of IBPB. Say that you have two > > security domains: trusted and untrusted. If you have a two-socket > > system, and you always run trusted workloads on socket#0 and untrusted > > workloads on socket#1, IBPB is completely superfluous. However, if the > > hypervisor chooses to schedule a vCPU thread from virtual socket#0 > > after a vCPU thread from virtual socket#1 on the same logical > > processor, then it *must* execute an IBPB between those two vCPU > > threads. Otherwise, it has introduced a non-architectural > > vulnerability that the guest can't possibly be aware of. > > > > If you can't trust your OS to schedule tasks where you tell it to > > schedule them, can you really trust it to provide you with any kind of > > inter-process security? > > Fair enough, so going forward: > Should this be mandatory in all cases? How this whole effort came > was that a user could configure their KVM host with conditional > IBPB, but this particular mitigation is now always on no matter what. > > In our previous patch review threads, Sean and I mostly settled on making > this particular avenue active only when a user configures always_ibpb, su= ch > that for cases like the one you describe (and others like it that come up= in > the future) can be covered easily, but for cond_ibpb, we can document > that it doesn=E2=80=99t cover this case. > > Would that be acceptable here? That would make me unhappy. We use cond_ibpb, and I don't want to switch to always_ibpb, yet I do want this barrier. > > > >> Would this be the expectation of just KVM? Or all hypervisors on the > >> market? > > > > Any hypervisor that doesn't do this is broken, but that won't keep it > > off the market. :-) > > Very true :) >