From patchwork Wed Mar 6 23:59:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 10842051 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 05850139A for ; Thu, 7 Mar 2019 00:01:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E748C2E9F5 for ; Thu, 7 Mar 2019 00:01:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAB6F2EA0E; Thu, 7 Mar 2019 00:01:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 845522E9F5 for ; Thu, 7 Mar 2019 00:01:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726558AbfCGAAF (ORCPT ); Wed, 6 Mar 2019 19:00:05 -0500 Received: from mail-qk1-f202.google.com ([209.85.222.202]:35192 "EHLO mail-qk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726537AbfCGAAD (ORCPT ); Wed, 6 Mar 2019 19:00:03 -0500 Received: by mail-qk1-f202.google.com with SMTP id 207so11648754qkl.2 for ; Wed, 06 Mar 2019 16:00:02 -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=RLZYCznt91X7Gql2FLJuA+D6Xq8z59q436/ddkparrE=; b=i/MjTXb7CbOG6UdkkS0vRNZvfV6iqT+SJUy26kVbxvGCwjfn8jRCtI1zQO9vj5H2ak apfgI4/baSkKebqMBSvCMvYYCd4lYbo5ztim2Tyika6/fTfhgxfiyzwCe6U8SXuxUH/A QMXQD8oXCYd6+d5dhpHO9MT8ekx8Nhcac8L3GeVKmleZ3xJNOFmMJqTs6o1aMOa/SvMi gfGhsbLGZLzEnc36jFQIkNfeaKcX77AgJBYVu2/DvzZJ1oXI4NCpFzcTHoMVU38SfSl7 DH+AH9U/Yw0/Mu1nSxhw0CQM0XKEcmhK6zNTjbEdD41qts+TJNBsuwJNo9oPQByKvGkt DkxA== 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=RLZYCznt91X7Gql2FLJuA+D6Xq8z59q436/ddkparrE=; b=uGjDYAnt9H4xM6LyquCzocjb90+oezhyQDJ8hxbFtL2xTTVlNqhxuSZYoHsu8lTSlI 2r1pQOV8LeEbne8KF7JbMdYcE5K1OE32DCSI59iQ6xZGc/ljC7kIreGjBxyrkWWD82FV OF081wnXSjC1Sxwuqx+lYNA8j72GxJ845Qwx9GaOZjU9+QeFV2QSzC46lPEO2Rm+nGOG lWGhbwDyXavk8xw2SjDYawqWbWHAEgUxVOkouQzq1IiuDp2INdao9roubBWf/XT3rye5 nO5v8Pml/TpNzfxfsqtouD5F6X/NH5F2EuOvJeuYK+EJh+/Rgb3mu9SwCxee6m32P5OU RZrA== X-Gm-Message-State: APjAAAWCqihGbnLJdz9qQB7bpL9fYGtUCfdwh+oJCzqp3ZyK6IIosx9a +YzQtWvslPUaUQzgE77/k1Fj2u5NglPpCz/U9eOk0A== X-Google-Smtp-Source: APXvYqyg65IJHTLLH/dejwTsjoNanUPirYo+pqDWCoJN7KCkY2ggEVBCzFT/3DLvioXGAP9kW6hrdz8OII58UGrorWamGQ== X-Received: by 2002:a0c:b91c:: with SMTP id u28mr5950718qvf.45.1551916802349; Wed, 06 Mar 2019 16:00:02 -0800 (PST) Date: Wed, 6 Mar 2019 15:59:00 -0800 In-Reply-To: <20190306235913.6631-1-matthewgarrett@google.com> Message-Id: <20190306235913.6631-15-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 14/27] ACPI: Limit access to custom_method when the kernel is locked down From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, dhowells@redhat.com Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Matthew Garrett custom_method effectively allows arbitrary access to system memory, making it possible for an attacker to circumvent restrictions on module loading. Disable it if the kernel is locked down. Signed-off-by: Matthew Garrett Signed-off-by: David Howells Reviewed-by: "Lee, Chun-Yi" cc: linux-acpi@vger.kernel.org Signed-off-by: Matthew Garrett --- drivers/acpi/custom_method.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c index 4451877f83b6..ac8a90dc7096 100644 --- a/drivers/acpi/custom_method.c +++ b/drivers/acpi/custom_method.c @@ -29,6 +29,9 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf, struct acpi_table_header table; acpi_status status; + if (kernel_is_locked_down("ACPI custom methods")) + return -EPERM; + if (!(*ppos)) { /* parse the table header to get the table length */ if (count <= sizeof(struct acpi_table_header))