Received: by 10.192.165.156 with SMTP id m28csp935159imm; Wed, 11 Apr 2018 09:30:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx49EvLIjkmV3PhqINhEOIBEaBNtz/KenbIK5VilzueP8VAz2D41LGElqwe7SuFNsyAOd7djK X-Received: by 2002:a17:902:209:: with SMTP id 9-v6mr5677068plc.403.1523464252801; Wed, 11 Apr 2018 09:30:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523464252; cv=none; d=google.com; s=arc-20160816; b=LsHotSwSqT4N1mlSGj6/b9T3lpzAdFh32tyZ3DVmPwgI+dKEgW3kc7af5aL0EQ4Zkc T0MlqkegpTdRZTp7c1nJAoLh2vDtIhm2tj0iRbC/rgGOlfvijCIKrFNrIy75q7grpChr vf5aeeTtBuMyH19pJ6zWQ1KCtZBsC1nirdMtYhiFg3LQI1SY0dey25b0OHeXE7A47ymU gYBFX6Z3FjVIOcqfXJaTRA9w3zdqAOL7wwvGFauEeK8ES3tcIP2J6OQ3sVMRykve3QD6 aG8zZozzPXL5603rxHWAb4YLzUbhJdK+KpkXquI5xHhw94GOEDtMekaI3Wmo8/IAzeHG BYDg== 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:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization:arc-authentication-results; bh=scjD3kJuyS9i5h+UMw3hik6i6oqlRNHHhvUGliIBnkc=; b=fZy8e9h8ms2M38OuSby5DkIzAvLw4uGR+K6RB8za0gY/70PRlgcbAhD+cDfKPyK9li B4vONNOrHpxH/9BFk644vzuXD52HC2I8wj7tsxCsrjjuV4lcwUDDBVueL7Vsztf2uYPO Aq8IFt5rUCfTuFXV1R2niqqpMu8ISYBidwWz1zJIdplXcJfFViSM+5rSpLn7g5PzteFI MAMC69jy1IoCbYZs+HTzm/PFKqN6aeSX431jRzF3STVJw4TVs6HBSjeGj11q2Qdf+xn/ 3ygMVBg3qbQhZPry649jBm6uBkyLV2Ych7yH9+ZyiCSm82FG06z5nyx40pA5Xe7fKiN4 FR8g== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f59-v6si1511335plf.38.2018.04.11.09.30.15; Wed, 11 Apr 2018 09:30:52 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754310AbeDKQ0s (ORCPT + 99 others); Wed, 11 Apr 2018 12:26:48 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42872 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754293AbeDKQ0o (ORCPT ); Wed, 11 Apr 2018 12:26:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06E66EBFE5; Wed, 11 Apr 2018 16:26:44 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-8.rdu2.redhat.com [10.10.120.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31C21215CDAF; Wed, 11 Apr 2018 16:26:43 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 19/24] x86/mmiotrace: Lock down the testmmiotrace module From: David Howells To: torvalds@linux-foundation.org Cc: linux-man@vger.kernel.org, linux-api@vger.kernel.org, jmorris@namei.org, linux-kernel@vger.kernel.org, dhowells@redhat.com, linux-security-module@vger.kernel.org Date: Wed, 11 Apr 2018 17:26:42 +0100 Message-ID: <152346400272.4030.10900275407737137506.stgit@warthog.procyon.org.uk> In-Reply-To: <152346387861.4030.4408662483445703127.stgit@warthog.procyon.org.uk> References: <152346387861.4030.4408662483445703127.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 11 Apr 2018 16:26:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 11 Apr 2018 16:26:44 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The testmmiotrace module shouldn't be permitted when the kernel is locked down as it can be used to arbitrarily read and write MMIO space. Suggested-by: Thomas Gleixner Signed-off-by: David Howells cc: Steven Rostedt cc: Ingo Molnar cc: "H. Peter Anvin" cc: x86@kernel.org --- arch/x86/mm/testmmiotrace.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/mm/testmmiotrace.c b/arch/x86/mm/testmmiotrace.c index f6ae6830b341..bbaad357f5d7 100644 --- a/arch/x86/mm/testmmiotrace.c +++ b/arch/x86/mm/testmmiotrace.c @@ -115,6 +115,9 @@ static int __init init(void) { unsigned long size = (read_far) ? (8 << 20) : (16 << 10); + if (kernel_is_locked_down("MMIO trace testing")) + return -EPERM; + if (mmio_address == 0) { pr_err("you have to use the module argument mmio_address.\n"); pr_err("DO NOT LOAD THIS MODULE UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!\n");