Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3663578img; Mon, 25 Mar 2019 15:13:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOvslOxC8d+P15KZh2dstYNtJeudmsMt+05sQN9Jw7b0lxeHDCu3z3Q2fQDgJFWQwKZcEc X-Received: by 2002:a63:54b:: with SMTP id 72mr24985938pgf.323.1553551985719; Mon, 25 Mar 2019 15:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553551985; cv=none; d=google.com; s=arc-20160816; b=zOaTJBOvY7SP5NYB9cRlCioopb+dah9WiSI7iA/hdc4tjQZXXx6ZjF+v3TO7BY2V1+ iK6mpRWSw5zczgFJf2D5gKvN/Si/UHwoFWrl2iO+HTaPq7gKG0CWeKFBvU7WflTIFGR3 HFx2+H/fI153Zg4hS7XH3HsAbx5oHHuGD1EiPYSuKNJIczVAHx3dUEIbFvNg+/PzKaBY CCmz7K0tzR4tDmfMNwxxKFBlenyJZg+UK+NWz/cZwrBStSPKSQolTT1IW4uaiSXUI0KS b+Q9ThXDqxEaOAH2CMNVdbr+OokV55D6tpJf9hx9kNJ5XtKIzdHwXTsu4zwGc4Aoq5JW k0cQ== 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=WIYErqKuw8M4x3DY6l/FyYzixwb10M5/VPpKJUswY2U=; b=eTms2IvUjCjj7UnC9Umj2CoQ36m0XzvZBESbn77M3lt8VeCqCG3fmA8DaDmSOBN2mW /f8xbn7Uczc2lqnCsjfiE+4oU25AT8OSNA+KD9iUjhv12+uo8xFc9PYZ5onY4Vi+dKSk uBdQOyPltkNuqeYmg+aCKThb6ZTWsY82OEN6yNhP1wOw+WkrSqIoEarWLumlNWiEoxiD i8vcAS4mRVFnCSG46BWLT9L2IDrUy1wPlVBOOteIbelKzaudNy72ntgmtU3HpDYaDKVW ZQJ7J1iaxr6qGqZ56UilyqCD4duKJagpCOe2V4vl0NzqSJCabgDR5dhuys5Ij00nSCIk 0VlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hpB5lrCx; 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 w3si3669451pgr.189.2019.03.25.15.12.51; Mon, 25 Mar 2019 15:13:05 -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=pass header.i=@google.com header.s=20161025 header.b=hpB5lrCx; 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 S1731146AbfCYWKx (ORCPT + 99 others); Mon, 25 Mar 2019 18:10:53 -0400 Received: from mail-yw1-f73.google.com ([209.85.161.73]:38956 "EHLO mail-yw1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731117AbfCYWKv (ORCPT ); Mon, 25 Mar 2019 18:10:51 -0400 Received: by mail-yw1-f73.google.com with SMTP id p1so16055322ywm.6 for ; Mon, 25 Mar 2019 15:10:51 -0700 (PDT) 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=WIYErqKuw8M4x3DY6l/FyYzixwb10M5/VPpKJUswY2U=; b=hpB5lrCxLRgzsbFkoUuenQDO6lEUzGh6NLvKA42UxU+AGaIXIjJE+xcRp+e/ZOInqG x7oBxQiIyt0Jr51SRzdjcAfkWutI6bY1d+giGLhZZMY6zF7D3Dq3jK4cHupG4miI9Ozt Dq7meYBrTo9DDUqob4RK3zVwZflAN5Cfi8BrCfLVpZMqpuTXP0q49E9QxEAQllrodIqn G6Qar+TYGLbgnUi+tum0fy/urAULLofT7wZ/OnBAyMMjOOLn/P2Ur5Kp6fw+NeMAVuUm sxvbYg2Op3Rj9WUwJJ590ShWho7Yn3yc6YZFn0EPTL7xnlnGsim/gEJbpwsFab/V+mUa EDqg== 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=WIYErqKuw8M4x3DY6l/FyYzixwb10M5/VPpKJUswY2U=; b=cpPPAJ0GkRjTnnWOMEg3L1bw6sT951Y6hvxbe3OUjxAFjmYDZiWK6C1f9KAHUhvBco SABdTuzy5sIIel871MqKLBDmDVrLmzPifuc8k7JBUZObEbwcqBDGNHfmk7w4kq+C9jvn rpaVnfiy3Vvx9wTfio4r82r3EA2HHx0bkDpI+P1mg5P/JwSzKRAK8+ZCsBERwjG1W9zh k/IdCWwRTg/5fVJEFYsBV8vGPJRKOiNdFRAydhU3xf545dZzDYvAjwNABsGP+tV9+qsh 9OhE4OpMQAajNPsIZRITk6cxa6+9jw06Tg+yzyWE6Ilg8VETpaLpEZIXFAM1AVCog/Dr gZXw== X-Gm-Message-State: APjAAAWycxMpM6LKg8QkNj27ujKbtIpB7sbKyBx/ojNXUW8S2gcr3P8A gskGGVCSxLJ7Mz4+o8N3u+gJOcaAAv6sqeTFFOt2vQ== X-Received: by 2002:a5b:8cc:: with SMTP id w12mr4545500ybq.113.1553551850650; Mon, 25 Mar 2019 15:10:50 -0700 (PDT) Date: Mon, 25 Mar 2019 15:09:47 -0700 In-Reply-To: <20190325220954.29054-1-matthewgarrett@google.com> Message-Id: <20190325220954.29054-21-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190325220954.29054-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog Subject: [PATCH 20/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, Thomas Gleixner , Steven Rostedt , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Matthew Garrett 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.392.gf8f6787159e-goog