From patchwork Fri Jun 19 16:49:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1313147 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 49pPtk2ztlzB4CB; Sat, 20 Jun 2020 02:50:22 +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 1jmKDa-0006jY-WB; Fri, 19 Jun 2020 16:50:18 +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 1jmKDY-0006if-5d for kernel-team@lists.ubuntu.com; Fri, 19 Jun 2020 16:50:16 +0000 Received: from mail-il1-f199.google.com ([209.85.166.199]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jmKDX-0006JZ-Ra for kernel-team@lists.ubuntu.com; Fri, 19 Jun 2020 16:50:15 +0000 Received: by mail-il1-f199.google.com with SMTP id k13so6820991ilh.23 for ; Fri, 19 Jun 2020 09:50:15 -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=TSJ7FgdSlcLrXkUP1iTzc3Bq+NQSlGqpIzrOM7M/JjemqH2sXHrA1kX7BVW3VlzbHs cEvOoL4Nq3irngokTn/KBX2k6U9ZkK4t1AqVPfwfvoeziM3jJz5hrBvRH17sMi1DxQT+ lkFvAtpf5cmLqfcNQs1mwsSSLlTaaMTGTiRSOXPnvrC/u2BdWjlCleuPblSIjq6gj0ft 2ohlFipnO97e42gTBllRK4j1W5FrGGjifSWLw5MDypRajuOjnORVTCPFovVft2xs+Bxq bOkCfa6aN/012YheRborUVybllQdwUsrAcrfBsbYRtLBd+IeGf3sDwc1ZyA7wFPHmb1I 6m7w== X-Gm-Message-State: AOAM533lRlgOilBPwVgHiAdoUO/WH24y2NXj8Kvrnuon3kZR2oYhz2oq GVDJg/ZYQIefIuivGDiqzXSwxj5BcJgDww/Tq8OiG5buo8u520rIbalvwhsAcaYxjAVKVqYehNz Hx+rQEtUbhWTQnMLQsNh/OMYT/JK8CFqkdfF1IRv8HQ== X-Received: by 2002:a92:8b90:: with SMTP id i138mr4694347ild.286.1592585414498; Fri, 19 Jun 2020 09:50:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8trqMdEEe2uEpgFGBexBQ86zQtQmZlZF8TYXKzkkQhhmerKj355sWXIY+O0ZR2Gu5zs/zQg== X-Received: by 2002:a92:8b90:: with SMTP id i138mr4694325ild.286.1592585414211; Fri, 19 Jun 2020 09:50:14 -0700 (PDT) Received: from localhost ([2605:a601:ac0f:820:f090:1573:c2fc:6389]) by smtp.gmail.com with ESMTPSA id 12sm3322421ill.30.2020.06.19.09.50.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 09:50:13 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 02/57][X] UBUNTU: SAUCE: (efi-lockdown) x86/mmiotrace: Lock down the testmmiotrace module Date: Fri, 19 Jun 2020 11:49:15 -0500 Message-Id: <20200619165010.645925-3-seth.forshee@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619165010.645925-1-seth.forshee@canonical.com> References: <20200619165010.645925-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");