Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4702921pxa; Mon, 10 Aug 2020 16:14:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyghRK/FLDar8D9r9p4+UnMHN5ukuuTMn6RDwuLS8vhVm6UNYU2WkVpoN4ZwkfwkrM1S8TM X-Received: by 2002:aa7:dc4f:: with SMTP id g15mr23681815edu.335.1597101277748; Mon, 10 Aug 2020 16:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597101277; cv=none; d=google.com; s=arc-20160816; b=LVXKadF+3QvLinYSE4GPbEHbrw1IRHNXvuyOxr2MIQGQWKVKfwAByvy8we4cnuzp0f FW+0oAXIP0KKfdSk0Eq2ECOmtu3G9Im7oF2dnekMB8OGkoyFVxDREmNYnFbhL2g0qSEq MAMJyKHdQUPvP4hkmNcFfvg5L+RYXDukCvQaDdysh2ml/y/1K+cdUNJJ14pTtM7XeLTv 8kk41TVC4oSbTe4NkXeUi2n6HNd5Ntjzx+pY9yidcWVPPlVfkUEGrYFbik1eImQ6GkDZ vKxcgXVO8s2Y2u0HFYtLfaTMJrppYrp3TrRBvQ9Kwl21Qm6gAgR/EAAtFx4ghS7Pbre1 /YFQ== 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=81Z6HfT04Kr+bLlNZz5ciwOz+fiQV43LKiHTNEQvSvI=; b=mO6tcaS+rWcMGdvapzemRQWioCCJTnhMyq9oIX525Mn2cb0SIdwMLyZUDvHsfWvTY2 7WjcvMzLfCNAHWpVtFHuUnnl79dXvGLUPMh+Wujy8MOKU+pKxhRDInKkZHInNUSXn7Fj NvFtPMnnkMRKbY/fOUTmZ6DsbFdj/m5t9BA4tCKZ+YUltZKGjepgD4vJ9ebQkFSUz02Y 6cU4D+fFdu19ss8hqTzHL4j5ijdqpxiJS8ncFkChfjCri9NljJHcUKyZGKf9cRoclAOR Vvdzhu+/Ar0Gt5wDkA92KeCELcS8UsYsjO9kg3XEvvL8a3fNRFS+t5wc7yBseDTXAM0i bv6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Yv2lQ6Ja; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o18si11276371ejx.472.2020.08.10.16.14.09; Mon, 10 Aug 2020 16:14:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Yv2lQ6Ja; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727031AbgHJXJB (ORCPT + 99 others); Mon, 10 Aug 2020 19:09:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:44698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbgHJXJA (ORCPT ); Mon, 10 Aug 2020 19:09:00 -0400 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E934D2083B for ; Mon, 10 Aug 2020 23:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597100940; bh=KN3dKAif49xXoXcIYO2KHMhCVpVKygWXi9GX3lGZE0Y=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Yv2lQ6JaL4P4RZ6DPgVE31ayJe5xrgq8e/gkNH27Ne/wxDKwqPT7kq7bgthZb2324 lEw+IH7M/ObVNPZdmg3XuvXjJHghj2lvECJhX5M0PTcJY1RU2cHyGjEAvVfdVxynFu o179kJE3HAZitPXghelbc7zm8zomnZc/oNMUqjL8= Received: by mail-wm1-f46.google.com with SMTP id c80so978787wme.0 for ; Mon, 10 Aug 2020 16:08:59 -0700 (PDT) X-Gm-Message-State: AOAM531XMzrIWkVYiT+WL/BKp9sHXUFBb5wkAatXgoR+4S7bedWDl1J4 xOmk11bpBlBfSxsseGNS7hKmar2TQORR0VFEtcz/SA== X-Received: by 2002:a1c:4c17:: with SMTP id z23mr1361940wmf.49.1597100938325; Mon, 10 Aug 2020 16:08:58 -0700 (PDT) MIME-Version: 1.0 References: <20200716135303.276442-1-jarkko.sakkinen@linux.intel.com> <20200716135303.276442-22-jarkko.sakkinen@linux.intel.com> In-Reply-To: From: Andy Lutomirski Date: Mon, 10 Aug 2020 16:08:46 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v36 21/24] x86/vdso: Implement a vDSO for Intel SGX enclave call To: Nathaniel McCallum Cc: Jarkko Sakkinen , X86 ML , linux-sgx@vger.kernel.org, LKML , Sean Christopherson , Jethro Beekman , Cedric Xing , Andrew Morton , Andy Shevchenko , asapek@google.com, Borislav Petkov , chenalexchen@google.com, Conrad Parker , cyhanish@google.com, Dave Hansen , "Huang, Haitao" , Josh Triplett , "Huang, Kai" , "Svahn, Kai" , Keith Moyer , Christian Ludloff , Andrew Lutomirski , Neil Horman , Patrick Uiterwijk , David Rientjes , Thomas Gleixner , yaozhangx@google.com 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, Aug 6, 2020 at 7:55 AM Nathaniel McCallum wrote: > > In a past revision of this patch, I had requested a void *misc > parameter that could be passed through vdso_sgx_enter_enclave_t into > sgx_enclave_exit_handler_t. This request encountered some push back > and I dropped the issue. However, I'd like to revisit it or something > similar. Why do you need an exit handler at all? IIRC way back when I suggested that we simply not support it at all. If you want to call__vdso_sgx_enter_enclave() in a loop, call it in a loop. If you want to wrap it intelligently in Rust, you don't want a callback anyway -- that forces you have an FFI (or non-Rust, anyway) frame on the stack, which interacts poorly with panic handling and prevents you from using await in your Rust callback handler. If, on the other hand, you just call __vdso_sg_enter_enclave() in a loop, all these problems go away and, if you really want, you can pass in a callback in Rust and call the callback from Rust. What am I missing? I still don't really understand why we are supporting this mechanism at all. Just the asm code to invoke the callback seems to be about half of the entire function.