Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp761808imu; Tue, 20 Nov 2018 06:36:50 -0800 (PST) X-Google-Smtp-Source: AFSGD/VYNmbmfIsTAo8+bBI2DI/AgcLTLTh6fRl3kmR7X4Hk9r5TDwJOv8T+/Y7ynw4v1jQ3916Z X-Received: by 2002:a63:5a08:: with SMTP id o8mr2115351pgb.185.1542724610596; Tue, 20 Nov 2018 06:36:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542724610; cv=none; d=google.com; s=arc-20160816; b=0L2LfvUQXvK6dVs6PQy4Uvm3xZpCNH1wOohFezhzELGuVBzn93LnTMJc/Tnul/Pu9R v6Ol6ils+u+/BVPFmwTZ/aR8131X5PC4gF7N8P6LZTr/oUwzsqSgzk+zg5+6qAsHTFp0 /fORlqZlhQHbNlv/aPZB66bNzrRxBKIhr6Aap0PJCypZmnpRgyEZScJeLUa/8Xer6IUI ut9eEEb/IYXvoZSdd0D+ahJjUcdSrkU21SKNpgce9JsXnDkj6XqdqDra61KXpRJQGbXW aVhNLJNGXK973fdERkhpg2VofG4Tj5SnEPqVD4pStjSkIkrlqlQz/D1c4SLGaQ+6x9Al +cKA== 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=F6gBKMjHajkb0IU0+UEpqtPK5Q45YN+D7qlrjyjSlfw=; b=t4u1cjFmb00iCgsxoTtKyZCMqCsx7vn0GSdpRd2pf9RfRUmLJzf4P63utKh+IQezld sNeM+OZs7hAiDqlfNHfCgo9Ud4crC00yZrv7NpSg3O6NyuDo4gt6+SLK0v8mJ7extA8/ qFBph3E0/IoDAn9r/TeGlbo+CrSZ6Er7mn+a9g4Q38gAd977aFLrr0sZfrn40DvDrED7 pVlWe9jXCIzWsTKVap35uKUolvzRtgRBL7te4laQCLaHzVrTcOI3jsngGYrMOlLW0BC9 XuzCUscuWqZpqC42ighZIqeJSNSAkOXYa4bZya8ACETZrAFkMpf5UKjl0D0m/W493lY/ fwUg== 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 cc17si13820861plb.265.2018.11.20.06.36.35; Tue, 20 Nov 2018 06:36:50 -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 S1728037AbeKTUkD (ORCPT + 99 others); Tue, 20 Nov 2018 15:40:03 -0500 Received: from mga18.intel.com ([134.134.136.126]:29967 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725949AbeKTUkD (ORCPT ); Tue, 20 Nov 2018 15:40:03 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Nov 2018 02:11:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,256,1539673200"; d="scan'208";a="92560497" Received: from jsakkine-mobl1.tm.intel.com (HELO localhost) ([10.237.50.177]) by orsmga006.jf.intel.com with ESMTP; 20 Nov 2018 02:11:33 -0800 Date: Tue, 20 Nov 2018 12:11:33 +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: <20181120101133.GA7319@linux.intel.com> References: <20181118071548.GA4795@linux.intel.com> <20181119160204.GD13298@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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... /Jarkko