Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp587366lqh; Tue, 7 May 2024 08:08:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVTs6zAqQJ0QRP+0a9BZLjreKPAt8kq2u6eVP9UwMrJZ6TuW/nKgrqpsQAKJCu9g1IkzrG5NCsmjVmRZ6g7UIm+VMsdoBteXZT7Pxyrlg== X-Google-Smtp-Source: AGHT+IFpmW8KCs1twMNfjmqYTEpRIpPoKhLaedBDflTdQTaqVB//2PmzsgumS/jexVZ/l0LAob+6 X-Received: by 2002:a17:906:eb57:b0:a59:a532:ed58 with SMTP id mc23-20020a170906eb5700b00a59a532ed58mr5919919ejb.28.1715094520695; Tue, 07 May 2024 08:08:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715094520; cv=pass; d=google.com; s=arc-20160816; b=aOi6QhQ5a2RZo35sSoQmurtKOcf7h/lDrYxZUhVmrflDhMFneFVFMEFDj68VcS0ryV bEuyfTS2Rq6aI6BO1cSDZ+CBkFC/AZUWGYBj346YZIUS9hdaTV1Gdg2WePzmzv0GI3Oy xBZgaTqcCTQjC0cQd+n/PSvy/b/BxJ4ecBhdfL4knZCb8j/jQxIZfw4U83AEa79EwX17 XkjqPJqv6lMjybSGtExFHNr+KLvA36L4MBNK2r/ka4/ZA0FzwFYVgj2aDR+Hr+7oUBQL DdSG85D7xECC3X1i2/8PE23pV5PPFGa0AxaeFxYJqacTzAqBNw4q5AqsbcF8+nNnGVK9 0XKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :in-reply-to:date:dkim-signature; bh=XIQy57nw8js2S4anIYd24L9R1IqwqfbqyoiYCyYOBxY=; fh=DiGKrAK++fXmkZUPeA/PYf8B+ST9twvGle0O8+tmYW0=; b=VPapEFBFi9GkVw8jBQmK4V5/ijYmtv4t3Ydw+n6WaUabe+r3owP4SeTZWcEShs2Oux tBP6nr148R+PNYFsy1DvaCuqN/4w9Q0bOPi+jRj82Ss2wDUCaSlgGxnQNamXpGbaugfo Yy8JVpF37yWBLUQ70ZH9QEO/4KtcLngTfS+7WhOLCOzqSEWJ5ib8FsQSxWki/TUM5cp9 MhcJuqLPnb+yO5V0NmNadjLm7Y7a/EMiVQZRugv/eXik5IyRa6qLq0o6shHYAelKR35V xhIAgbvsuni0kul5IQ1YdTyzP5PVNDEr0vXqliRRawTVcC01Fa85yeMHq4Kcpx9kTm4y jVbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rvvu9Tvd; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-171657-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171657-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kx16-20020a170907775000b00a599ca0c2c0si4886642ejc.324.2024.05.07.08.08.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 08:08:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171657-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rvvu9Tvd; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-171657-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171657-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 577421F23592 for ; Tue, 7 May 2024 15:08:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB227160862; Tue, 7 May 2024 15:08:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rvvu9Tvd" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1D7E15FA9F for ; Tue, 7 May 2024 15:08:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715094510; cv=none; b=uelSAAg8QzRhXEqKlkN/gQoeDX0LEIy5Eb+0kEm72QLeezzhdKuvZG9xN3hZwqZ90maGXt6O5LqBBH1WoMcf+UDnIe3GN1RaFUrgv2+vweahoDMtL0Ye3EYizF+CO5GRwMl01CfGKL0yFgKdrojkFEgtwrpaZSqP5U6kawh6bE0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715094510; c=relaxed/simple; bh=etFllyEupyaknEFf+lcPrCQd6nzzutaeEMKfMlLm/30=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=egbLLcCV8Hyg2WZrL4wRPaLpt/wPfqv77lHqniAym81+7c4tIVc61UOEqKnKjLAweSDo5lCItQmBJlXs7JSvW6hgkmIVEWSiFSBm+wrrgGlDnzwlg/mT8WNotYAJYO2iK+k8QVUo7v17l9/xfSOUsVa2FwGKF3bBbvv4EVy6vjA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rvvu9Tvd; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-de615257412so6463814276.0 for ; Tue, 07 May 2024 08:08:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715094508; x=1715699308; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=XIQy57nw8js2S4anIYd24L9R1IqwqfbqyoiYCyYOBxY=; b=rvvu9Tvd3egW8lGyezAGdrLE+g/wU/xLOQeoQKoncJiHbIx0X+UN2+TnnXPyY+kZub WDVLX4JHmVDndQT/+aXGwNQDdsHU9EUmFwxSeINpGCmQVQNROYzyzuiCcJSKaKHEfSSP KP/u6iTwYSapylbkufHpm8BhO+CnKYq6nEMX/Cio+cQt4dvR+stmMj94Y0VViywuX+tl N2jiQWyetwtLL8zZulJAt9lnV7ksFAN33kt5WfyS6wPfryLpKBnT56Ed2tEFaKU3PRPp bH7uPuZ9Tz3g8xOqLRbGFe1GTTMOWKXQb2ybDZLOAfKiVj3ZmPK+i31JhIZiutj4rfxX YsIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715094508; x=1715699308; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=XIQy57nw8js2S4anIYd24L9R1IqwqfbqyoiYCyYOBxY=; b=UBcIdm/Jsp72UWx18DxXPuXCQp4EJDbsRMHpMDDojwCabKmwXlLhMBTrVz5nXpyV8I K58z1EHfvfQVGFMz1tZOQjTiRs5MUKaAKsPI+dsBW7E3lJS1eAQrMCpd+/AEq9npLxVE QUSI/jFBhLg7VI0/V+5FZPyikcYZ1GHE9nA/akUma61hl5Aj5PU/AX/7FE09ebw3Zvny BylxwNvZWY0DdNjumzlLqFKI4SK4jH13EAomJ5ulAwg+K5T4V4s/wZcWj+fCGK85Rx5B vxnLjY3mFErZ8LOM3VJnSpfj2kQBdkxUMeaePzQCsDZIXlxbh0yy9VcIje9tmIsalaBp YgRg== X-Forwarded-Encrypted: i=1; AJvYcCV6i7+AF5d58TUFZxrenPIsCl1frVAQgl/6VTPexPiiKxfWyfeyHQ7LVgatn8w1tbvD0K27lYLH/S7HuOfiBeTqW3CculjHyeuhJJU8 X-Gm-Message-State: AOJu0Yw4HIZNgWmDgIokH/3DQ11DYObo11JMGaz3tyvrmkaV+/FkMGfG ArYvqeNPBGTcvJ3t/WVFthCsrr40D69o37C2uJ7UMkkF5BLZqQ4QQjAjX1XeL6vzidmu4GF4dP9 NwQ== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:1245:b0:deb:8bc5:eb5b with SMTP id t5-20020a056902124500b00deb8bc5eb5bmr1772807ybu.5.1715094507868; Tue, 07 May 2024 08:08:27 -0700 (PDT) Date: Tue, 7 May 2024 08:08:26 -0700 In-Reply-To: <994d42e4c4fb74899474a87766d7583507f13a73.camel@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240219074733.122080-1-weijiang.yang@intel.com> <20240219074733.122080-25-weijiang.yang@intel.com> <038379acaf26dd942a744290bde0fc772084dbe9.camel@intel.com> <8a6c88c7457f9677449b0be3835c7844b34b4e8a.camel@intel.com> <994d42e4c4fb74899474a87766d7583507f13a73.camel@intel.com> Message-ID: Subject: Re: [PATCH v10 24/27] KVM: x86: Enable CET virtualization for VMX and advertise to userspace From: Sean Christopherson To: Rick P Edgecombe Cc: Chao Gao , Dave Hansen , "x86@kernel.org" , "peterz@infradead.org" , "john.allen@amd.com" , "linux-kernel@vger.kernel.org" , "pbonzini@redhat.com" , "mlevitsk@redhat.com" , "kvm@vger.kernel.org" , Weijiang Yang Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Tue, May 07, 2024, Rick P Edgecombe wrote: > On Tue, 2024-05-07 at 07:21 -0700, Sean Christopherson wrote: > >=20 > > Keeping X86_FEATURE_IBT set will result in "ibt" being reported in > > /proc/cpuinfo, > > i.e. will mislead userspace into thinking IBT is supported and fully en= abled > > by > > the kernel.=C2=A0 For a security feature, that's a pretty big issue. >=20 > Since the beginning, if you don't configure kernel IBT in Kconfig but the= HW > supports it, "ibt" will appear in /proc/cpuinfo. It never was a reliable > indicator of kernel IBT enforcement. Ah, good to know. > It is just an indicator of if the IBT feature is usable. Does ibt=3Doff make IBT unusable for userspace? Huh. Looking at the #CP h= andler, I take it userspace support for IBT hasn't landed yet? > I think tying kernel IBT enforcement to the CPU feature is wrong. But if = you > disable the HW feature, it makes sense that the enforcement would be > disabled. >=20 > CET is something that requires a fair amount of SW enablement. SW needs t= o do > things in special ways or things will go wrong. So whether IBT is in use = and > whether it is supported by the HW are useful to maintain as separate conc= epts. >=20 > >=20 > > To fudge around that, we could add a synthetic feature flag to let the > > kernel tell KVM whether or not it's safe to virtualize IBT, but I don't= see > > what value that adds over KVM checking raw host CPUID. >=20 > A synthetic feature flag for kernel IBT seems reasonable to me. It's what= I > suggested on that thread I linked earlier. But Peterz was advocating for = a bool. > How enforcement would be exposed, would just be dmesg I guess. Having a n= ew > feature flag still makes sense to me. Maybe he could be convinced. If there's a need for IBT and KERNEL_IBT, I agree a synthetic flag makes se= nse. But as above, it's not clear to me why both are needed, at least for KVM's = sake. Is the need more apparent when userspace IBT support comes along?