Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3159318pxk; Mon, 28 Sep 2020 09:44:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyz/CE1cpGoIkb5WKq0vb/y631FK/zrAKiK6yiZ0leI0r8zJbsJQ4lS9lPmZP+vm1mshYlX X-Received: by 2002:a17:906:c191:: with SMTP id g17mr2580915ejz.117.1601311457786; Mon, 28 Sep 2020 09:44:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601311457; cv=none; d=google.com; s=arc-20160816; b=lRHjshtOBpRlQmnCjndFstfRAT4XRcRl3IUt9+h5RGBGmLHRMBMLF7WrQGKxMrthsL mjkKwCvEZ/AkHsCU3Mxoh8gYbDL9UeNi87V0lq+WsTtNl1DyV7y3Bii2juH8Hcai8Dsm nNtQfX1zcU2Mwlrt4psf3GyOoW8tcUTI+CBGmutGOcW1gpDXIbrWgBCaxr1bFM+locPz JbEakNw040u82C+sJlQzTt+5hl9gsH03/GklkLoqieF/4b3rOwc/mUUkGWCpvXXlojtK sTHX9Zf4yx5IrqcTlQ3mJAlOQK1yFj9K7OhBhn41M3oWBWYLvOVH3y+gqR2EwPHtBEuq +9xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=fLEZe0nol1pS9RvPOEMSTjYW/m+rlV7x0XheQ/4ypkA=; b=fqgYH+PEjonYRPXBd2m1srj8wJ25tX9GfOWxhQJ6SXn88T9NKZZW5xRgV0gd0O78V7 wWDfuVmkRpaJ9lnQy7vBffFt3fz1Y4VkmkWxkDuzU4Xw1aBUso382UceqFiZbAnqgJgj +p6jRyEVOSoeXQicvaPcaL5OzZsMY0aOgXgGJrcG1l7GwvP6+UK/CJ8G2xnlm21ZzD0O O4Gj0wneAFuU3XEMG/AJAyu5Ov1yBcuSlEqewwUzsgr7euDt1pse/1hg06yhhfG0Fj7N F4l5+f32j1CJuosKzjD5i3bRSMzt8CmPHW1f4tlK+ugmXxoDgY6kAv+rDfJr0vfkaOgt leRQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m15si906249ejg.633.2020.09.28.09.43.53; Mon, 28 Sep 2020 09:44:17 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726651AbgI1Qkv (ORCPT + 99 others); Mon, 28 Sep 2020 12:40:51 -0400 Received: from mga07.intel.com ([134.134.136.100]:28047 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726497AbgI1Qku (ORCPT ); Mon, 28 Sep 2020 12:40:50 -0400 IronPort-SDR: s6ecdiPyRTYSfmUHRbdCCkyE6Z/27OR6/xSDdMVFDCSpbhPvFBwp4lzwtzXm++z8JVgLrDxXp0 VwtdMgBYsDlg== X-IronPort-AV: E=McAfee;i="6000,8403,9758"; a="226172940" X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="226172940" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 09:40:50 -0700 IronPort-SDR: /LmDULZR2KYXKBkfire6UySF12ecP+6N3xV2CFAp4dbmBrfrXn608ArC1MNdwZWwlmSd3gYEvW nyEyuM/xkz0Q== X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="456892205" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.212.93.46]) ([10.212.93.46]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 09:40:46 -0700 Subject: Re: [PATCH v38 21/24] x86/vdso: Implement a vDSO for Intel SGX enclave call To: "H.J. Lu" Cc: Andrew Cooper , Jarkko Sakkinen , the arch/x86 maintainers , linux-sgx@vger.kernel.org, LKML , Sean Christopherson , Andy Lutomirski , Jethro Beekman , Cedric Xing , Andrew Morton , andriy.shevchenko@linux.intel.com, asapek@google.com, Borislav Petkov , chenalexchen@google.com, conradparker@google.com, cyhanish@google.com, Dave Hansen , "Huang, Haitao" , josh@joshtriplett.org, kai.huang@intel.com, kai.svahn@intel.com, kmoy@google.com, Christian Ludloff , Andy Lutomirski , nhorman@redhat.com, npmccallum@redhat.com, puiterwijk@redhat.com, rientjes@google.com, Thomas Gleixner , yaozhangx@google.com References: <20200915112842.897265-1-jarkko.sakkinen@linux.intel.com> <20200915112842.897265-22-jarkko.sakkinen@linux.intel.com> <721ca14e-21df-3df1-7bef-0b00d0ff90c3@citrix.com> From: "Yu, Yu-cheng" Message-ID: Date: Mon, 28 Sep 2020 09:40:45 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/28/2020 8:54 AM, H.J. Lu wrote: > On Mon, Sep 28, 2020 at 8:43 AM Yu, Yu-cheng wrote: >> >> On 9/25/2020 11:23 AM, Andrew Cooper wrote: >>> On 15/09/2020 12:28, Jarkko Sakkinen wrote: >>>> diff --git a/arch/x86/entry/vdso/vsgx_enter_enclave.S b/arch/x86/entry/vdso/vsgx_enter_enclave.S >>>> new file mode 100644 >>>> index 000000000000..adbd59d41517 >>>> --- /dev/null >>>> +++ b/arch/x86/entry/vdso/vsgx_enter_enclave.S >>>> @@ -0,0 +1,157 @@ >>>> +SYM_FUNC_START(__vdso_sgx_enter_enclave) >>>> >>>> +.Lretpoline: >>>> + call 2f >>>> +1: pause >>>> + lfence >>>> + jmp 1b >>>> +2: mov %rax, (%rsp) >>>> + ret >>> >>> I hate to throw further spanners in the work, but this is not compatible >>> with CET, and the user shadow stack work in progress. >> >> Hi Jarkko, >> >> These 1: and 2: targets are reached only from these few lines? If they >> are direct call/jmp targets, I think it is OK in terms of CET. If they >> are reached from an instruction like "jmp *%rax", then we need to put in >> an "endbr64". >> > > This also isn't compatible with shadow stack. > Then, when shadow stack is enabled, disable this? Yu-cheng