Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2678649pxk; Sun, 27 Sep 2020 18:00:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwr6W4WIZ/8GdzOShunaYT1pT0B+TCSfwVynZmH+K4sJVwHQv4nAh1/UJNaA/oq6MriNe8M X-Received: by 2002:aa7:dd8b:: with SMTP id g11mr13515685edv.22.1601254815465; Sun, 27 Sep 2020 18:00:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601254815; cv=none; d=google.com; s=arc-20160816; b=hwXeb7IV9w5MHyjKLx4tCYNw3oqFvwgmP3nzM6VwqcQLEOrWig1BjogRDbVFfLC1uC Yuw1gUn5Yyk8BsR2cyBaw+WFYqrZf7SvofOaQu2Dt260C1ZYiZxS70qAiXh1ueNDmQyE LGwnD9CiVZM7COlrvnBNZG3lENZdm8JyRajIZtGYFwX8QFFQq6GbDODpwScTgB6IhwCV 6FUtNtpA3P/hzhetJdLcFMUdcll6l8AUIcUNadoQq9i6stklvJZSS8rZOZ6F0QU2TSwj sv5efrehR/36i6StcO8EsuIVPyxfVv9XREVrMn1gsrpR3x+AmlezzBMu29KLJLXHNDdZ HkrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=JZ3mSJG2ytQ2N1ITRKo42MP2VPvdDn3V9pYT1I5nb48=; b=AtETbazXz/XJM0Z1+poZi8FdT0eu349EMo1fTI+gZWUw39bMLFUsMxANggseZpWYRr EdPq8/EydnmBY0rV+UKSJgnTVPEDIoNety7Y0MdVXfkvTUfGThBQtIeXNmp94IhxACK2 2++nHc2kE4Nekt2xgipV8koiKIOhcxpR7QDXTmLO71uzi1awB2d/lnN8ljwEf4pR8iMZ o74XZGROjReYu/VPCyxUphI7PUN2ZYjjDSVgsvRooUI+jGsciK4Kpl0POuaXNWesbWit BqBMPgI6b6VpZQsFi9yi44li+yQ6kvI6njgRLxrkVij3ZAuaM0chYiMBDjUSSo+E8aq5 kN1w== 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 f2si6700968ejq.262.2020.09.27.17.59.52; Sun, 27 Sep 2020 18:00:15 -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 S1726442AbgI1A6s (ORCPT + 99 others); Sun, 27 Sep 2020 20:58:48 -0400 Received: from mga03.intel.com ([134.134.136.65]:3753 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726393AbgI1A6s (ORCPT ); Sun, 27 Sep 2020 20:58:48 -0400 IronPort-SDR: Qrwq7sieAnXW2K3yAcbLs8Ds5D86rNKJPtpfgD/45dl3YHzhG/ppF6O6cBmbKDDyjc5TVJirC0 DYe8wuiKOkkQ== X-IronPort-AV: E=McAfee;i="6000,8403,9757"; a="161980969" X-IronPort-AV: E=Sophos;i="5.77,312,1596524400"; d="scan'208";a="161980969" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2020 17:58:48 -0700 IronPort-SDR: a893AbrkDh9NEqsvVgsFECYLvDp1TGe5NEn8Kf3iYsyO9hWGRj2HhNerB/5u+vChTtTHg6xArP 464TFTaa3iFQ== X-IronPort-AV: E=Sophos;i="5.77,312,1596524400"; d="scan'208";a="488354243" Received: from memara-mobl.ger.corp.intel.com (HELO localhost) ([10.252.49.157]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2020 17:58:40 -0700 Date: Mon, 28 Sep 2020 03:58:42 +0300 From: Jarkko Sakkinen To: Andrew Cooper Cc: x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Christopherson , Andy Lutomirski , Jethro Beekman , Cedric Xing , akpm@linux-foundation.org, andriy.shevchenko@linux.intel.com, asapek@google.com, bp@alien8.de, chenalexchen@google.com, conradparker@google.com, cyhanish@google.com, dave.hansen@intel.com, haitao.huang@intel.com, josh@joshtriplett.org, kai.huang@intel.com, kai.svahn@intel.com, kmoy@google.com, ludloff@google.com, luto@kernel.org, nhorman@redhat.com, npmccallum@redhat.com, puiterwijk@redhat.com, rientjes@google.com, tglx@linutronix.de, yaozhangx@google.com, "H.J. Lu" , Yu-cheng Yu Subject: Re: [PATCH v38 21/24] x86/vdso: Implement a vDSO for Intel SGX enclave call Message-ID: <20200928005842.GC6704@linux.intel.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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <721ca14e-21df-3df1-7bef-0b00d0ff90c3@citrix.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 25, 2020 at 07:23:59PM +0100, 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. CET goes beyond my expertise. Can you describe, at least rudimentary, how this code is not compatible? I know CET only conceptual level (separate stack holding return addresses as an measure against return oriented programming (ROP)). > Whichever of these two large series lands first is going to inflict > fixing this problem on the other. > > As the vdso text is global (to a first approximation), it must not be a > retpoline if any other process is liable to want to use CET-SS. Why is that? > If the retpoline really does need to stay, then the vdso probably needs > to gain suitable __x86_indirect_thunk_%reg thunks which are patched at > boot based on the system properties. > > ~Andrew aka without CET it is patched? With CET, not? /Jarkko