From patchwork Fri Jun 19 16:16:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1313127 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 49pPBt3yN9zB47t; Sat, 20 Jun 2020 02:19:18 +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 1jmJjV-0004V0-7m; Fri, 19 Jun 2020 16:19:13 +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 1jmJhx-0002zS-H5 for kernel-team@lists.ubuntu.com; Fri, 19 Jun 2020 16:17:37 +0000 Received: from mail-io1-f70.google.com ([209.85.166.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jmJhv-0003lI-0A for kernel-team@lists.ubuntu.com; Fri, 19 Jun 2020 16:17:35 +0000 Received: by mail-io1-f70.google.com with SMTP id b3so4900971ion.17 for ; Fri, 19 Jun 2020 09:17:34 -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=roBK7cpLNQtrnpZr2CAYrqD8UQ+4lo5VUZHRSmMqhRM=; b=B+P7zlDgw55S+4LW3aW6ipSIjphJuq+UJixN9+2bzX2XhBkMmvbL5a7xSzUSHQXbR0 IiJTTqoIj5+7zQfRu4DYQg0KPXerBTUqWd517jciy4xTUKjvlh7UyOTVABdRYbFn4b7d SY6zA3DXmKZeCvSQoWA9NhxEdR0YrTN3AFFRjPoglCnIwojsfhRKk2KCBjivOBaMOa59 5tHov+VU6chnLBywPGYaWPQcghQ25uIV13AwElTlTROyy17V3rldyiyEwurDSNtjKVOj pOBIsOMyY9V0Rr3zIXq6DXZUDQNmqRiwU+QOPGLVGc1qhJdLPiCMNiZqKy2R9hDcakIk rc+Q== X-Gm-Message-State: AOAM532nNj/k3v66ZFaOPDiPdpCHJqyfkCJFi42KzOx647M2eS7x5mJ1 hLSeHeEkEHBM+A9Ch/z84qwyDWpgHKcL4pc3RrQfXKX1NHeBkWqWSDsJokOJrV/NOpJYABkpKe2 FCKkJFFGakh98UbVdK0aVQNKCAxUtm891cox6MjfiOA== X-Received: by 2002:a05:6e02:eee:: with SMTP id j14mr4365894ilk.261.1592583453865; Fri, 19 Jun 2020 09:17:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3yVTa3WhZwE+fRCp7cv3Pc6ECZS9XvncwwaagGcfl87luLnfUgmjszg8gn/4bqi/nbKLhjg== X-Received: by 2002:a05:6e02:eee:: with SMTP id j14mr4365873ilk.261.1592583453655; Fri, 19 Jun 2020 09:17:33 -0700 (PDT) Received: from localhost ([2605:a601:ac0f:820:f090:1573:c2fc:6389]) by smtp.gmail.com with ESMTPSA id r2sm3060956iop.34.2020.06.19.09.17.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 09:17:33 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 57/57][B] UBUNTU: SAUCE: (efi-lockdown) debugfs: Disallow use of debugfs files when the kernel is locked down Date: Fri, 19 Jun 2020 11:16:21 -0500 Message-Id: <20200619161621.644540-58-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 Disallow opening of debugfs files when the kernel is locked down as various drivers give raw access to hardware through debugfs. Accesses to tracefs should use /sys/kernel/tracing/ rather than /sys/kernel/debug/tracing/. Possibly a symlink should be emplaced. Normal device interaction should be done through configfs or a miscdev, not debugfs. Note that this makes it unnecessary to specifically lock down show_dsts(), show_devs() and show_call() in the asus-wmi driver. Signed-off-by: David Howells cc: Andy Shevchenko cc: acpi4asus-user@lists.sourceforge.net cc: platform-driver-x86@vger.kernel.org cc: Matthew Garrett cc: Thomas Gleixner (backported from commit 125da2e1c5d0a6aca5faafba336c8e8506a4e000 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git) Signed-off-by: Seth Forshee --- fs/debugfs/file.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 592059f88e04..98521a791504 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -106,6 +106,9 @@ static int open_proxy_open(struct inode *inode, struct file *filp) const struct file_operations *real_fops = NULL; int srcu_idx, r; + if (secure_modules()) + return -EPERM; + r = debugfs_use_file_start(dentry, &srcu_idx); if (r) { r = -ENOENT; @@ -235,6 +238,9 @@ static int full_proxy_open(struct inode *inode, struct file *filp) struct file_operations *proxy_fops = NULL; int srcu_idx, r; + if (secure_modules()) + return -EPERM; + r = debugfs_use_file_start(dentry, &srcu_idx); if (r) { r = -ENOENT;