Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp681884ybb; Fri, 3 Apr 2020 09:52:45 -0700 (PDT) X-Google-Smtp-Source: APiQypLiGt0fklO26vfeG0siNGFTECrcJFntwzrnOMGYXft+KSC9RinjvQTdeETCm2wNDS/ANyWM X-Received: by 2002:aca:d78a:: with SMTP id o132mr3815328oig.60.1585932765270; Fri, 03 Apr 2020 09:52:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585932765; cv=none; d=google.com; s=arc-20160816; b=SCldX1mpVHPA50p77Nfo3rZwnYMiepqbgVRC+d4vOLtLGMdOs5jynFSUaMjltBK26l Jn9NhrYzVp/GK+Qx1vil1oIDtaD8129hVnjRMvuONSw+4csW2ex526EnESZOFllzvLGs IoLIhw0FmdEwTem1q0SAlCqQl77pKYH/F0X79awZ1zyyx65GyJsFGlcnVhx/mQ1VLr2v Fq3cHSJE+wHbdcloNZCcvpsjQPhlqvVQNwUYGViEe9uzG6jEeSd9wVrjxjG/sf54s3tl 559PKmUFxeMiayFI3GtVhhi32WeGWk7dlGVdp3IjCTkFsTdxZr2ll8UFbtpKvg7Ko0O/ kHNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=rCLFvCf+m9AQcUMsEViDfMMZ61HancBMIQ+B0f38hwE=; b=WtFhVu+LcdxwV5alwu57YQFYMn/PMDA9IU5eOjNY95dqqRDF+YXbxP4udO5O0MwUQs Yi+zBVS2OqaSOqza0Gdq4SgPiyPqLxZ27uZQ0nCdnLmB8CtogvO/DNYR+jwutAsoWv4a dGMCBCB255GrupYio+T30XM4Q81vIMmsyi//WnngzGywwfRSKD1k8tTY9PQrsWt4zct5 FfhhRuhJIiEB2bVj0Vhd/VUc08tjV5Cx+fQU5I/aRdfq+y6bfCoPlcTu8qtSH5iKhPMM D8zyVwKPeMXhKWL810Kaf4V7fiOe3mG54rqSpK6Vza723JTdYanUa/JhHvZdBrKBewd0 oEGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=L4HJOJg8; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f20si3417012oop.54.2020.04.03.09.52.32; Fri, 03 Apr 2020 09:52:45 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=L4HJOJg8; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404553AbgDCQlP (ORCPT + 99 others); Fri, 3 Apr 2020 12:41:15 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48650 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728381AbgDCQlP (ORCPT ); Fri, 3 Apr 2020 12:41:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=rCLFvCf+m9AQcUMsEViDfMMZ61HancBMIQ+B0f38hwE=; b=L4HJOJg8qdSciDfEaRb6a6iGmC KwZQ7usQIKmDiS0kZarn+KftK1fRP7p/eZx4gmvp6gC1HSEUdKg5MxESOGeYmvwp3EqElS0HaA3hf uhos+dW7ZXvvsb6RBembrNuBbFRGJVbhCLIhT5xQh693i9h2VAJkItU0zZ0M7o/HX5Fltdj9+GjLi 57bChgE3OpcyL3Ka/SfA2c5434MO12GZ5psKsoaKVD3EJMKFMJbFjAUPGBLOF8HxP7daIcg5KNC6B QNZc6csT5nHuwWlaQpb3SXx/QITalXrRIqap1XND4ziU0sR+L/hd9sqVXU6Zx8K+lhaYqhlJgkel5 Eo1gjG8Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jKPNM-0006st-6o; Fri, 03 Apr 2020 16:41:00 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 90E603010BC; Fri, 3 Apr 2020 18:40:58 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 80B3E2B124BEE; Fri, 3 Apr 2020 18:40:58 +0200 (CEST) Date: Fri, 3 Apr 2020 18:40:58 +0200 From: Peter Zijlstra To: Sean Christopherson 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: <20200403164058.GX20730@hirez.programming.kicks-ass.net> References: <20200402123258.895628824@linutronix.de> <20200402124205.242674296@linutronix.de> <20200403143459.GA30424@linux-8ccs> <20200403152158.GR20730@hirez.programming.kicks-ass.net> <20200403160156.GA2701@linux.intel.com> <20200403161205.GT20730@hirez.programming.kicks-ass.net> <20200403162555.GB2701@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200403162555.GB2701@linux.intel.com> 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 09:25:55AM -0700, Sean Christopherson wrote: > On Fri, Apr 03, 2020 at 06:12:05PM +0200, Peter Zijlstra wrote: > > On Fri, Apr 03, 2020 at 09:01:56AM -0700, Sean Christopherson wrote: > > > 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: > > > > > > > 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? > > > > And then you're hoping that the module uses that and not: > > > > asm volatile ("mov %0, cr4" :: "r" (val)); > > > > I think I feel safer with the scanning to be fair. Also with the intree > > hint on, we can extend the scanning for out-of-tree modules for more > > dodgy crap we really don't want modules to do, like for example the > > above. > > Ya, that's the big uknown. But wouldn't they'd already be broken in the > sense that they'd corrupt the CR4 shadow? E.g. setting VMXE without > updating cpu_tlbstate.cr4 would result in future in-kernel writes to CR4 > attempting to clear CR4.VMXE post-VMXON, which would #GP. Sadly the CR4 shadow is exported, so they can actually fix that up :/