From patchwork Fri Jun 19 16:15:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1313064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49pP7j3yh3zB47H; Sat, 20 Jun 2020 02:16:33 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jmJgr-00026P-WA; Fri, 19 Jun 2020 16:16:29 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jmJgp-000251-BQ for kernel-team@lists.ubuntu.com; Fri, 19 Jun 2020 16:16:27 +0000 Received: from mail-il1-f200.google.com ([209.85.166.200]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jmJgo-0003ZE-Oz for kernel-team@lists.ubuntu.com; Fri, 19 Jun 2020 16:16:27 +0000 Received: by mail-il1-f200.google.com with SMTP id g8so6835117ilr.1 for ; Fri, 19 Jun 2020 09:16:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7+N/3IGNUElCMKhuqQh0YmGeJxPkGVioopUl579fCfQ=; b=GZX9YRNUxT1ES4X+ZOQmkYcYugH4T6Sug6zhkhVw1abqt31dH35LoMWJO1MPYDPHly 7a1FkeXAhq52ezhb/dgyBE6WlfYnLHPXQZ9LkWwsacGE/BEZJMn5vSW6OAZEhwzYKIJY djdSWIpxzxWp4hKvDQ+FEbk0Bw8cOWpAsivQTyjonzrg7M4CDqwAoiTFdB35tfBlH3H4 MkA86JVJ5GNyo/srcmnUrXxXOnAwVl8Tm3tIm1VLFmCuEbv1u3MDu/SYkWPgyFILJSwK ooh1/obdBhF+OfUL2pI69njX1KBIeMVtJiRY2uP8o2IWWRQ8uEzJ3qsi7yrEPCPSVo+w UYdw== X-Gm-Message-State: AOAM530mzBU0x8Y/UXfZxd5W/DmWGy1o6QUCr+c6iy9qaTJPg6nKQ1Dz iVtEWw8cvd+31eJDSoMo3M1nlH/CruzPqF6+zUpEVp8uCunLAp8BZQzhw3caUrlMKaYRIB7uszp m0ODC1f22MTswyROr/HKD/CuvBUPhQNASMF422vlDRA== X-Received: by 2002:a92:4001:: with SMTP id n1mr4373741ila.269.1592583385642; Fri, 19 Jun 2020 09:16:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDFBzd0nGJdQySGqCgUoBp5B/r7436cy+ROgJ82imrNPlllB4d6WKSy/U9OJoFy9v9NDMFfg== X-Received: by 2002:a92:4001:: with SMTP id n1mr4373725ila.269.1592583385429; Fri, 19 Jun 2020 09:16:25 -0700 (PDT) Received: from localhost ([2605:a601:ac0f:820:f090:1573:c2fc:6389]) by smtp.gmail.com with ESMTPSA id b73sm3641041iof.13.2020.06.19.09.16.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 09:16:24 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 02/57][B] UBUNTU: SAUCE: (efi-lockdown) x86/mmiotrace: Lock down the testmmiotrace module Date: Fri, 19 Jun 2020 11:15:26 -0500 Message-Id: <20200619161621.644540-3-seth.forshee@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619161621.644540-1-seth.forshee@canonical.com> References: <20200619161621.644540-1-seth.forshee@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: David Howells BugLink: https://bugs.launchpad.net/bugs/1884159 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 (backported from commit 64ce4fc1ef16d4dd818eca47701f803e58444ab2 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git) Signed-off-by: Seth Forshee --- 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 38868adf07ea..dd2a4ce7b541 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 (secure_modules()) + 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");