Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1887319ybh; Thu, 23 Jul 2020 22:01:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDTTogjuZRB/apFPunPcdczt7lyyPjHDj2MJsPiJuPSV2fvmwx2QMfFtzrdyPuZkf9OAad X-Received: by 2002:aa7:da0c:: with SMTP id r12mr5439479eds.109.1595566861453; Thu, 23 Jul 2020 22:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595566861; cv=none; d=google.com; s=arc-20160816; b=X5KPINYLkGywLPwTxdLwCk67/9q/7jpSaVvbd2nRiq2aSpjV7gWNPHNntsJj4NoLtp 9+qQYMj5qXvIz5aSmuudLZufp8g0svxxgk1y0nXc+o45tl3P7G2yGkS4S+SyD2G+lb3p aej4dCRh95avTwOIf25bqoDlAkYCbo+pAlXoJDxmmAVJEgqXd16FcfxZVx9LeI9gy4e4 gge3onueTqEhzOn2nadU9x2qC9lnVTrX3XJMfixYO6z6m1WEJXKxvhoAvue/JCVikRM/ PFiDNXdaefhqer7u51QMzX+oNMaLWCDmoNrQiwHXD11NcJHuLklxqdc/4rM8oB3w0izQ jRaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=MPwgMbVz1CDF0EJL/VYuk2wi1O5dfJSeFIknwD4w0Mk=; b=bVlzOp+cHx6Z7Ag5zLojU7YqjpOpRcwgXxalvYaJxum7FE3swh4JP+R6aNW6sIYYS0 6nPcdbzggzq/ymrlsshBpe1IuIe/UjFfnoY0xy464Sbo5kEH1eWnA2k64CpKNJiaSF2m 6sFir3Z2tZzOG2Xr9ryi2dRnmEoghTFH6u1FRutF6IBwwqzqcwfRF4PDM4Wze8B9ensm vPvFLUTvzIVwWWAr3gBNHIQqeC4d1RjBI3TIAC/lhDYpKoc2yR+Y+2UNfF/aA3Fj+HAj ckUWBMky/vVytjP+h8M5TvTHcWerQA9JlKksDd/MUnlOdgWeSda1RMMvYegXsMLXdxzj 0QCQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si3210703edb.96.2020.07.23.22.00.38; Thu, 23 Jul 2020 22:01: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726425AbgGXE71 (ORCPT + 99 others); Fri, 24 Jul 2020 00:59:27 -0400 Received: from mga06.intel.com ([134.134.136.31]:50157 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbgGXE70 (ORCPT ); Fri, 24 Jul 2020 00:59:26 -0400 IronPort-SDR: E2xWrqkz2PusAqgFOj2e6Pwj10Om/drmQ5q49rF8DblsNlSgIwfAVLMyT8nFbG6vflp5sTGCXi uOaixTYjf6yA== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="212194927" X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="212194927" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 21:59:25 -0700 IronPort-SDR: G/mTpInKuApwlEjdo00rNnm7/pfyN8Wew/pBQQDOY0qeufYk+75/a7EqO175m99nQcC3VK0kC7 +oF6h+BsWa1Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="288877678" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by orsmga006.jf.intel.com with ESMTP; 23 Jul 2020 21:59:25 -0700 Date: Thu, 23 Jul 2020 21:59:25 -0700 From: Sean Christopherson To: Dave Hansen Cc: Yu-cheng Yu , x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang Subject: Re: [PATCH v10 00/26] Control-flow Enforcement: Shadow Stack Message-ID: <20200724045925.GO21891@linux.intel.com> References: <20200429220732.31602-1-yu-cheng.yu@intel.com> <20200723162531.GF21891@linux.intel.com> <2e9806a3-7485-a0d0-b63d-f112fcff954c@intel.com> <20200723165649.GG21891@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 23, 2020 at 11:41:55AM -0700, Dave Hansen wrote: > On 7/23/20 9:56 AM, Sean Christopherson wrote: > > On Thu, Jul 23, 2020 at 09:41:37AM -0700, Dave Hansen wrote: > >> On 7/23/20 9:25 AM, Sean Christopherson wrote: > >>> How would people feel about taking the above two patches (02 and 03 in the > >>> series) through the KVM tree to enable KVM virtualization of CET before the > >>> kernel itself gains CET support? I.e. add the MSR and feature bits, along > >>> with the XSAVES context switching. The feature definitons could use "" to > >>> suppress displaying them in /proc/cpuinfo to avoid falsely advertising CET > >>> to userspace. > >>> > >>> AIUI, there are ABI issues that need to be sorted out, and that is likely > >>> going to drag on for some time. > >>> > >>> Is this a "hell no" sort of idea, or something that would be feasible if we > >>> can show that there are no negative impacts to the kernel? > >> Negative impacts like bloating every task->fpu with XSAVE state that > >> will never get used? ;) > > Gah, should have qualified that with "meaningful or measurable negative > > impacts". E.g. the extra 40 bytes for CET XSAVE state seems like it would > > be acceptable overhead, but noticeably increasing the latency of XSAVES > > and/or XRSTORS would not be acceptable. > > It's 40 bytes, but it's 40 bytes of just pure, unadulterated waste. It > would have no *chance* of being used. It's also quite precisely Well, technically the guest would be using that space :-). > measurable on a given system: > > cat /proc/slabinfo | grep task_struct | awk '{print $3 * 40}' > > I don't expect it would do *much* to XSAVE/XRSTOR. There's probably an > extra conditional and jump in the ucode, but that's probably in the > noise. I assume that all the CET state has functioning init and > modified trackers and we don't do anything to spoil their state. It > would be good to check that in practice, though it probably isn't the > end of the world either way. We've had some bugs in the past where we > accidentally took things out of their init state. > > It will make signal entry/return slower since we use a plain XSAVE > without the init optimization. But, that's just a single cacheline on > average and some 0's to write. Probably not noticeable, including the > 40 bytes of extra userspace signal stack space. > > I think that puts me in the "mildly annoyed" camp more than "hell no", > but "mildly annoyed" is pretty much my resting state, so it doesn't > really move the needle. :) > > Why the urgency, though? > > https://windows-internals.com/cet-on-windows/ > > ? No urgency, it'd simply be one less KVM feature for us to be carrying and refreshing. And as a sort of general question, I was curious if folks would be open to merging KVM support before kernel.