Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3113242pxk; Mon, 28 Sep 2020 08:39:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQSw8gvbXBZ5SR0m6gWmaDe86omspCwhXGvW0uiUNilfy9Y565IMclVVNgvaLQ01uo7qOL X-Received: by 2002:a50:fe0a:: with SMTP id f10mr2477054edt.133.1601307582177; Mon, 28 Sep 2020 08:39:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601307582; cv=none; d=google.com; s=arc-20160816; b=NcTr8ICFVCk5CKEgGzZVIU0NjvFY6EQYRvMPxJCqIg4bpikTZ0lHknaw1Sby3FmS8Z LLoxl8FejSAmOpTBr6vCypqHSm6pBeWBZALWSZCYYFUj8RX1wPmsi5HjyZF1xa3NK2fS mY74DVy4IiaDK8xCGmvgIruCeBKRZgmFzj9G/PkQEOCOQ9V43NGmhwuTl+6Lh1BoNq/v SQEWS9yj/nz+lLeMtinsTNMX7pCx0fo8e1BvuaSzkJjsQy+x8bIGX0kzIAZIJEIavwKz Kl8QqhYeEW4YP3ey1JTvq9NNRfh2P/bjRJNxJWeLWgP7eLW9lvmu307Rsom3Sh3FGrvJ 2Org== 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=eRvPCMNItoDZW66Hj+lW6zyHbgRCTcNblItjqbKgc/Y=; b=hKi+PiJ4nhqW2lY47kakP7B0Rjmvop75+1+Lym9jbIUOIqpnrmmiAhN7UpO/nJ1u5u FGz4M5zI1i/tKUPiGXS0+g8O96H+KboWtT1svSqG/FjxIes9iOE3ZAHa6q0fN6vGRSbd C6dEs2m+z7YiewMRT49CzrA2CtUEUmtgiXJLmfPwFKpBr6uv7HuZ1P48H2Ky0Pvn+/1B vjIqhhjWS6jGIZbnceYe5Pgwevwc7yqMWzsQ0+wOtNkwlR9NDwoxSnBVqc4A0fj8UfvU OyYdTsJuWKfpX4uMTNaZ/KMDMLTafEUztGsKOwZF5rnpoerweBd16P0nDTd51ofJtups L9QQ== 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 qq11si848032ejb.445.2020.09.28.08.39.18; Mon, 28 Sep 2020 08:39:42 -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 S1726614AbgI1PiQ (ORCPT + 99 others); Mon, 28 Sep 2020 11:38:16 -0400 Received: from mga17.intel.com ([192.55.52.151]:1891 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726564AbgI1PiP (ORCPT ); Mon, 28 Sep 2020 11:38:15 -0400 IronPort-SDR: Icsc9AYRPRjyaFlY5CJZc5evxzIEoZWZxhl5HeW9h0RzPB/S9zhEOs0ZILU/4vnRUhXcDeNvwW Qw7L6NIqlHYw== X-IronPort-AV: E=McAfee;i="6000,8403,9757"; a="142023299" X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="142023299" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 08:03:00 -0700 IronPort-SDR: ISC2ukrvmEDTuhcF//VIwv9nXDJWy02+pzO+JuVUYBA9Fm8WkrMeQjY7XLaVyfvpfKu0E1lZwf TD1fRczmzHPQ== X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="488612961" Received: from schuethe-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.34.214]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 08:02:52 -0700 Date: Mon, 28 Sep 2020 18:02:53 +0300 From: Jarkko Sakkinen To: Borislav Petkov 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, 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 Subject: Re: [PATCH v38 21/24] x86/vdso: Implement a vDSO for Intel SGX enclave call Message-ID: <20200928150253.GD70098@linux.intel.com> References: <20200915112842.897265-1-jarkko.sakkinen@linux.intel.com> <20200915112842.897265-22-jarkko.sakkinen@linux.intel.com> <20200924180407.GO5030@zn.tnic> <20200925010031.GH119995@linux.intel.com> <20200925082807.GG16872@zn.tnic> <20200927233700.GA4450@linux.intel.com> <20200928083032.GB1685@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200928083032.GB1685@zn.tnic> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 28, 2020 at 10:30:32AM +0200, Borislav Petkov wrote: > On Mon, Sep 28, 2020 at 02:37:00AM +0300, Jarkko Sakkinen wrote: > > I did not get Sean's reply, and neither can find it from lore: > > > > https://lore.kernel.org/linux-sgx/20200915112842.897265-1-jarkko.sakkinen@linux.intel.com/T/#t > > Yah, your mail server upgrade broke a lot of stuff. And lore even says > it is not there: > > 2020-09-25 11:43 ` Jethro Beekman > [not found] ` <20200925003808.GB20333@linux.intel.com> <--- > 2020-09-25 1:04 ` Jarkko Sakkinen > > Lemme bounce it to you. Thank you. I think I have it correctly in my tree. And I actually noticed that I had the original email stored in wrong archive folder on my machine (sorry about that), so did I receive it after all, but it does not exist in lore. > > I'd make that a description and take away individual parameter > > descriptions. Is that fine? > > Sure. /** * typedef sgx_enclave_exit_handler_t - Exit handler function accepted by * __vdso_sgx_enter_enclave() * @run: Pointer to the caller provided struct sgx_enclave_run * * The register parameters contain the snapshot of their values at enclave * exit * * Return: * 0 or negative to exit vDSO * positive to re-enter enclave (must be EENTER or ERESUME leaf) */ typedef int (*sgx_enclave_exit_handler_t)(long rdi, long rsi, long rdx, long rsp, long r8, long r9, struct sgx_enclave_run *run); I think this looks reasonable now. Another minor clean up I made is: struct sgx_enclave_run { __u64 tcs; __u32 flags; __u32 exit_reason; __u64 user_handler; __u64 user_data; I.e. got rid of the "user_handler union. Makes the struc less confusing looking and is consistent with the other structs. I've been thinking about this tail: union { struct sgx_enclave_exception exception; /* Pad the entire struct to 256 bytes. */ __u8 pad[256 - 32]; }; }; I'd just replace this with __u64 exception; }; And do something like (just writing it to the email to show the idea, have not even compiled this): - mov %eax, (SGX_ENCLAVE_RUN_EXCEPTION + SGX_EX_LEAF)(%rbx) - mov %di, (SGX_ENCLAVE_RUN_EXCEPTION + SGX_EX_TRAPNR)(%rbx) - mov %si, (SGX_ENCLAVE_RUN_EXCEPTION + SGX_EX_ERROR_CODE)(%rbx) - mov %rdx, (SGX_ENCLAVE_RUN_EXCEPTION + SGX_EX_ADDRESS)(%rbx) + mov SGX_ENCLAVE_RUN_EXCEPTION(%rbx), %rbx + + mov %eax, (SGX_EX_LEAF)(%rbx) + mov %di, (SGX_EX_TRAPNR)(%rbx) + mov %si, (SGX_EX_ERROR_CODE)(%rbx) + mov %rdx, (SGX_EX_ADDRESS)(%rbx) > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette /Jarkko