Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4527612imb; Wed, 6 Mar 2019 16:01:59 -0800 (PST) X-Google-Smtp-Source: APXvYqzNUoeSnrSDlJVzMebMWVc2Yevjnp2UDgevd6q9pctlo5kyliWfeaqix5wT7VZ1erK+Ci6W X-Received: by 2002:a63:c04e:: with SMTP id z14mr8598048pgi.20.1551916919478; Wed, 06 Mar 2019 16:01:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551916919; cv=none; d=google.com; s=arc-20160816; b=LpZt9HMQ0FohA6UBxgM92Krjt42A3fHx/K+lvDkk9DezY84tl2hD7QKzwctWmpGz/w NALvDcWECpi3YOHfzVM+YnCXg3pDmbyS8xeyMOHPorQUlyEeWwNmDhwK58mvCD34XRPC 7hm1yDcE/FggGuCplGRNjTSyKl5qwBu8jgL53Tyc7EQcgMVnEFef37b06ifQ/sg8KuDz SMo+/zG8+IxvMHXm53Knhpn94L4RQMmYELq/W1ObxlvmNn8uv1cNgY+dSB5BJWZLU/sO GAC6XxCuQlRzpQzBSJyu3C0+0+3IxDqDgDDhOrpJJSpIur2sTxvhlHD3YQYTobMLohsj bydA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=Slizqb5/EuTPaUwcXF3KMpeQ4PrQTQCbKq0uAOfUYTM=; b=eCR1aJNldOxljma6VhJUZIX7SYS8Yzx1gx/s520O9DJSPWI26i4VU4vfH9hAe+3eft DAaq8p/+WqhpsjQcbqXEjIrYSITYYouAozo2nCaCB8GYFH9256wQr/s5gfG/k82oRd/7 aoe+/Po3hw6NEYgvQyPiJu5UnB+CzHUUM6FTK42kxNC4r7xK3HzirNLjUXMQ648cWB2Y lnqJ6eqeHyPfrwIziS/x9BYbRX6KLcNqngO+g5xGbqh9fMsFQeZ/yWDUffeeh60Jsd4m u7oTh9T6CMU4IAX0XIJwySqln6y0aLojW4KyyPmYJ+hKSqtLFRgnTPbupFTAlNhEpO0c OkSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oDpvVEqX; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x17si2728915plr.435.2019.03.06.16.01.44; Wed, 06 Mar 2019 16:01:59 -0800 (PST) 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=pass header.i=@google.com header.s=20161025 header.b=oDpvVEqX; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726685AbfCGAAZ (ORCPT + 99 others); Wed, 6 Mar 2019 19:00:25 -0500 Received: from mail-pf1-f201.google.com ([209.85.210.201]:42575 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbfCGAAW (ORCPT ); Wed, 6 Mar 2019 19:00:22 -0500 Received: by mail-pf1-f201.google.com with SMTP id p9so15436498pfn.9 for ; Wed, 06 Mar 2019 16:00:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=Slizqb5/EuTPaUwcXF3KMpeQ4PrQTQCbKq0uAOfUYTM=; b=oDpvVEqXJpIrSthsVtrG1ShhFNsu55AnYk1HsI+XwYF/iW9kwSA2kBAvPZw+7yQjfw vzSxG4bd1r2co7712oCcMqt74ttgVvINiMXH2LrnEfxsC4EDf5f61m15hsOZGc8wurdo z6ZJHSMjH/LZX7w3vZkraygwiuGz5NTi58N3Acqfjmle8xv12Sll71j3ifjGa63q/qlQ gchCUqX0bdhLA2vxyqg9QdSl6LJ/vHnekwBmOl8If6OxlO2ffb/B1kyfZHeRiHVFHwfz eRYI39TbxMswh6rAd0+mFAm9dDOPwVdoNwsAl4QTQpyBtiPMO+KPc50P2B8V0cHzf08F IMuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Slizqb5/EuTPaUwcXF3KMpeQ4PrQTQCbKq0uAOfUYTM=; b=mOZ1TFw4aa+/lYaJHxUrK9jmOEdTXxEY5oixHI2+UMstv8iJqkPjPkSELfUdIKFE8r DOJNM13APj2nsplMfpvh+RneeJSUdNTDcn/1UfqLb62MXnUygGY0pX+X/d0b6trPOgPo ru7GZ4Ne3CGatiTaWbLARdpIWjKImVJJry8t8t44j26RL/hAkIc8LTp/AHwm9zoNZrzN LXe4+uYbtjx4orJsR/I1sahUK6YOzQ/5LjrsdFKmgS1Y/geBYRf/z/XygbEbYn9CBb3T jJLwBNMofob+7Rm4NBgDWyAI+WIwiTeeN740cZZX5YhNUxWYrCymY1kDRpXdk3YEGH0K GEqQ== X-Gm-Message-State: APjAAAWulwTlc0mFVugu6RILQUXnDDxOETV/iYuubOppuQBz/hYdMU8N 7t6oxXBw2gqiQHz4pCZYV3ITB2HGW5bp2SapBRA4UA== X-Received: by 2002:aa7:8215:: with SMTP id k21mr3854968pfi.78.1551916821402; Wed, 06 Mar 2019 16:00:21 -0800 (PST) Date: Wed, 6 Mar 2019 15:59:07 -0800 In-Reply-To: <20190306235913.6631-1-matthewgarrett@google.com> Message-Id: <20190306235913.6631-22-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190306235913.6631-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.21.0.352.gf09ad66450-goog Subject: [PATCH 21/27] x86/mmiotrace: Lock down the testmmiotrace module From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, dhowells@redhat.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Howells 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 Signed-off-by: Matthew Garrett --- 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"); -- 2.21.0.352.gf09ad66450-goog