Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1213796imd; Thu, 1 Nov 2018 12:01:30 -0700 (PDT) X-Google-Smtp-Source: AJdET5eVn743LcztWTXxyrPnHpWexWy41ZpFiGyrnL3dlDozcnkeawY5/2uj+PXmq9YjX0LGLASz X-Received: by 2002:a62:388b:: with SMTP id f133-v6mr8913475pfa.48.1541098890794; Thu, 01 Nov 2018 12:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541098890; cv=none; d=google.com; s=arc-20160816; b=xNPENYaT9aNj4tZkxNrMxL12rQdXiUjTgZqGp7UWb26g7XNEimi4XlhcQ7g2Xolx5N +0W9BOyZMvbiXZjgoki9QjgFhJLe6+Ehe6I0/japcCTT+hEyk0Ckfii+4E+m1Xvxvit7 qvXq5ezfSHlxpKkXJ+5BoAhT2UIOJNGGxs8ojRJFLg6vZmuisAjZi0mx6GuT+Vt5mPXX OeRJSu130VQBhj6n1zYjCfJtz452rEbGsGMRyzaQPWW9AWTjGDuWST12LmKzaiio0b80 rrcJhMASYhCP5XmOc3/lyzWQ8WTj2Bcm+iP2rDU6xK/SHJXMS5beGi7RXHEvD4Fcj9A7 IVlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=u9rhAp5fUf3DFY37SvYnnr8c0eFnig9IDqHhyYelqzI=; b=xly629hdAveN+NeZka/npp2zVdJJCVyLClms2klnKgB+MiR1QrMrkBnuYHnDMrYe2q pfwefgEHqHg/wf9qgH2RMr0YlcELr9BQkFsv7eh2bThV/wAfdG9p1UQqhL6KzYxR+GM8 hlSSE8Te+aVQa8hvrCabVSdwVd0PvG3fD5OU9X8sy646Dh1wF1oU3Q0hCAPJTxpkN01S c6yXz2TTT2hMCaHbE6lgZVHf79A/0ofwrIeNZF2slR4p8ODHO3mboxQjOOL4qCLkfoFP RHbnnhctmXhsTXE2ArXXfbq0yV5+Mg/Nr5yH1/bsBfKgVBHciFJw+la51Zk3bY8SO+2H BUXw== 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 62-v6si10227216plc.282.2018.11.01.12.01.14; Thu, 01 Nov 2018 12:01:30 -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 S1726401AbeKBEFF (ORCPT + 99 others); Fri, 2 Nov 2018 00:05:05 -0400 Received: from mga11.intel.com ([192.55.52.93]:29446 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725935AbeKBEFF (ORCPT ); Fri, 2 Nov 2018 00:05:05 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2018 12:00:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,453,1534834800"; d="scan'208";a="277588429" Received: from btyborox-mobl.ger.corp.intel.com ([10.249.254.138]) by fmsmga006.fm.intel.com with ESMTP; 01 Nov 2018 12:00:40 -0700 Date: Thu, 1 Nov 2018 21:00:38 +0200 (EET) From: Jarkko Sakkinen X-X-Sender: jsakkine@jsakkine-mobl1 To: Florian Weimer cc: Andy Lutomirski , Dave Hansen , "Christopherson, Sean J" , Jethro Beekman , Jarkko Sakkinen , 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 , Adhemerval Zanella , carlos@redhat.com Subject: Re: RFC: userspace exception fixups In-Reply-To: <877ehwisaa.fsf@oldenburg.str.redhat.com> Message-ID: References: <877ehwisaa.fsf@oldenburg.str.redhat.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 1 Nov 2018, Florian Weimer wrote: > * Andy Lutomirski: > >> The basic idea would be to allow libc, or maybe even any library, to >> register a handler that gets a chance to act on an exception caused by >> a user instruction before a signal is delivered. As a straw-man >> example for how this could work, there could be a new syscall: >> >> long register_exception_handler(void (*handler)(int, siginfo_t *, void *)); >> >> If a handler is registered, then, if a synchronous exception happens >> (page fault, etc), the kernel would set up an exception frame as usual >> but, rather than checking for signal handlers, it would just call the >> registered handler. That handler is expected to either handle the >> exception entirely on its own or to call one of two new syscalls to >> ask for normal signal delivery or to ask to retry the faulting >> instruction. > > Would the exception handler be a per-thread resource? For SGX purposes it would *need* to be per-thread resource so that the run-time (not just Intel but any user space support code for SGX) is able to act on thread that caused this exception inside the enclave. /Jarkko