Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1358490imd; Thu, 1 Nov 2018 14:25:46 -0700 (PDT) X-Google-Smtp-Source: AJdET5epMjMfgklHq9LmXl5rM6cSUdxflQ6VcVTJPzboD6JZrCR1Qb6BuMxhi3LYpvG/11D31U3b X-Received: by 2002:a17:902:ea:: with SMTP id a97-v6mr9090017pla.164.1541107546036; Thu, 01 Nov 2018 14:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541107546; cv=none; d=google.com; s=arc-20160816; b=09c8NTMYZLWvR6r2g/oENNHBA2O+Di2Ad7nsRt702HiGzzKgNbry6za2zNFtZXEhPF 5M3GBOl+nq5wKGxfcFn5evcIw+s8eomc+IaysINFia7raJj/MnS3xkhBgCoXm+9SfN+R dD8XudoN9H55JP3mOsF20Wz/l6B/w+hdS1Y8seGfizn7y6v5tVkbTnlcFoJD9fl8Gt6N HDm/FSx7R1U04asDCgMQ2510mRtIkpqO0rN07Ez9JjBKA3O0DAd1YnOK9cQMayGhTwfD oLAeKYlS7O7Iv8YuYrM9Z8js2L1Nn+L57E8saurgyooliYVdwR+yPwf9n0wE1t/os6lo AklQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6l0oXKTWmF6192MGpX+vILDY+h+riejuNP24DHkSMWM=; b=largjpo+Ixj/0WdbcrWwvRJmQTw8BfO/yQTIkTyv1j8+hkbjUJUbfev6ZyrBGbyKaS 8CJkMr547Ejb1BQZsS9lcLvEGg63kqh0JjDllPDZSwud9any+qVNWnC20Unlvbmn0pqC J80geYOCB0EZ8UzZGkHCsINv5BXrRyE6kJtJNsm1k7bZwTYc/WPxEsppvKR1NDSeLwWB 98kN1qFAt1RvGLGK0+ThGucXw5WnldZw9tZbJWAvzW5l940595jc29jzS8zbN00y3tIW M+spbRtXOty4NYgA7Qos4YAeCFNpE9ZMzerH2EAqZfdgAqdT1Y0r3U/flTRnW1ftUia6 bewA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=I8sNO71V; 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 o186-v6si34989035pfo.236.2018.11.01.14.25.31; Thu, 01 Nov 2018 14:25:45 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=I8sNO71V; 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 S1727430AbeKBG32 (ORCPT + 99 others); Fri, 2 Nov 2018 02:29:28 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:34333 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727338AbeKBG32 (ORCPT ); Fri, 2 Nov 2018 02:29:28 -0400 Received: by mail-lj1-f196.google.com with SMTP id u6-v6so3046363ljd.1 for ; Thu, 01 Nov 2018 14:24:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6l0oXKTWmF6192MGpX+vILDY+h+riejuNP24DHkSMWM=; b=I8sNO71VG7+Std248CcLp382Pq6vk7t03j5Y8qjTm5RhyHYruHMZNnaak081W3c180 NqOO57k44MhEq1DIrVf/Db6Otw1p3LYTskn+xJCzc3fpKqsnoG9urVzDtDpCiftuXqfD 7G/pPHstYrW9uUpSAG2ZvNZHa6/wH/SDVX0IE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6l0oXKTWmF6192MGpX+vILDY+h+riejuNP24DHkSMWM=; b=T+PIx0m7Z6tiAEbhzvC/vS+PsgjLR2zLQ69Vk/obRuqF3vX6HI4KZiXFrxNg0CIz33 MaW3b4Pa+Rc5xqG6ca7WGzNIrkwfwiGlMsooZs8LeFK/5LjOypPOYHeSzBHiAiDKa4gs ZSYLcq82JWTw29I1aVaBBmEY06LX1PPVRGYawb8PQRMK+6nETdL1uPgwf+VVrzdo9I6H kV2YJ5EfUpIVkoUOOw3NlF3Y8JMzArGgWeJ3fR0JLNkyon6UG+Zqs//jZxi9h96E/77Z hjnTSWX1XpLqrKaRDaFp4hwfj6+vJlTxDt8fDkrhAAT71PttLbFR0P29oZNJ8wsts8bk 4tqQ== X-Gm-Message-State: AGRZ1gLMEGhAgV7Bxh/jJ3w0NBg0j77/w9mwV0RYtA1fHTwIuNNMnrAq PWi8YXyNhv76e9AzmoZ9V8+deToLLOGZhw== X-Received: by 2002:a2e:a289:: with SMTP id k9-v6mr5219874lja.24.1541107484573; Thu, 01 Nov 2018 14:24:44 -0700 (PDT) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com. [209.85.208.170]) by smtp.gmail.com with ESMTPSA id w21-v6sm595099lfe.73.2018.11.01.14.24.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Nov 2018 14:24:43 -0700 (PDT) Received: by mail-lj1-f170.google.com with SMTP id c4-v6so19384565lja.4 for ; Thu, 01 Nov 2018 14:24:43 -0700 (PDT) X-Received: by 2002:a2e:9584:: with SMTP id w4-v6mr6043318ljh.118.1541107482506; Thu, 01 Nov 2018 14:24:42 -0700 (PDT) MIME-Version: 1.0 References: <20181101185225.GC5150@brightrain.aerifal.cx> <20181101193107.GE5150@brightrain.aerifal.cx> In-Reply-To: <20181101193107.GE5150@brightrain.aerifal.cx> From: Linus Torvalds Date: Thu, 1 Nov 2018 14:24:26 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: RFC: userspace exception fixups To: dalias@libc.org 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 1, 2018 at 12:31 PM Rich Felker wrote: > > 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. Yes. And for just EENTER, maybe that's the right model. If we want to generalize it to other thread-synchronous faults, it needs way more information and a list of handlers, but if we limit the thing to _only_ EENTER getting an SGX fault, then a single "this is the fault handler" address is probably the right thing to do. Linus