Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3142097yba; Mon, 22 Apr 2019 21:09:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbMMokv32Iwizx9BIsITu77sxr/kj4dqniej1i3cSyZ6dSCfAFYjevZpU+x+/CuOwZR4ry X-Received: by 2002:a17:902:a607:: with SMTP id u7mr5983854plq.66.1555992579897; Mon, 22 Apr 2019 21:09:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555992579; cv=none; d=google.com; s=arc-20160816; b=A6tBElf+Qs/r8dBU7hxmJh4WBpZhNTeiHE5bPJY/+PXdtxULXEPIUgsB0x10RX0pW7 isq8FpsoGA9VoLfFE19HGA5LwhMHtV703zVR3Zy1b8kkwUpnrjY5tpGN5Ilc9gtAVo2K NSrJeTxPqJXc7vTBKfSuvUoCvNSzNpGUihtop8fMWksuraI4Eb2jjWGAO5b41m8pbM48 YAqat79yn/2tObOoIsBB4ca0dnDIQqacJbVIiZERzLZKliqt631N8n3HyFq7FzJldo41 aTflOlQurk1FeAmA0MSaRQTTDB3YwlYDMHM07668LvJwcxpxDuJp0UFYL1xjZSxAjA9/ qKaA== 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=PNiBEz1CIzV5DJvZD373SOp9SxGr1qZJ5OIYbHPiLZo=; b=kPM/NDQNCIFA22N/2h+Rbzo4VTgQXivLiAVupDyzuLbhpMz0ZVxSsKwQEZUuEVja5w BYD/aD3kWGxTYB/ctHK9o3EWHbjmbqXztOAP9B3b98KRW+FtJqSIcoTzOYDcu0X2q7v6 hB6j4juXivh/MNcaJNHnrygRMksrpHlpHnAT7K2dWOAS5mpVjTAL/9bwHZ1Vol3JdlXG PmrW2Dz+2EA/tNnFKW+2GBRnbqvRbgWep0IF4GRk/zDU1LwD7klLys4LicdvZxn6FYg+ 4Sfk8G1N8F86Z4T0P0SBbrpMaFm95UmAS0uYCQrpYuYBstC4BupyzhLAoy2Da+sfBtir YkKQ== 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 a2si13442725pgw.545.2019.04.22.21.09.24; Mon, 22 Apr 2019 21:09:39 -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 S1729457AbfDWBsE (ORCPT + 99 others); Mon, 22 Apr 2019 21:48:04 -0400 Received: from mga03.intel.com ([134.134.136.65]:41111 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727588AbfDWBsE (ORCPT ); Mon, 22 Apr 2019 21:48:04 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Apr 2019 18:48:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,384,1549958400"; d="scan'208";a="144988139" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.181]) by fmsmga007.fm.intel.com with ESMTP; 22 Apr 2019 18:48:02 -0700 Date: Mon, 22 Apr 2019 18:48:02 -0700 From: Sean Christopherson To: Andy Lutomirski Cc: Cedric Xing , LKML , X86 ML , linux-sgx@vger.kernel.org, Andrew Morton , Dave , nhorman@redhat.com, npmccallum@redhat.com, Serge , Shay , Haitao , Andy Shevchenko , Thomas Gleixner , Kai , Borislav Petkov , Josh Triplett , Kai , David Rientjes , Jarkko Sakkinen Subject: Re: [RFC PATCH v1 3/3] selftests/x86: Augment SGX selftest to test new __vdso_sgx_enter_enclave() and its callback interface Message-ID: <20190423014802.GA6749@linux.intel.com> References: <20190417103938.7762-1-jarkko.sakkinen@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 Mon, Apr 22, 2019 at 06:29:06PM -0700, Andy Lutomirski wrote: > On Mon, Apr 22, 2019 at 5:37 PM Cedric Xing wrote: > > > > Given the changes to __vdso_sgx_enter_enclave(), the selftest is augmented to > > test the newly added callback interface. This addtional test marks the whole > > enclave range as PROT_READ, and calls mprotect() upon #PFs to add necessary PTE > > permissions per PFEC (#PF Error Code) until the enclave finishes. > > Nifty. > > What's not tested here is running this code with EFLAGS.TF set and > making sure that it unwinds correctly. Also, Jarkko, unless I missed > something, the vDSO extable code likely has a bug. If you run the > instruction right before ENCLU with EFLAGS.TF set, then do_debug() > will eat the SIGTRAP and skip to the exception handler. Similarly, if > you put an instruction breakpoint on ENCLU, it'll get skipped. Or is > the code actually correct and am I just remembering wrong? My money would be on the code being broken as opposed to you remembering wrong. I'll take a look at it tomorrow.