Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp507425pxa; Tue, 11 Aug 2020 08:18:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysuLMCh0sfxcFRJqtVWs4y8SOHXB71Nbzj8Ql3/tYqpErzueGlZbeEV2BZercULzUxAPcF X-Received: by 2002:a17:906:7752:: with SMTP id o18mr26190480ejn.150.1597159113346; Tue, 11 Aug 2020 08:18:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597159113; cv=none; d=google.com; s=arc-20160816; b=lWLEr+igeof2E6fycygM8Tyzl2+XPSMTiN9miqJoafeGMI0yBuFdlbxlvvnxKT5cge XkNNL5/GX4vQP8sIa440eEz7lWn9tlqgZj7hMy/QGub+/Xu0/THGH9XpcrZQUUzsXfQe HRxipxi/WJTcTG+bj2ibxEHYKzIOcFSAn87VT7f3BTyYpi6DBSDCTzlX4F6KxRwtv6Au 60cQn++dfhsc+iq3kTLkPBRhtCvfFlNKGH4MY288av/aKZ7mOqBOJejw5uCfIVMFSnGq irHJw2ZYa5hA3WM3eCr3VLu7pqSzGoPtEV+vaXbpYjPTfYm22+uKdbsJOfrewNSV5Kgo A9Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=4+b6jTuGlXmVlD8HlgYNXs6m+RU4qSmvnoJzysAL5Mk=; b=LyxOlGAAk89PtC/0a95JS/CYaFmJqN9L7ZHjDO9yezBcDAJMJ+6d00vQQ2kqZVdxAg vD2FUS6183R9RpIu+9jv8Bzt8rT3O+XynhUH4Vs72nNT7nFo9P6T5cfejx5JWdc5BblJ +pOldX3w/JeP/Kh/Lk7AgaOTBKMxrJy+FFJyAgKeJyiNTJWzwmIGWZw050ehba9vIxQJ 1xDLgWDzqn6f/3whBrq8exiqBST/8yFjMwL7eGZGlQvJPDrRkKLW6FBPDIY5CymKw555 J71PBs5I6wF/KUljPa3lGrDBIqu5aS4NOFebewi3uKJ0xzsjBWPRGZn3SG7984qYAc0x DlnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=MeJLmJ95; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd20si8287750edb.217.2020.08.11.08.18.09; Tue, 11 Aug 2020 08:18:33 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=MeJLmJ95; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728903AbgHKPQ6 (ORCPT + 99 others); Tue, 11 Aug 2020 11:16:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728833AbgHKPQ6 (ORCPT ); Tue, 11 Aug 2020 11:16:58 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D639C06174A for ; Tue, 11 Aug 2020 08:16:58 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id c6so2033254pje.1 for ; Tue, 11 Aug 2020 08:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=4+b6jTuGlXmVlD8HlgYNXs6m+RU4qSmvnoJzysAL5Mk=; b=MeJLmJ951LLcL2CYfs/yQVJFJ9J1W90tNpCr6pOdQ/BpWwSx+Ygnz+mIp1sUtN2Qe7 y7anoGfMzcKvyBClLaMa7oGZb6Lt7kfONYPZ/HcOnqS+aqPRV/lQwLN9JXbbkiMcMCLS NNDiEAQi9844hRMKiySWxHblNXaOyP4qMba8TKnBQK4APNTo4QH72lfU0ZcnCE6eve5Q FVKvC/X2QTFbdgkzIUAuZiSoIXXazREopnJ6sJAOonAftUBBHw2K7ljG6pRiD2a9qNc/ h6YHn2mYxXnds0EWwdC/UfG2B0cy68DeWfvHicVk8SUPbbI2mMKCSqpSZJRpahdWvKl4 Q8Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=4+b6jTuGlXmVlD8HlgYNXs6m+RU4qSmvnoJzysAL5Mk=; b=ppQ6V5QLxMUB/oNpem9dHkQvt9mnRMEXzQC/FGmLze42vGl/ptZyl22fHfKj5vb93x mFdOP1WPF2PcXCnpg6x14S34kdYV/SIOkipK0jpaCQZe5WvxNAf6UhU7BXFL9FiLfmaT gaRdUFrvPkEPWnYfhx6+BkTksw5PMcJWif3z0ibLZaIjA1l4iV1fa8NwjH2pzrC857oH 0yzO1HPdPCb3PHvYqZ1g+QU3Eya/nALLy2EbNLU1UmqXhOZI4KDW28RqRnss9ofwhxxg v2fcMF19HCKvn+X710ADdtwWRr2TmN8t79D8X/HvQJCk2dmOfIFJ5z46k4qdreWI/qQq d5ww== X-Gm-Message-State: AOAM531vG1021Hx2X75zdtV+V0yR+AwiyjRTDYqxIXDl4DA1p2iimEFJ EJ/X6ow7soj7RRIQbyJ4k+Uq1A== X-Received: by 2002:a17:902:9a0b:: with SMTP id v11mr1398608plp.236.1597159017693; Tue, 11 Aug 2020 08:16:57 -0700 (PDT) Received: from ?IPv6:2600:1010:b06c:4273:ede1:e14c:cb3e:8ecb? ([2600:1010:b06c:4273:ede1:e14c:cb3e:8ecb]) by smtp.gmail.com with ESMTPSA id s22sm26039548pfh.16.2020.08.11.08.16.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Aug 2020 08:16:56 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v36 21/24] x86/vdso: Implement a vDSO for Intel SGX enclave call Date: Tue, 11 Aug 2020 08:16:54 -0700 Message-Id: References: Cc: Andy Lutomirski , Nathaniel McCallum , Jarkko Sakkinen , X86 ML , linux-sgx@vger.kernel.org, LKML , 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 , Neil Horman , Patrick Uiterwijk , David Rientjes , Thomas Gleixner , yaozhangx@google.com In-Reply-To: To: Sean Christopherson X-Mailer: iPhone Mail (17G68) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Aug 10, 2020, at 5:52 PM, Andy Lutomirski wrote: >=20 > =EF=BB=BF >>> On Aug 10, 2020, at 4:48 PM, Sean Christopherson wrote: >>>=20 >>> =EF=BB=BFOn Mon, Aug 10, 2020 at 04:08:46PM -0700, Andy Lutomirski wrote= : >>> 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. >>=20 >> Because the Intel SDK (and other SDKs?) wants to use the host stack to pa= ss >> parameters out of the enclave. >=20 > Ugh, right. I forgot about that particular abomination. >=20 > I suppose that passing a context pointer would be reasonable. The alternative would be to pass in a parameter that gets put in RSP before e= ntering the enclave. The idea is that the untrusted runtime would allocate a= couple pages with guard pages at either end, and enclaves using the regrett= able arguments-on-the-stack scheme would end up using the alternative stack.= At the end of the day, none of this really matters too much. Languages that c= an do inline asm but can=E2=80=99t do container_of() can get fixed or use wo= rkarounds.=