Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3380801pxk; Mon, 28 Sep 2020 16:26:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkk2swMjRuTM99SJibB3MdAdqWsNtzr8jSMZhmAV86+8P+CK/WqUY35S8cvR3VtRmV9Q89 X-Received: by 2002:a17:906:4553:: with SMTP id s19mr1022749ejq.475.1601335561535; Mon, 28 Sep 2020 16:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601335561; cv=none; d=google.com; s=arc-20160816; b=h6u4cULnKS0bwrsA90Mr/Iw6V8tzSg9Qc4zTrcjgHUah8exOyHM6z0hZ9ZdESNtFsK 2uQdTGaMFRLuSHipqyY1eAKP/DQOwGgXlzmGbBEowrVHTOq4lcAPHV+mD0mJ4d90gzIS coWnCTU2V7iGEKtB6SWPR8ac9rI98tSAxzSMadKLutH1iNm5g/moCj7vVvs/SwWWk236 VRLHgASlomM2M+eok3J6oUiBTA5aTy83hgD3PsST5spJ2GPxGardaA7rvk7tRoAbiDAA hAo609vQf3pR42zsjLVqKJ8B53c7a4qbn3JdkP5rMItQl+qfIq5mG3vaIXZRl86iICFR YQhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=WmjaI77wIiBxRTu9CB7oXbI/4kUwVvfMy0fhh/RayEo=; b=MXSDWdFvVpzvlo97TC9R9dQqN+8Foc2lQdSTlw/CyVeEsh7AwzlIYokgs/JoI5ARTg zKXw4ouzd3PXNzEv9Z7vdNnWbLmA23351LmTrkiBQIiMkmSh5eD9Qa+RrkLlMuXO0RL2 +zWcEXU8F2Ql//DetsmCQl6vLmIc2vPQtFx9CtUxYfxVcQHIY45Ee2mNcAQPrSPgyKf0 6z0ejVEO4e7D6xGN7f2pUyLyd7LOJW57wxybkeNU+u7tAPA36zFIDXB5uTc3XuuyJs9z pDkNAy4d7n4InqCaKmYngCao90ApwDNwO0d6QouUh+Fx0ohjgNjy8dKbxWV1Oa0BvTbX lwuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XwR9ZMkk; 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 bk4si1503485ejb.215.2020.09.28.16.25.32; Mon, 28 Sep 2020 16:26:01 -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=XwR9ZMkk; 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 S1726993AbgI1XUc (ORCPT + 99 others); Mon, 28 Sep 2020 19:20:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:42858 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726588AbgI1XUb (ORCPT ); Mon, 28 Sep 2020 19:20:31 -0400 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 A9CDC23A53 for ; Mon, 28 Sep 2020 22:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601332903; bh=x2tvT8zp4CBxz7nAU7LyLPETPAu+I6Ua1JlXWrtLOZc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=XwR9ZMkkVVVNDXHVZhAWwbAlYL1AAfNYuCx7h76iO4c8ztLASeIBjrxF/Mg2SmcG6 l0cWmvYm4VE0zX7XQDoyAvAriPxZ25isZicW7ARvykXKG+MKMUZ6ZUZWTjfcNKgEPM OG021ETZXOOvH+XIoyiHF8shBFvL4xLdF+gRWcag= Received: by mail-wr1-f48.google.com with SMTP id c18so3034636wrm.9 for ; Mon, 28 Sep 2020 15:41:42 -0700 (PDT) X-Gm-Message-State: AOAM532LZw3SPyexY2nSiUX4e6UJUQ9HmyhKSsQG6rN/VHGtR/X4hERO bNBLs4s+jYiFD6pN+794ouQCfZCpucWHMiI+CH2OtA== X-Received: by 2002:adf:a3c3:: with SMTP id m3mr704595wrb.70.1601332900365; Mon, 28 Sep 2020 15:41:40 -0700 (PDT) MIME-Version: 1.0 References: <20200915112842.897265-1-jarkko.sakkinen@linux.intel.com> <20200915112842.897265-22-jarkko.sakkinen@linux.intel.com> <721ca14e-21df-3df1-7bef-0b00d0ff90c3@citrix.com> <20200928005842.GC6704@linux.intel.com> <85bc15d5-93cd-e332-ae9a-1e1e66e1181d@citrix.com> <20200928215635.GF2705@linux.intel.com> <24b9f250-0f75-1a7d-688d-787ca53b388c@intel.com> In-Reply-To: <24b9f250-0f75-1a7d-688d-787ca53b388c@intel.com> From: Andy Lutomirski Date: Mon, 28 Sep 2020 15:41:28 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v38 21/24] x86/vdso: Implement a vDSO for Intel SGX enclave call To: Dave Hansen Cc: "H.J. Lu" , Jarkko Sakkinen , Andy Lutomirski , Andrew Cooper , "the arch/x86 maintainers" , 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, "Huang, Haitao" , Josh Triplett , "Huang, Kai" , "Svahn, Kai" , Keith Moyer , Christian Ludloff , Neil Horman , Nathaniel McCallum , Patrick Uiterwijk , David Rientjes , Thomas Gleixner , yaozhangx@google.com, Yu-cheng Yu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 28, 2020 at 3:18 PM Dave Hansen wrote: > > On 9/28/20 3:06 PM, H.J. Lu wrote: > >> I'm open to do either solution. My thinking was to initially do things > >> vsgx.S local (i.e. consider ALTERNATIVE post upstreaming) and use the > >> above solution but I'm also fine doing ALTERNATIVE. Dave kindly briefed > >> on details how that thing works and it should be perfectly usable for > >> our use case. > >> > > Since SHSTK and IBT are enabled per process, not the whole machine, > > are you going to patch vDSO on a per-process basis? > > No. > > Retpolines mitigate Spectre v2 attacks. If you're not vulnerable to > Spectre v2, you don't need retpolines. > > All processors which support CET *also* have hardware mitigations > against Spectre v2 and don't need retpolines. Here's all of the > possibilities: > > CET=y, BUG_SPECTRE_V2=y: does not exist > CET=n, BUG_SPECTRE_V2=y: vulnerable, use retpoline > CET=y, BUG_SPECTRE_V2=n: no retpoline, not vulnerable > CET=n, BUG_SPECTRE_V2=n: no retpoline, not vulnerable Just to confirm: does this mean that the CPU mitigates against user code mistraining the branch predictors for CPL0? Because this is the vDSO, and the situation we're actually concerned about is user code mistraining its own branch predictors. This could happen cross-process or within the same process.