Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1249421imd; Thu, 1 Nov 2018 12:34:47 -0700 (PDT) X-Google-Smtp-Source: AJdET5dlb+0jJ814zwjTptBZu/N+SC4IA0QsHC0L14JiJAYDSD9ALYgKmUkQf93RQj6BbANUEVna X-Received: by 2002:a17:902:8687:: with SMTP id g7-v6mr9068212plo.30.1541100887014; Thu, 01 Nov 2018 12:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541100886; cv=none; d=google.com; s=arc-20160816; b=ppy7aPyfjJKkGAWX7zNAjnZqEtS+hNteIW+fRnaQVxBtBMGrLLD0Y2fhp1gyhgXFej BZvNvCDN0pmrPDFys6WtDJKkfksV1R0i9YbzEFcn2r2leqMYF71KElkWeWYbp7rkH3eW gWggW09y4fvQ334S+xefE1rzlO1vm4pVlo/GBZTaNSW3hkJQX2jkKobWTODhJURLS/1y DWsEXwG36LOvHImequxXkwQOh6+9hgfwZ8FOTm2SPPz38YTtdPvyhloJ8KfPSJQ+20Z3 5qIxgZAz2DsGGoavgqofJC0nlnvj3piCk0Iv50zaD21VzTkGmRrwjIvTjSEmMu8h0tTi CDbw== 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=f5Q+bC/OM6755aXIbR8gZqMzAtphRVksjEj0QO2+ZtQ=; b=PePwog0oxK4Pq7FL5i7+S7E8Ebhd0nsV763Q9Ix+OUecgiWsbbmPTEb92SywzyBB2u fXljJJAj77r3oVBEr/j5MHQIzkqG+06c5doY2350TtPNTHNG+wjwlC1SacQHmOQEn3hK 3Rj0ehkyKycABFvRXVUDt7kyEsCMRXN99XSCA9OoqPPFCr7TJ3j4aK8RENcdBvwfRNo7 blHH9VbzMTjYKI3MWoc1lsdCTOzrYkGg3RfhelefitsLf2tCj9I8+vpzpznjj7P1x+Uu 4sEAWlZKZOJz/m/z0wURsjfBBPt+oUdJO2VGM1seyp6t1JCFcPHuxT3mn0+2da8Bo7IP m7Vg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1-v6si33421619plk.4.2018.11.01.12.34.31; Thu, 01 Nov 2018 12:34:46 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726810AbeKBEht (ORCPT + 99 others); Fri, 2 Nov 2018 00:37:49 -0400 Received: from 216-12-86-13.cv.mvl.ntelos.net ([216.12.86.13]:57954 "EHLO brightrain.aerifal.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725792AbeKBEht (ORCPT ); Fri, 2 Nov 2018 00:37:49 -0400 Received: from dalias by brightrain.aerifal.cx with local (Exim 3.15 #2) id 1gIIgN-00035m-00; Thu, 01 Nov 2018 19:31:07 +0000 Date: Thu, 1 Nov 2018 15:31:07 -0400 From: Rich Felker To: Linus Torvalds Cc: Jann Horn , luto@kernel.org, dave.hansen@linux.intel.com, sean.j.christopherson@intel.com, jethro@fortanix.com, jarkko.sakkinen@linux.intel.com, fweimer@redhat.com, linux-api@vger.kernel.org, x86@kernel.org, linux-arch@vger.kernel.org, Linux Kernel Mailing List , Peter Zijlstra , nhorman@redhat.com, npmccallum@redhat.com, serge.ayoun@intel.com, shay.katz-zamir@intel.com, linux-sgx@vger.kernel.org, andriy.shevchenko@linux.intel.com, tglx@linutronix.de, Ingo Molnar , bp@alien8.de, carlos@redhat.com, adhemerval.zanella@linaro.org Subject: Re: RFC: userspace exception fixups Message-ID: <20181101193107.GE5150@brightrain.aerifal.cx> References: <20181101185225.GC5150@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 01, 2018 at 12:10:35PM -0700, Linus Torvalds wrote: > On Thu, Nov 1, 2018 at 11:52 AM Rich Felker wrote: > > > > There's no need to chain if the handler is specific to the context > > where the fault happens. You just replace the handler with the one > > relevant to the code you're about to run before you run it. > > That's much too expensive to do as a system call. See my other emails in this thread. You would register the *address* (in TLS) of a function pointer object pointing to the handler, rather than the function address of the handler. Then switching handler is just a single store in userspace, no syscalls involved. Rich