From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B196FC433EF for ; Wed, 20 Jul 2022 19:50:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230355AbiGTTuD (ORCPT ); Wed, 20 Jul 2022 15:50:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229599AbiGTTt6 (ORCPT ); Wed, 20 Jul 2022 15:49:58 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAB2374345 for ; Wed, 20 Jul 2022 12:49:54 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d10so17374855pfd.9 for ; Wed, 20 Jul 2022 12:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=b+DylbHD8S48D4o1wD2FJSsTVK7ZV2ZeetMTzG1hbok=; b=Nf5eLtTSoGK+n/pFVXlIO9WwAt8+Liv5cKuLa8biUx3uV/GIqrb7OVTxI+ZytaVGWP 9AWOkeHd5/GrDATS4TVzbvWvHcHXHoNZYD54XGOFqBZfnLSejsZsDsHEsccqs4uGSsb8 JOeASjNTybNPMSAIppp8bk9u59XgERYOsniH+EG8oMOUxtCrzzm5+jSG8GOh5CM+CH0h 7/sTUYzJ8aUanaQL9Ta7jAGEuD/d9KhGPlPnaKOmzfKXGzlw6sNw7Sef8dyt7Tup0dtq 4cxX2+fvOxfhhxcG6fUtvx3Vks0LN3iTc/+/YW09paq/2XN9unbA3be7xuKy9jpzpgwc APiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=b+DylbHD8S48D4o1wD2FJSsTVK7ZV2ZeetMTzG1hbok=; b=7Yv19aEBZkpR6g11kFE97wv55dKoj3iLJQt8GwtrFN8+fLlt6ejxAEjjpwpp0Ne9qg FAfzUJpPGmJNa6fC8EV21w1dJ2jSuYGCb+bPSzw7XZQCylcPYUyJD/5L0+pPhFkY2a90 9ZIAmp3DwIseJwIdysy4vCmTBY7A00M8a+k9YvwdWa/l6Mn6/EGE34YBdUxv5RJf2Hm7 AdLN3B+ShJ5D/66Wfn8dOBvdKKr7HazuOrYfv6MF6wLOM5Biq74YOPNVdAdq1a3vsrJh A7nN/cqvcteMF5JcaJfO8hGMdhBOCcWYVyv1HCh7AmQ1bxqynVHDKeujgiRSnWR6F7N5 YObA== X-Gm-Message-State: AJIora8dfEeW7s39ez9GZseeoWPR5gBu9QE3Gcge2dyCXFPz6KWX8jFC 0SiFv1nDMGSnicoc79ZpCP/XoA/zxedQ1A== X-Google-Smtp-Source: AGRyM1s74rEuPyhQq/4UZfKv6wWG2cJVZzIqK9DOXYh7Od54wqhHDZrQXo2riZ5uTGUUDlSDPyTo6A== X-Received: by 2002:a05:6a00:27a6:b0:52a:e089:e777 with SMTP id bd38-20020a056a0027a600b0052ae089e777mr41652939pfb.53.1658346594084; Wed, 20 Jul 2022 12:49:54 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id v12-20020aa799cc000000b00528c149fe97sm19892pfi.89.2022.07.20.12.49.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 12:49:53 -0700 (PDT) Date: Wed, 20 Jul 2022 19:49:49 +0000 From: Sean Christopherson To: Dave Hansen Cc: dave@sr71.net, Jarkko Sakkinen , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Kai Huang , Haitao Huang , x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] [v2] x86/sgx: Allow enclaves to use Asynchrounous Exit Notification Message-ID: References: <20220720191347.1343986-1-dave.hansen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220720191347.1343986-1-dave.hansen@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-sgx@vger.kernel.org On Wed, Jul 20, 2022, Dave Hansen wrote: > Changes from v1: > * Make sure SGX_ATTR_ASYNC_EXIT_NOTIFY is in the masks that are > used at bare-metal enclave initialization and that enumerates > available attributes to KVM guests. Heh, I was wondering if KVM needed to be updated. > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > index 0c1ba6aa0765..96a73b5b4369 100644 > --- a/arch/x86/kvm/cpuid.c > +++ b/arch/x86/kvm/cpuid.c > @@ -1022,9 +1022,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) > * userspace. ATTRIBUTES.XFRM is not adjusted as userspace is > * expected to derive it from supported XCR0. > */ > - entry->eax &= SGX_ATTR_DEBUG | SGX_ATTR_MODE64BIT | > - SGX_ATTR_PROVISIONKEY | SGX_ATTR_EINITTOKENKEY | > - SGX_ATTR_KSS; > + entry->eax &= SGX_ATTR_PRIV_MASK | SGX_ATTR_UNPRIV_MASK; It may seem like a maintenance burdern, and it is to some extent, but I think it's better for KVM to have to explicitly "enable" each flag. There is no guarantee that a new feature will not require additional KVM enabling, i.e. we want the pain of having to manually update KVM so that we get "feature X isn't virtualized" complaints and not "I upgraded my kernel and my enclaves broke" bug reports. I don't think it's likely that attribute-based features will require additional enabling since there aren't any virtualization controls for the ENCLU side of things (ENCLU is effectively disabled by blocking ENCLS[ECREATE]), but updating KVM isn't particularly difficult so I'd rather be paranoid.