Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp728896ybb; Wed, 8 Apr 2020 08:48:12 -0700 (PDT) X-Google-Smtp-Source: APiQypIFMg+cAil1NULeou2yIncKegFYaFMhujVZOKHLbpLdeG2vlz2HG0tLHSip2s3SK8OTnTQ1 X-Received: by 2002:a4a:db7b:: with SMTP id o27mr6428016ood.25.1586360892798; Wed, 08 Apr 2020 08:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586360892; cv=none; d=google.com; s=arc-20160816; b=PsbvXJE0U964aI5DhRQVODyBooLyO2RDd8YXWXVsuB1+ZOeWvlGN+UMFCRJUUdQtkV iEGIGM/V6Wesn695pi+2ynQEB3aLLYCCDxa28R2ONW4s2UTR7dTgimCc6znCgjcWZIM8 GF8S28KvhhrjIT9HHkeRRKW9yVnwJCabFcHC9nDrCLxIpVpSH1iby2pudtF2npt29xB+ VfD1axgwx2BkxZ+kVDql6MTAQmrk1aDTsjuIWpeodPO0T6l+r/y0mQdQEdAw1R6MPvEV TnXWf0QUEN0ClCC4dM7IUTY/ZawGFO/frRB1USlTES/nvIVotTlLOlcxauZOnOyQLii0 xFgQ== 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=ppT9Ykb6WfAeBTRHeKGYVk4EuqKRhEhhBG8VE/vcqL8=; b=wCoTMQ1bVf+badmAiubqpIuzDVJbUwYyKmZjvqFN1k2euX4jF0hOyTvs22d2Bhtygi 5D+hJf5V9K9fX3yJVXNx3B/Cva9aPNMZPm3LAh1IIpdlPBQlZdSeL/+Xlh8B4DLdd7ho oM4aXd73aAV0EVEd0CwzPohmeYf4j9Fqwf2GWs3e19cmGB3sKj7aeMXPHguvmXsAlKj/ b6RmEsetvsyawLRnwLpe6fUJpZ32qhFpqd174Dn7k0MndLFiWVHWdcN7FZ7SbutPQk6h hd7i1MkjlRKIkCSRFaZGMLi+ZomJyLGc0kdgxgoVRxpxZimvapgY88GFaSOTelADz+Yl uAWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=R0wHbzYD; 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 j14si2525414otq.271.2020.04.08.08.47.47; Wed, 08 Apr 2020 08:48:12 -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=merlin.20170209 header.b=R0wHbzYD; 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 S1729536AbgDHPot (ORCPT + 99 others); Wed, 8 Apr 2020 11:44:49 -0400 Received: from merlin.infradead.org ([205.233.59.134]:48108 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727933AbgDHPot (ORCPT ); Wed, 8 Apr 2020 11:44:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=ppT9Ykb6WfAeBTRHeKGYVk4EuqKRhEhhBG8VE/vcqL8=; b=R0wHbzYDjjMG6dRZnnupQjheVq HvshbrGTRhbE1F8xdaOc3ISQiDGFZhbZcDymD8jQuMvp7L6a+s84/5bhFj5Ecr/A8Qnau+aGL/8Yz OdGoLCG+1ZKIgaS6Gdbwr7Gzq2ThReSWafrlRo6LjYkZ58lo4Jx+zcySTD0xnFk1EDxdSO/GrxOzS Z3taGGdw95wiGGz/+y8/R8ERQPTvKrTVKBgC/QNnPPYr0tzwgkEmJPeSLWBMongJZdiuUfXFY4VyE yuhlE7pankKznwbNYzHEitnQ+b3pc9jI3YVNZ9Gcbd9g3l0AaoF5DpLMgHfc1Q/Y72D5X3b8WPso4 vxI84hUA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jMCsH-0005kk-Rv; Wed, 08 Apr 2020 15:44:22 +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 3D186300130; Wed, 8 Apr 2020 17:44:19 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 21A8E2BB026FE; Wed, 8 Apr 2020 17:44:19 +0200 (CEST) Date: Wed, 8 Apr 2020 17:44:19 +0200 From: Peter Zijlstra To: Steven Rostedt Cc: 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: <20200408154419.GP20730@hirez.programming.kicks-ass.net> References: <20200407110236.930134290@infradead.org> <20200407111007.429362016@infradead.org> <20200408092726.7c2bda01@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200408092726.7c2bda01@gandalf.local.home> 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 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.