Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp378520pxu; Tue, 6 Oct 2020 08:32:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyJqoypU3NDSj10WYM3wu1W/rQWbqJ6/q3+ZiCvVpHmXekw+7gQyeoyMZnkglsRgWi0u4f X-Received: by 2002:aa7:c1d3:: with SMTP id d19mr6222150edp.293.1601998340032; Tue, 06 Oct 2020 08:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601998340; cv=none; d=google.com; s=arc-20160816; b=yifibMXQb9ES1h8Ylb7Y2iyjIq69eREP6Y/4j/7jKRm9pnDNOQbafKFesihHMWr10x VcLc075O+HSBU/dDbSfZgqRpJDCXm+iL/u0AGu5UQk4yfnh92ZnfFMYbmlo4fDHXYWQs dFNj6S6pFwkW5cT2+kCsrMlYsFVLyUngp3VOBvhtb8az1Ps5QoAWigf0iL1j/PFDk+Yk bzAt1t3ciSVMUddpic/HzFTFNJbNOADnaAOiYH7ezPTejMg7Qq3KrP0o7uBDbpliURDc mbtYqyi2ksw+KEKnqpfFHnOm0Taw52NWMvkV4GQIWYlmSxpGptt+pcGM0cxG2HTUVHXS h8xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=5FXAWNn1Kn5GWWY2hlSbHH1eaZIR6d0jdi0a2cU9/hU=; b=rxDlYeLLHA0IT7R1Al5Gp2NhC2e+YWZqjnPSdce69DUHr9UVD43550eExRz/miVMYT FJxAD1FoXMZtkmFmwqb5FtB05eDMtMGEsPCt4JRMY5RcitNN/ljf543LDcFsknajfn8e /Rq8IEq4zAEkvrymLzdzih7jd/2bihwDPMpwD9Vgoeja9HchOz8iqYK1s1nM6GrCHr4C M4KrTSvuZz8jVA2Huobhr3UFlQwpc8kNT137Hs/PJuDXW3AkYl/GpqbiEdzDf1iYqYjB 0uvWDGHn1HBhedBhtPH60TLL41iRY7R/CiCBKahT6pMj2TbfvKquSXXEg9FGmocpOz8U 4esg== 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 p34si2374859edd.53.2020.10.06.08.31.55; Tue, 06 Oct 2020 08:32:20 -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 S1726147AbgJFPay (ORCPT + 99 others); Tue, 6 Oct 2020 11:30:54 -0400 Received: from mga04.intel.com ([192.55.52.120]:49350 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725769AbgJFPax (ORCPT ); Tue, 6 Oct 2020 11:30:53 -0400 IronPort-SDR: ZNG5azsZl3wraXneFyZK0nUSgoNjDlrZfdWSec4iCUzWBKHdpFe9Mz+C0PqB+I6ElFslMJkJaX TOOYpm1PLUjQ== X-IronPort-AV: E=McAfee;i="6000,8403,9765"; a="161915881" X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="161915881" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2020 08:15:35 -0700 IronPort-SDR: Ld8hUSmXzhhmCv51vSWvkEQIse22EktXhPt6YDefIVr2f33rzb4FsKm4nZeXZkdwOy+qoPioiy +Br3LSVF+cmQ== X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="460838766" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.160]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2020 08:15:34 -0700 Date: Tue, 6 Oct 2020 08:15:32 -0700 From: Sean Christopherson To: Jethro Beekman Cc: Jarkko Sakkinen , x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Lutomirski , 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, 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, mikko.ylinen@intel.com Subject: Re: [PATCH v39 21/24] x86/vdso: Implement a vDSO for Intel SGX enclave call Message-ID: <20201006151532.GA17610@linux.intel.com> References: <20201003045059.665934-1-jarkko.sakkinen@linux.intel.com> <20201003045059.665934-22-jarkko.sakkinen@linux.intel.com> <20201006025703.GG15803@linux.intel.com> <453c2d9b-0fd0-0d63-2bb9-096f255a6ff4@fortanix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <453c2d9b-0fd0-0d63-2bb9-096f255a6ff4@fortanix.com> User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 06, 2020 at 10:30:16AM +0200, Jethro Beekman wrote: > On 2020-10-06 04:57, Sean Christopherson wrote: > > On Sat, Oct 03, 2020 at 07:50:56AM +0300, Jarkko Sakkinen wrote: > >> +struct sgx_enclave_run { > >> + __u64 tcs; > >> + __u64 user_handler; > >> + __u64 user_data; > >> + __u32 leaf; > > > > I am still very strongly opposed to omitting exit_reason. It is not at all > > difficult to imagine scenarios where 'leaf' alone is insufficient for the > > caller or its handler to deduce why the CPU exited the enclave. E.g. see > > Jethro's request for intercepting interrupts. > > Not entirely sure what this has to do with my request, I just expect to see > leaf=ERESUME in this case, I think? E.g. as you would see in EAX when calling > ENCLU. But how would you differentiate from the case that an exception occured in the enclave? That will also transfer control with leaf=ERESUME. If there was a prior exception and userspace didn't zero out the struct, there would be "valid" data in the exception fields. An exit_reason also would allow retrofitting the exception fields into a union, i.e. the fields are valid if and only if exit_reason is exception.