Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp925251imu; Fri, 7 Dec 2018 11:04:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/ULT9Josossaet/RWsn1zhGTAC2i5HQHfWcXv+sDpyXOj1QjCQ7R2WS5YsP48lZKA6sURIY X-Received: by 2002:a63:d513:: with SMTP id c19mr2970296pgg.287.1544209444644; Fri, 07 Dec 2018 11:04:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544209444; cv=none; d=google.com; s=arc-20160816; b=L2hqH3Ow+OKcn9K/j24J5MGNoDzFOx+xCcxzXvJRyTjs1YYj9uQ2mEjLQpoi/79RtR mbRcNtvAdwXhIBuGKFpeiQzoeMmSiecBBFo9DaVbyzXxn/bWxnSx2pmcqIG/xdb9/Xdi Dv3F019pSs9/+Y29jHp3Jjh4i3Z6YO5nHOC+OknmX2r8W2KCJr+i5M0HZnH8AqoEN1cD MYjF4KEbnLramTLaRpPIbeG+nlgaaT/nACTdhwiUR3pB19QoMc39NCCvDP+kCDsyGP3w 8SRDE/NTQw9m4VosxP7sKG06U1XbAmCVgGk6af50nmoH9ZHByevfp0HyGyVXoB+YM0NO sXDg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=qnncF5m3/4rSIbvg+/gRkgBisguDdNpUmsnn6XYEP48=; b=WvWG3k2PHNwBAMM6bzMrHE6RPia/Wx9NRzzAdOj83YMTDwq3IXHydgkp9kEfX14d/z tVQa5QmCLE2pbiajP9F6+fNTvWjQ4Tob0Brb+xO0IvyQfWB58CHoe9yN4Ni1wSkOniHt VwO0/h3H3bV1Phcaoa02NqaEBay0Mhfrc4h6mnkvSkJ0zXzCv+1UOshEn5krxaB+Fjxe 3rfiGrL11jj9jZ/ixeiKhzxJdcwANRUJK0Kgiv2F3rh6n9D2akey3tGywwkZouEE5EyW E4mDV24uMhgn2aBse+JLa1XiLlwQR05poTlelkBMDA/eIccmgIjPjDbcH1BQ3jwFsv4V LAZA== 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 s2si3431011pgj.60.2018.12.07.11.03.39; Fri, 07 Dec 2018 11:04:04 -0800 (PST) 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 S1726090AbeLGTC6 (ORCPT + 99 others); Fri, 7 Dec 2018 14:02:58 -0500 Received: from mga17.intel.com ([192.55.52.151]:59689 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726018AbeLGTC6 (ORCPT ); Fri, 7 Dec 2018 14:02:58 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Dec 2018 11:02:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,327,1539673200"; d="scan'208";a="97025170" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.154]) by orsmga007.jf.intel.com with ESMTP; 07 Dec 2018 11:02:57 -0800 Date: Fri, 7 Dec 2018 11:02:57 -0800 From: Sean Christopherson To: Andy Lutomirski Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , X86 ML , Dave Hansen , Peter Zijlstra , "H. Peter Anvin" , LKML , Jarkko Sakkinen , Josh Triplett , linux-sgx@vger.kernel.org, haitao.huang@linux.intel.com, Jethro Beekman , "Dr. Greg Wettstein" Subject: Re: [RFC PATCH v2 4/4] x86/vdso: Add __vdso_sgx_enter_enclave() to wrap SGX enclave transitions Message-ID: <20181207190257.GC10404@linux.intel.com> References: <20181206221922.31012-1-sean.j.christopherson@intel.com> <20181206221922.31012-5-sean.j.christopherson@intel.com> <20181207165145.GB10404@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 Fri, Dec 07, 2018 at 09:56:09AM -0800, Andy Lutomirski wrote: > On Fri, Dec 7, 2018 at 8:51 AM Sean Christopherson > wrote: > > I like that the exit handler allows userspace to trap/panic with the full > > call stack in place, and in a dedicated path, i.e. outside of the basic > > enter/exit code. An exit handler probably doesn't fundamentally change > > what userspace can do with respect to debugging/reporting, but I think > > it would actually simplify some userspace implementations, e.g. I'd use > > it in my tests like so: > > > > long fault_handler(struct sgx_enclave_exit_info *exit_info, void *tcs, void *priv) > > { > > if (exit_info->leaf == SGX_EEXIT) > > return 0; > > > > > > } > > > > Hmm. That't not totally silly, although you could accomplish almost > the same thing by wrapping the vDSO helper in another function. True, but I think there's value in having the option to intercept an exception at the exact(ish) point of failure, without having to return up the stack. The enclave has full access to the process' memory space, including the untrsuted stack. It's not too far fetched to envision a scenario where the enclave corrupts the stack even if the enclave isn't intentionally using the stack, e.g. the host passes in variable that a points at the stack instead of whatever memory is supposed to be shared between the enclave and host. It'd be nice to have the ability to triage something like that without having to e.g. configure breakpoints on the stack.