Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp678579ybb; Fri, 3 Apr 2020 09:49:08 -0700 (PDT) X-Google-Smtp-Source: APiQypL129YezPH3vK5xYiYnutdk+BGgSLRWyQ4+HGqHko4A8X09TYv4tYxlUBSQ4nNtwiLZz1eT X-Received: by 2002:a9d:2aca:: with SMTP id e68mr7356809otb.324.1585932548348; Fri, 03 Apr 2020 09:49:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585932548; cv=none; d=google.com; s=arc-20160816; b=rAJOCpb8l/20OeXlIypCtakikP6xkp9ajVwfLPobUri3d0KVTtZlvQqAwuDgxatzAx JvxkVdjFV46fFtB9NaksIvVNtD/6vNqw8iHiEgqw+EpanMFoJYz8p4M+wideiv+BKgTe ode938t2Urw4ljAFfXWMTYW0sSAf7EpC4B2TnnejR7bdt3UHFBxgVnaFboy+opMNlriI iNCWluQrpUxfSozvlKLqX4ezZ3AXERh8zObVlWyDxj9rqKgQ2/4zQR6WmTJKMyWOwAAN VmPqwwsfQuWNQPg1iaqlARk/4VSKvqzkcA0dxFfihNwAvoZo612CEcUAKWD0ZXAZhgEC 36VA== 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=DZ9JzVwsE+zJgSCdAHeqNAcFgdO3wp6x208T69H0AOY=; b=Jc6Mp+R1U4WPZ/u8mB14yMjHjKMLSfYHtW5gml2c+PRxN4W8dHDVXqnmk13CMXrkXo pFOHe9t89VIrDaBp/Y+svvp831HpvgNJ4/teGKJ/IfeFd6pYoM5iJGMF7FVoaFbada9Z 8jmTdwg+/hOHi83qe+iJLM30N873VkyNy3mxl9DAUeraEuP7VhyFoYkStTTBZ5WdQzX5 bCptE5fanVFa8wwYzRnOmn2wmC0pB41EY7nT8YKQx4G2PYB4rNi/u+5P4Jlb6YQFL2GU 3kX/xLm3yq2TDk0kqE05eJMwbRTfGJPewc3w265OiSeUHpmwIkLcBnag71xfB9X4XoSg 2OxQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4si3995829ote.265.2020.04.03.09.48.53; Fri, 03 Apr 2020 09:49:08 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728229AbgDCQB7 (ORCPT + 99 others); Fri, 3 Apr 2020 12:01:59 -0400 Received: from mga03.intel.com ([134.134.136.65]:20821 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727989AbgDCQB6 (ORCPT ); Fri, 3 Apr 2020 12:01:58 -0400 IronPort-SDR: AW7VDaQyxwa2FRUI1BwQq7jhebS4UJQhk2/G8LrJIDltZCcRT2Ux6/PqQY4n4LJnue8bSGQEto GYJPGjcKPmeg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2020 09:01:57 -0700 IronPort-SDR: ZYF7vSUKoEZ0onMJvLxjxmphdI5P/HoUSBfnGLfHfD50TjfKzPwPB3EtEqkm+P+x5dtQLwdvBs RfhgEbzkt37Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,340,1580803200"; d="scan'208";a="450070894" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by fmsmga005.fm.intel.com with ESMTP; 03 Apr 2020 09:01:56 -0700 Date: Fri, 3 Apr 2020 09:01:56 -0700 From: Sean Christopherson To: Peter Zijlstra Cc: Jessica Yu , Rasmus Villemoes , Thomas Gleixner , LKML , x86@kernel.org, "Kenneth R. Crudup" , Paolo Bonzini , Fenghua Yu , Xiaoyao Li , Nadav Amit , Thomas Hellstrom , Tony Luck , Steven Rostedt , Greg Kroah-Hartman , jannh@google.com, keescook@chromium.org Subject: Re: [patch 1/2] x86,module: Detect VMX modules and disable Split-Lock-Detect Message-ID: <20200403160156.GA2701@linux.intel.com> References: <20200402123258.895628824@linutronix.de> <20200402124205.242674296@linutronix.de> <20200403143459.GA30424@linux-8ccs> <20200403152158.GR20730@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200403152158.GR20730@hirez.programming.kicks-ass.net> 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 Fri, Apr 03, 2020 at 05:21:58PM +0200, Peter Zijlstra wrote: > On Fri, Apr 03, 2020 at 04:35:00PM +0200, Jessica Yu wrote: > > +++ Rasmus Villemoes [03/04/20 01:42 +0200]: > > > On 02/04/2020 14.32, Thomas Gleixner wrote: > > > > From: Peter Zijlstra > > > > > > > > It turns out that with Split-Lock-Detect enabled (default) any VMX > > > > hypervisor needs at least a little modification in order to not blindly > > > > inject the #AC into the guest without the guest being ready for it. > > > > > > > > Since there is no telling which module implements a hypervisor, scan the > > > > module text and look for the VMLAUNCH instruction. If found, the module is > > > > assumed to be a hypervisor of some sort and SLD is disabled. > > > > > > How long does that scan take/add to module load time? Would it make > > > sense to exempt in-tree modules? > > > > > > Rasmus > > > > I second Rasmus's question. It seems rather unfortunate that we have > > to do this text scan for every module load on x86, when it doesn't > > apply to the majority of them, and only to a handful of out-of-tree > > hypervisor modules (assuming kvm is taken care of already). > > > > I wonder if it would make sense then to limit the text scans to just > > out-of-tree modules (i.e., missing the intree modinfo flag)? > > It would; didn't know there was one. Rather than scanning modules at all, what about hooking native_write_cr4() to kill SLD if CR4.VMXE is toggled on and the caller didn't increment a "sld safe" counter? Partially tested patch incoming...