Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3117002pxk; Mon, 28 Sep 2020 08:45:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvor8FMce3AjjMZxq08fVyIdDfk4V/Xq4aYcHmMerch/3hwS8RLY9vZcA+nStk0a9KEcNZ X-Received: by 2002:a17:906:dbf5:: with SMTP id yd21mr2169107ejb.521.1601307904842; Mon, 28 Sep 2020 08:45:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601307904; cv=none; d=google.com; s=arc-20160816; b=Z8gXaQEQlXUTdhiyfb3SAcxEYataKyfUTUbcVjLSAgQuUPlvlT6nC95bK69EuYabTN eCmi+AmPcwobw+jRd7ByAR6qey4CTn472w0XTeJ9/Kp4TCu/FMe21BhKWOk1i3YwEjiv CuE0B3N3kMpdsNwg+9/A5SZgfJxz3gf4yP7UhRS+y2R00P2/rKI1gZdLEQCX0+I1IJak W02jxisXVChhBksjExyITKrNSQfQJlmvgk5usAdU4VurC5+sEcBVQh4/gdIw8xON+vQw fIIQ/N+RrGkOEWYd9ETKqBvUaTsWVLX6odFfocMR3HmXfLQXIHNJemFNVBfgmtVcHfWQ 3Dhw== 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=0MKNEZ18BuvWcl77s0wRweu+Zr+JUSTfz6Ke6jbdfSA=; b=ym2RVf40m7Hvfz3jssEhJ5hnNNDy/Dcj97TgVb6dwO48U65SmM+cz2K5DcrOnwJjMY Zqzr/c9pSsZVqLONalKS48ltEgx6uCB6UCCsWPPxs+HSs2dZIgOzHAzTb6zA9c+PcmDu DwEg8QsVdYfich0ug8Eywr4nqX5+U0v1IBKbCW8mzJ7iiExte1IgOtb0tl7UZ0FCoQ/Z Y0f8sHlAqQNuxJEuI5eKBqW7RAUAqINTEeO070UwiHSxps1QDUm9jQHn4uLPtnf05JyE U8IPDoJXDXpcMhBtYRiJL9YKO/ajW6NKJh7NEc2FaDTNSCjNw9D70iozXNjxCS3haVmr ncBw== 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 b26si871034edu.250.2020.09.28.08.44.41; Mon, 28 Sep 2020 08:45:04 -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 S1726558AbgI1PnU (ORCPT + 99 others); Mon, 28 Sep 2020 11:43:20 -0400 Received: from mga14.intel.com ([192.55.52.115]:3957 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726348AbgI1PnU (ORCPT ); Mon, 28 Sep 2020 11:43:20 -0400 IronPort-SDR: QgoqUqm7a4vlffvJdPQYxhxyLAuYTb4F21O1K+cfCXuE3HbEmi4svbBV4iETGZ0Qad/WQ7rTpn yYAvBC8RbuCA== X-IronPort-AV: E=McAfee;i="6000,8403,9758"; a="161244135" X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="161244135" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 08:43:18 -0700 IronPort-SDR: 4HdcopWKm89RfPFXQj4TehgDuEsxlZkQ+ZATP7L5KKTi5Sg2Ksxwil8TJGKZJHzKZwd0a4H0Be bk4zMUOb0KUw== X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="307377637" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.212.93.46]) ([10.212.93.46]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 08:43:17 -0700 Subject: Re: [PATCH v38 21/24] x86/vdso: Implement a vDSO for Intel SGX enclave call To: Andrew Cooper , Jarkko Sakkinen , x86@kernel.org, linux-sgx@vger.kernel.org Cc: 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" 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 08:43:16 -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: <721ca14e-21df-3df1-7bef-0b00d0ff90c3@citrix.com> 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/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". Yu-cheng > > 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. > > 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 >