Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1289877imu; Tue, 20 Nov 2018 15:08:16 -0800 (PST) X-Google-Smtp-Source: AJdET5cADXGnsRsjnAgTlAwbf10qC3w+Bo12cJaHlFmu27ncc7HUvlLVPv1loYtnCh6Dab3nDzZA X-Received: by 2002:a62:5fc5:: with SMTP id t188-v6mr4256648pfb.84.1542755296154; Tue, 20 Nov 2018 15:08:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542755296; cv=none; d=google.com; s=arc-20160816; b=WOojh/Ulby8lqPVkOvnpQskzggsB+W6nYNMAeki5UdgZC6EgFN5ol7m0L5GG8S+aOj MCqiAxq6zgdKXCfSXseWZTOI2BYJMDiEXPOv+mJS+Xm0sgmqBlt5Bm+oj/j6OPzbe11N c9kMjvLgdaACBV/yMAIMYqEB95rlhpqDDHzecB563jonxUMIkiyk3O0DNQPHhV1m2uJc ZTPU29x5vJRh7jGeMgTq5nONgz/u5TOPEVJeESmGI/VR8Pgql5UYzRVuQXUfiEJG1J/K nCE0n5+5HuZ2YXqeOPefagzRO2ooNxNqI5YSfraVxXUue93UMYMMxt0ubKhgQXXTAQ1O /ZBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=JAPoZ46jcPAwXQOO6jMk4Mi5jowS1uJaOWTpD/wxBw0=; b=BV2kC8hQ7B105vKfS70xhcHjBkQagju+zBmOoUVr1xHqR/NKwJz7UJQAmYLx2GfW95 kjEu6XYiLLvw7J+GC+bGb0vG/AfUC5Tj/GfrIXsxD8rIsHdE/DrSig47AYXDQFCEtv1S u4ZaQWKFrK0EN5nkKkAuJNmrAHUHzb1WDLbjpjhBh3e1iZ+x+tO2EHSAZ/i/c4GfI6BW qim1nDzspNAtsIpPETnGx4+RSzsbRQl6lbuOTXX56UbNi54E9FSrbfsK8T7fKRLtpr9z 07w/KutXArxNM4O6DYKzb7LcbrGke1dBra3X5gB+mh3oVhlqG73QHFsNh7MCWDyEho63 jftA== 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 15-v6si48399226pfr.242.2018.11.20.15.08.01; Tue, 20 Nov 2018 15:08:16 -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 S1726208AbeKUJSX (ORCPT + 99 others); Wed, 21 Nov 2018 04:18:23 -0500 Received: from mga04.intel.com ([192.55.52.120]:44993 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725960AbeKUJSX (ORCPT ); Wed, 21 Nov 2018 04:18:23 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Nov 2018 14:46:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,258,1539673200"; d="scan'208";a="101860166" Received: from drhumphr-mobl.ger.corp.intel.com (HELO localhost) ([10.249.254.165]) by orsmga003.jf.intel.com with ESMTP; 20 Nov 2018 14:46:41 -0800 Date: Wed, 21 Nov 2018 00:46:40 +0200 From: Jarkko Sakkinen To: Andy Lutomirski Cc: Dave Hansen , "Christopherson, Sean J" , Jethro Beekman , Florian Weimer , Linux API , Jann Horn , Linus Torvalds , X86 ML , linux-arch , LKML , Peter Zijlstra , Rich Felker , nhorman@redhat.com, npmccallum@redhat.com, "Ayoun, Serge" , shay.katz-zamir@intel.com, linux-sgx@vger.kernel.org, Andy Shevchenko , Thomas Gleixner , Ingo Molnar , Borislav Petkov Subject: Re: RFC: userspace exception fixups Message-ID: <20181120224640.GC8391@linux.intel.com> References: <20181118071548.GA4795@linux.intel.com> <20181119160204.GD13298@linux.intel.com> <20181120101133.GA7319@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181120101133.GA7319@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 20, 2018 at 12:11:33PM +0200, Jarkko Sakkinen wrote: > On Mon, Nov 19, 2018 at 09:00:08AM -0800, Andy Lutomirski wrote: > > On Mon, Nov 19, 2018 at 8:02 AM Jarkko Sakkinen > > wrote: > > > > > > On Mon, Nov 19, 2018 at 07:29:36AM -0800, Andy Lutomirski wrote: > > > > 1. The kernel needs some way to know *when* to apply this fixup. > > > > Decoding the instruction stream and doing it to all exceptions that > > > > hit an ENCLU instruction seems like a poor design. > > > > > > I'm not sure why you would ever need to do any type of fixup as the idea > > > is to just return to AEP i.e. from chosen exceptions (EPCM, #UD) the AEP > > > would work the same way as for exceptions that the kernel can deal with > > > except filling the exception information to registers. > > > > Sure, but how does the kernel know when to do that and when to send a > > signal? I don't really like decoding the instruction stream to figure > > it out. > > Hmm... why you have to decode instruction stream to find that out? Would > just depend on exception type (#GP with EPCM, #UD). Or are you saying > that kernel should need to SIGSEGV if there is in fact ENCLU so that > there is no infinite trap loop? Sorry, I'm a bit lost here that where > does this decoding requirement comes from in the first place. I > understand how it is used in Sean's proposal... > > Anyway, this option can be probably discarded without further > consideration because apparently single stepping can cause #DB SS fault > if AEP handler is anything else than a single instruction. > > For me it seems that by ruling out options, vDSO option is what is > left. I don't like it but at least it works... The section relevant in the SDM is 43.2.6 but I started to think that why in dumbed down return-to-AEP that would even be a problem? If you are single step debugging isn't that what you want? Continue single stepping in the AEP handler... I still don't understand the part where the need for decoding instruction stream comes in this dumbed down approach. There's not RIP manipulation or anything involved at all. With this reconsideration I would keep this as one option at least. /Jarkko