Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp848552ybb; Wed, 8 Apr 2020 11:04:54 -0700 (PDT) X-Google-Smtp-Source: APiQypIcUD6kBZP2d5DCfKd6ZpWmwKMYFDmffUsmL5QIfiWx1k/QKvD53+wDNDXjGdR59ixF1QOH X-Received: by 2002:aca:1c02:: with SMTP id c2mr3287586oic.125.1586369093650; Wed, 08 Apr 2020 11:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586369093; cv=none; d=google.com; s=arc-20160816; b=IxIaMwAzm24yN31MCndX6LnRKRzgf5VN4TWSplnEqD3bHH2MmBEC+7JcJiSj0rsR7C GbxOlVytecw7zuSci92kNamw201zOcNSRuTCsdnU0XVl8RVXhnVxhlal2RHAcvgH8cHW XPHE8yk3ysilt0upmVkDxWJTCKfxi58cNwwMagJjYj70HWruVItggh7rIq+JO/OlTz3Y xNUGFW4T6Ct63B8oDjpI0AO+P4VHhlo6ox2gF6yc9JDsaVobXMz/yaCqMAd7Np82KeWM s42B6HensmPM447b47VHoOsUbZPQS6SqNiBiiOaCi67iIZs4goxawASQAKz65087VT77 KBCQ== 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=8xYNN+wKtG+ahrHZwD0DDVsv1W5vGn54JqpHjXfqqyc=; b=bt5y3cy34DiIjatAFyozOLVdW0qyZgYrbjUmTuF4fB4006M8i0bD6mE5nefW3nT1zf TDMny8zVQKmCNpConosdNoZew5fpBxyF5obfCPiKtLRjZ+4g6LeiPJEI4QFD7DjjiolT u2rsNYcMXqTdPoptQIP5YLZZ5RRjQL/yxzz6icw7UsPQIY2LbtxmOHpENKgx64/WDd5z T2lWf15Qk9BXNvM6gLqAzHGSOqEBpim6oEHHag2e9ScbGRWkEWBiqNOhEwW3NykfLJuG E8JpljLLeGBppBECapLi0O4zeVl8JzR1Ug2VwcFnARi0RQ1xQlLukBejXRryBDPfVJ92 MBnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nBnAI1h5; 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 97si1747454otq.185.2020.04.08.11.04.33; Wed, 08 Apr 2020 11:04:53 -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=nBnAI1h5; 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 S1729413AbgDHPqK (ORCPT + 99 others); Wed, 8 Apr 2020 11:46:10 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:32966 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728237AbgDHPqK (ORCPT ); Wed, 8 Apr 2020 11:46:10 -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=8xYNN+wKtG+ahrHZwD0DDVsv1W5vGn54JqpHjXfqqyc=; b=nBnAI1h5JZbVh0bzFq4v4cBe1E eIgpfCksH2tE5emWi5BJLjf1URk3Kox/T/E/sYKMeqoEJ8JepKnBMQ0aX/QdwTEx9R1cqYS69TWkB RoRqN93eTJH3BbjmOQiGJBnsDC6CwQ8W+WoP2+YxvXvl/RBajpmA1kACL8mZ3fhR9wFxXgEzh5zxI oAifATzDlzeQesklCrGRf4LdPNxO6NJPieHLQ1FLGa/F//IVqxxZTImx13HGABvcnYFzJbdfbDdaM oVRBaiDEI3m55gKCnTeYQMLAm6tkVtRufL9bvWARR9/ZHVWNSmYl+kyUdoe1CT9r+4YUPj6DW6i/b WJHEZlJQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jMCtu-0006ad-Fi; Wed, 08 Apr 2020 15:46:02 +0000 Date: Wed, 8 Apr 2020 08:46:02 -0700 From: Christoph Hellwig To: Peter Zijlstra Cc: Steven Rostedt , tglx@linutronix.de, linux-kernel@vger.kernel.org, hch@infradead.org, sean.j.christopherson@intel.com, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, kenny@panix.com, jeyu@kernel.org, rasmus.villemoes@prevas.dk, pbonzini@redhat.com, fenghua.yu@intel.com, xiaoyao.li@intel.com, nadav.amit@gmail.com, thellstrom@vmware.com, tony.luck@intel.com, gregkh@linuxfoundation.org, jannh@google.com, keescook@chromium.org, David.Laight@aculab.com, dcovelli@vmware.com, mhiramat@kernel.org Subject: Re: [PATCH 4/4] x86,module: Detect CRn and DRn manipulation Message-ID: <20200408154602.GA24869@infradead.org> References: <20200407110236.930134290@infradead.org> <20200407111007.429362016@infradead.org> <20200408092726.7c2bda01@gandalf.local.home> <20200408154419.GP20730@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200408154419.GP20730@hirez.programming.kicks-ass.net> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 08, 2020 at 05:44:19PM +0200, Peter Zijlstra wrote: > On Wed, Apr 08, 2020 at 09:27:26AM -0400, Steven Rostedt wrote: > > On Tue, 07 Apr 2020 13:02:40 +0200 > > Peter Zijlstra wrote: > > > > + if (insn_is_mov_CRn(&insn) || insn_is_mov_DRn(&insn)) { > > > + pr_err("Module writes to CRn or DRn, please use the proper accessors: %s\n", mod->name); > > > + return -ENOEXEC; > > > + } > > > + > > > > Something like this should be done for all modules, not just out of tree > > modules. > > I'm all for it; but people were worried scanning all modules was too > expensive (I don't really believe it is, module loading just can't be a > hot-path). Also, in-tree modules are audited a lot more than out of tree > magic voodoo crap. Scanning all modules seems safer. While we're at it - can be move the kvm bits using VMX to be always in the core kernel and just forbid modules from using those instructions entirely?