Received: by 10.192.165.156 with SMTP id m28csp992227imm; Wed, 11 Apr 2018 10:26:50 -0700 (PDT) X-Google-Smtp-Source: AIpwx4992bXH7XmyiwLMaawdhsYXdxjQqrYbXQM4esf2wYp/hRxJWaGmxMK8ipJtTfSRPHOMaZN7 X-Received: by 2002:a17:902:5497:: with SMTP id e23-v6mr6051922pli.308.1523467610767; Wed, 11 Apr 2018 10:26:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523467610; cv=none; d=google.com; s=arc-20160816; b=twxycYueQXVHkzoWfkXX5btB9i9GFW3EKY0nKWmUJePVDUpWP7ITS4hm2obLjv70HJ uyuTrnpGuAd/I7p8/jAWHqNmOCHj6MshygVQfQNoqVPUZJEjORg4UPOIM/rbxD9oQN1R TvbdOQHtiw0IyqdniowskFZGWwCkNvonkQZPxeAfjaJEVeEQkT1sEr2fbcYS4Rc92WWf +OvPQwwpR9cdbOlN1IHfBYr5OiefZdRFMDOQbB8I/b47eDMfdZ6ZtcRQ8UwHJNq/8GJz 11riO+qQyrGL1G3A/DF5dJRWaNakMvay5OernBzK5CTDwcNH+ABXD6bfrElQWWY6hMTt H8Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=XvowMrlK4GH2qKNi9mhJqDd/DJT+yY9jbR97vPGPIVM=; b=Y1CUaPBeAApAGBuhZAeTEjCIM51DeiaPey8g9SjSLdyngztzuFd515Buz5egeoa+g/ BibCGx8Ry02DtjE3KFQ2ekQBRXEbdTGlElthVCSu+UWFZ1OFW6gWGyVhFYs3Hg+OSE8Z zXcuw6fTCJzEOxpqVLu4QlevXFro1Fbu/mAUSvXrM7Ro1EJ9ol4MjtgsNqC2szxoIb8Q 9eyhqaMcRqJ/WBf8P4kbEqjyUwLRH1cY32pAT3nidbn+sFk0Dk1BWJkd7InmRfwScLLA pN+lh9K+9Xuz0XhSI4v24A5MQcX12GKoSzsVVRBm8bUVybXxvXFG9Ii34sQYhpyTWmip larA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=e4M4+Z3m; 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 b89-v6si1560721plb.262.2018.04.11.10.26.13; Wed, 11 Apr 2018 10:26:50 -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=e4M4+Z3m; 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 S1753955AbeDKRWv (ORCPT + 99 others); Wed, 11 Apr 2018 13:22:51 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:35112 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753227AbeDKRWs (ORCPT ); Wed, 11 Apr 2018 13:22:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XvowMrlK4GH2qKNi9mhJqDd/DJT+yY9jbR97vPGPIVM=; b=e4M4+Z3maIogmyjf7laJ156PL lk/LdlnFdRdeogFdfT3W2tDvJIVj0t2VkATFBEVQSqVs74NtpkcIIUdazTuB8kUJD5cirIpzdlqtB xcy3/PUFbX/Ds+deGJOv81aKHLIztRbG0G+pBFSxKibfS4AA/FsrXHuYpG1Fh3dyi+5RY48/8bk/F T8Nki9bguvV2zESRO/8f8PBLZ5TRoJvrce7+M8UyWkGv+fAY9dAwW7SBCWu3Q3ou05ZxRXKqrPjc1 lDOFrHUl8LziG5yAJV0BIdFDPOmqy4S0X+s8o1QU1Oj+gtbyN0psjtBuLtOwP3GPLiApAMWNAG5x3 JG/O+vIig==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1f6JSJ-0005t0-Et; Wed, 11 Apr 2018 17:22:47 +0000 Subject: Re: [PATCH 18/24] Lock down module params that specify hardware parameters (eg. ioport) To: David Howells , torvalds@linux-foundation.org Cc: linux-man@vger.kernel.org, linux-api@vger.kernel.org, jmorris@namei.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org References: <152346387861.4030.4408662483445703127.stgit@warthog.procyon.org.uk> <152346399627.4030.8043878470312297727.stgit@warthog.procyon.org.uk> From: Randy Dunlap Message-ID: <17b6d3ad-367c-be6f-40d8-a9f60c7edae3@infradead.org> Date: Wed, 11 Apr 2018 10:22:46 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <152346399627.4030.8043878470312297727.stgit@warthog.procyon.org.uk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/11/2018 09:26 AM, David Howells wrote: > Provided an annotation for module parameters that specify hardware > parameters (such as io ports, iomem addresses, irqs, dma channels, fixed > dma buffers and other types). > > Suggested-by: Alan Cox > Signed-off-by: David Howells > --- > > kernel/params.c | 26 +++++++++++++++++++++----- > 1 file changed, 21 insertions(+), 5 deletions(-) > > diff --git a/kernel/params.c b/kernel/params.c > index cc9108c2a1fd..2c08c4aa376b 100644 > --- a/kernel/params.c > +++ b/kernel/params.c > @@ -108,13 +108,19 @@ bool parameq(const char *a, const char *b) > return parameqn(a, b, strlen(a)+1); > } > > -static void param_check_unsafe(const struct kernel_param *kp) > +static bool param_check_unsafe(const struct kernel_param *kp, > + const char *doing) > { > if (kp->flags & KERNEL_PARAM_FL_UNSAFE) { > pr_warn("Setting dangerous option %s - tainting kernel\n", > kp->name); > add_taint(TAINT_USER, LOCKDEP_STILL_OK); > } > + > + if (kp->flags & KERNEL_PARAM_FL_HWPARAM && > + kernel_is_locked_down("Command line-specified device addresses, irqs and dma channels")) s/dma/DMA/ Other patches use PCI instead of pci, CIS instead of cis, MMIO instead of mmio, BPF instead of bpf, MSR instead of msr, etc... > + return false; > + return true; > } > > static int parse_one(char *param, -- ~Randy