Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1616100pxa; Thu, 13 Aug 2020 12:41:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4N59rgiG5Vw2WtwpOWz3/1jS7iKrSyjTqlnOUADm9MFb5Ll2hJhzGW9ijRjHQn9aXcO6S X-Received: by 2002:a05:6402:174d:: with SMTP id v13mr5989806edx.231.1597347685217; Thu, 13 Aug 2020 12:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597347685; cv=none; d=google.com; s=arc-20160816; b=a2AGLccQ2yyAqPscewTwzIsLxH3Dy4bk8gEyvM/v+Rn43DeVIVBePfqabLZiJqiL2S ioftoIAojpC7S+gw6+kr+5ExnW3yR7dg+x2FdrTSjDOEjI827NPxVhQaLgLuFeflohJw CvnCYtqQjm9VvRUUfw4XXm+FfgEfoD+e9ScTT44a/NUFNL2arQyRKERSRkACdAwz2efm e23OR4w32F6JAlaKuQbVvnUn5BS/0Y7IaTg+F8XjuDP8LGw+BWGNcXfU1532JTRMvxK1 4smf285QJrr3JV3jTyuHomttpqL8FIpT05e9MKp6PmpAd3uGfJZrSQZGZBAPpoLOv9+7 okkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=6nOOW/CF7z6YzknSI3o8/XgSNvAHs6+LGXZBvCMqohg=; b=FhMZ52PqcCm7KxykXSIrhzMmrBinttZph5DtiK9X1YQUh9wbf+7m+MQ2+O1YQxz2t2 /EZVWf9kmpgFnYbFPohERq9H8+nm4b4aIshXrlv7R6LUaikkq4sysyowL2owj2DbxTlr FLoPjcgaJW5FCjgWNkDZ5l3q13Kk2HlOCzbysfpe1Ao9AnyYytBZSEGkme9/IJFsqPbS iGlybY/Uq+PtZokiEuc+2VlOkP2f0bJVyU7JJSqAzs00Lx1k63qsDdETM03zmlTtPVfY a1HI7LPOjm/1bk2y/Eg+L1eYDv0xYiA0vuIgH2mGVa5Q6VkFtE4PpcGQW0KdwoawX2en kMBw== 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 w15si4789942edl.118.2020.08.13.12.41.02; Thu, 13 Aug 2020 12:41:25 -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 S1726627AbgHMTip (ORCPT + 99 others); Thu, 13 Aug 2020 15:38:45 -0400 Received: from mga03.intel.com ([134.134.136.65]:49393 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726253AbgHMTio (ORCPT ); Thu, 13 Aug 2020 15:38:44 -0400 IronPort-SDR: /8VVSEtINFwOPBsvCo9HpdrL/w64ZWmE2+6EbKs40dAKAyZGCYnGMnmgsHm3Zzv5soUlF+VoBx Zd2q9QNDvSyg== X-IronPort-AV: E=McAfee;i="6000,8403,9712"; a="154276590" X-IronPort-AV: E=Sophos;i="5.76,309,1592895600"; d="scan'208";a="154276590" 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; 13 Aug 2020 12:38:43 -0700 IronPort-SDR: DzrqYHtiVYVsyOU+gg7XI4CBfhv+F7ihvlSrjxRBmKV5NZwQT11lZZHyixZHyrx8Iww6683MGW UZglPogzVZJA== X-IronPort-AV: E=Sophos;i="5.76,309,1592895600"; d="scan'208";a="470336080" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.160]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2020 12:38:43 -0700 Date: Thu, 13 Aug 2020 12:38:42 -0700 From: Sean Christopherson To: Andy Lutomirski Cc: Andy Lutomirski , Nathaniel McCallum , Jarkko Sakkinen , X86 ML , linux-sgx@vger.kernel.org, LKML , Jethro Beekman , Cedric Xing , Andrew Morton , Andy Shevchenko , asapek@google.com, Borislav Petkov , chenalexchen@google.com, Conrad Parker , cyhanish@google.com, Dave Hansen , "Huang, Haitao" , Josh Triplett , "Huang, Kai" , "Svahn, Kai" , Keith Moyer , Christian Ludloff , Neil Horman , Patrick Uiterwijk , David Rientjes , Thomas Gleixner , yaozhangx@google.com Subject: Re: [PATCH v36 21/24] x86/vdso: Implement a vDSO for Intel SGX enclave call Message-ID: <20200813193842.GV29439@linux.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 11, 2020 at 08:16:54AM -0700, Andy Lutomirski wrote: > > > On Aug 10, 2020, at 5:52 PM, Andy Lutomirski wrote: > > > >  > >>> On Aug 10, 2020, at 4:48 PM, Sean Christopherson wrote: > >>> > >>> On Mon, Aug 10, 2020 at 04:08:46PM -0700, Andy Lutomirski wrote: > >>> What am I missing? I still don't really understand why we are > >>> supporting this mechanism at all. Just the asm code to invoke the > >>> callback seems to be about half of the entire function. > >> > >> Because the Intel SDK (and other SDKs?) wants to use the host stack to pass > >> parameters out of the enclave. > > > > Ugh, right. I forgot about that particular abomination. > > > > I suppose that passing a context pointer would be reasonable. > > The alternative would be to pass in a parameter that gets put in RSP before > entering the enclave. The idea is that the untrusted runtime would allocate a > couple pages with guard pages at either end, and enclaves using the > regrettable arguments-on-the-stack scheme would end up using the alternative > stack. > > At the end of the day, none of this really matters too much. Languages that > can do inline asm but can’t do container_of() can get fixed or use > workarounds. So, is your "official" opinion Go update the vDSO to allow passing an arbitrary pointer. or Eh, don't bother.