From patchwork Thu Apr 4 00:32:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 10884641 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 2C41417E1 for ; Thu, 4 Apr 2019 00:33:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C20B28913 for ; Thu, 4 Apr 2019 00:33:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 102882893D; Thu, 4 Apr 2019 00:33:31 +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 B69BD28913 for ; Thu, 4 Apr 2019 00:33:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726978AbfDDAda (ORCPT ); Wed, 3 Apr 2019 20:33:30 -0400 Received: from mail-vk1-f202.google.com ([209.85.221.202]:47892 "EHLO mail-vk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726880AbfDDAd2 (ORCPT ); Wed, 3 Apr 2019 20:33:28 -0400 Received: by mail-vk1-f202.google.com with SMTP id l11so433781vkl.14 for ; Wed, 03 Apr 2019 17:33:28 -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=aQw0KGeWmvPzPQJC9aCiMXHo5RCdIiAFpbvhdBtqfOA=; b=HrnnfxtEOmZgJzYuk+1NGAEVH3FcUFjd6/CBWrK13gcpvb388nqYaCopTOLyHeiL1d BKx8619edH1V2dmHSMJXG+k3mIUlblQzV2u/zO0e4fFTXaPhYH3qkk2oBZtOPkDf/pMH c54kprWqcu9bnxwX2huhYfWI0NK19dx+cOTVdTShh6O9RpDn5d1CRWLTj74UYSVkLfjk m9UNjHC3gaOX9OtPbO5zNNbbdyPtrCAFi3EKo2W41SCPOU88rp2S8NL6uCUmQdKvJubH 3qMyUCCEogMiavG6CtQUFSXB3/s/iNE8LHMbqsYvZCIifSgPCsE7EMCoYzlvMPlip49W ZGow== 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=aQw0KGeWmvPzPQJC9aCiMXHo5RCdIiAFpbvhdBtqfOA=; b=jkR4zNdgN8DKGb1KvtqSMWb1GSFVWZSBYTvAd3JiWrJJ0aDSYHTegVErtbfJU1VCKU BF2B/k7VuQo3bUq5z3Pk9Ta6t8CsHR5VB+fo6/TIP/8J8v7Pk44A/9+WBd8UiQHmGdIe tLPXhH6mK0Z0hhvQcR2JA5r6qcxBbEF5pKXVmcwzVhviCtUSMZxYJayPUPVP1C2nJ42y 7mCWSfmM47kg7fLiJE6lBArRuKnqZwV+RHOrRCNwUIoaPym95Kn21bzegRxn22Glu07D oHc9j6DMkH5iR/ywagbsyJHZZHgzVw/Hn7j76KUCNdirmjMmVRXEJXxAKpeDmAntkJLY p6PQ== X-Gm-Message-State: APjAAAWevtz9SHDLpIsUxJavPeNda3EXYq2/hdTWxLSoVxUCF51LQfKx qIlyfFU24GfRU3i/FRfmwJZGDbBsBqRldSfAheBVFQ== X-Google-Smtp-Source: APXvYqwn9uDV4QCW3Ysw0OeGe8fuj1O+mbnQ+p5+YyWGjXPdgos0oC1yx4GJVCZSHMnrpHBueWMml8CLMI4YTuAGQGSUpA== X-Received: by 2002:a1f:9010:: with SMTP id s16mr372950vkd.12.1554338007705; Wed, 03 Apr 2019 17:33:27 -0700 (PDT) Date: Wed, 3 Apr 2019 17:32:35 -0700 In-Reply-To: <20190404003249.14356-1-matthewgarrett@google.com> Message-Id: <20190404003249.14356-14-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190404003249.14356-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog Subject: [PATCH V32 13/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, linux-api@vger.kernel.org, luto@kernel.org, Matthew Garrett , Matthew Garrett , linux-acpi@vger.kernel.org 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 cc: linux-acpi@vger.kernel.org --- 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..37de3cd84493 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", LOCKDOWN_INTEGRITY)) + return -EPERM; + if (!(*ppos)) { /* parse the table header to get the table length */ if (count <= sizeof(struct acpi_table_header))