Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp4220512ybh; Tue, 17 Mar 2020 14:43:02 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvdCbvMYBDDBafqv9cVQ9iyF1toFjALMbPM4GFbOZ08E1TkhKGO6b2piY8vsjMvZNU9/i+w X-Received: by 2002:a54:418a:: with SMTP id 10mr823952oiy.105.1584481381892; Tue, 17 Mar 2020 14:43:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584481381; cv=none; d=google.com; s=arc-20160816; b=vpWkvvAVdUPCi2gMAdjhcNAg9IMx1RYLYlXW0wBSDWEvWoghVzS2OsnOcPrDhVLYH0 QaYDFDG4wTz3hcVlcjRYe4fsYTrMlGiPuHTXhOPtfseXE+q+u31KlsZx2gEpXg5LKP5r AP84x5DDeaX88/oWPFPnTzCbP4rutuz6ccrUjpD7Xt4hCQKXrQH+IXoCFsDNE0edkaDN cnjZc3ro1nWlM/WJh1/no0Mn+2pL9nLO2XyRO2Gz5Lwx/7bwzwlacBM8hXDR14zCHrQ2 P8VmbkQNrdv6TkpjYrI17G//ZPQqDtvn84DTVZHLnAqPgZT+BldAg1pLAGLzD7453ZSU PUFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender: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=Y4dQOxMQ43z2657POGRWwVC635yA4ihH7J9xxGr+e6I=; b=VUVIbgSNR7YcBCT+8qxXn9oHlS84IwqZgU+JH4TzgFjSejLIsG7v78YlwC/MSNrV9R kFQjPL+vQbSXIzHg0jeuvQTkDhMg9Du/bGvDRFyaswwqEeHQdKNwo0C+3W+PRhbvh+RB +Vdug3ZMsNstwW3rby1Ot2i8I1gDCiq+fhBSM+ajAbgw5YL861Y7qOgj89xqyMBInoIg 3lTWik1KWXZbA6C9ORxdCqOZNaQ2JPlThaWznV5CdHR3Z9xcBmiO+nOEr4LBeezj9FCi qzbL8k4cN4kI4XG0kaUWiTFmgjme/wlrsX7vVBodht0OLdLltlDO+nFR6Mc3puVHlpLf FChg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id h9si2299419oti.155.2020.03.17.14.42.47; Tue, 17 Mar 2020 14:43:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726765AbgCQVki (ORCPT + 99 others); Tue, 17 Mar 2020 17:40:38 -0400 Received: from mga17.intel.com ([192.55.52.151]:23035 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726388AbgCQVki (ORCPT ); Tue, 17 Mar 2020 17:40:38 -0400 IronPort-SDR: 2bmoOs8nufjrxJe4dr6EraLFKOr6TH5V0O/+mBweC46gJMGlwFeSua3Koy/VrIFjZKKirnbQBf o9TcNxKUc7rw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2020 14:40:38 -0700 IronPort-SDR: YZ+YMjsoz5Z8yInBHiCNoyVdMREJVx8o1y6pMI0DuhMu4itMK28Z5eqwlvwbpXo0OEsHTKcf8q fFjv6Bn2OQdw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,565,1574150400"; d="scan'208";a="445636320" Received: from bxing-mobl.amr.corp.intel.com (HELO [10.135.41.245]) ([10.135.41.245]) by fmsmga006.fm.intel.com with ESMTP; 17 Mar 2020 14:40:35 -0700 Subject: Re: [PATCH v28 21/22] x86/vdso: Implement a vDSO for Intel SGX enclave call To: Nathaniel McCallum Cc: Sean Christopherson , Jarkko Sakkinen , linux-kernel@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org, akpm@linux-foundation.org, dave.hansen@intel.com, Neil Horman , "Huang, Haitao" , andriy.shevchenko@linux.intel.com, tglx@linutronix.de, "Svahn, Kai" , bp@alien8.de, Josh Triplett , luto@kernel.org, kai.huang@intel.com, David Rientjes , Patrick Uiterwijk , Andy Lutomirski , Jethro Beekman , Connor Kuehl , Harald Hoyer , Lily Sturmann References: <20200303233609.713348-1-jarkko.sakkinen@linux.intel.com> <20200303233609.713348-22-jarkko.sakkinen@linux.intel.com> <20200315012523.GC208715@linux.intel.com> <94ce05323c4de721c4a6347223885f2ad9f541af.camel@linux.intel.com> <5dc2ec4bc9433f9beae824759f411c32b45d4b74.camel@linux.intel.com> <20200316225322.GJ24267@linux.intel.com> <20200316235934.GM24267@linux.intel.com> From: "Xing, Cedric" Message-ID: Date: Tue, 17 Mar 2020 14:40:34 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nathaniel, I reread your email today and thought I might have misunderstood your email earlier. What changes are you asking for exactly? Is that just passing @leaf in %ecx rather than in %eax? If so, I wouldn't have any problem. I agree with you that the resulted API would then be callable from C, even though it wouldn't be able to return back to C due to tampered %rbx. But I think the vDSO API can preserve %rbx too, given it is used by both EENTER and EEXIT (so is unavailable for parameter passing anyway). Alternatively, the C caller can setjmp() to be longjmp()'d back from within the exit handler. -Cedric