From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EA2AC5ACD7 for ; Tue, 17 Mar 2020 21:40:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E3F020714 for ; Tue, 17 Mar 2020 21:40:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726864AbgCQVki (ORCPT ); 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