From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757340AbbCMVjt (ORCPT ); Fri, 13 Mar 2015 17:39:49 -0400 Received: from cavan.codon.org.uk ([93.93.128.6]:60976 "EHLO cavan.codon.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757175AbbCMVjp (ORCPT ); Fri, 13 Mar 2015 17:39:45 -0400 From: Matthew Garrett To: linux-security-module@vger.kernel.org Cc: james.l.morris@oracle.com, serge@hallyn.com, linux-kernel@vger.kernel.org, keescook@chromium.org, hpa@zytor.com, gnomes@lxorguk.ukuu.org.uk, Matthew Garrett Date: Fri, 13 Mar 2015 11:38:22 -1000 Message-Id: <1426282708-21485-7-git-send-email-matthew.garrett@nebula.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1426282708-21485-1-git-send-email-matthew.garrett@nebula.com> References: <1426282708-21485-1-git-send-email-matthew.garrett@nebula.com> X-SA-Do-Not-Run: Yes X-SA-Exim-Connect-IP: 72.253.89.114 X-SA-Exim-Mail-From: matthew.garrett@nebula.com X-Spam-ASN: Subject: [PATCH 06/12] acpi: Limit access to custom_method if trusted_kernel is true X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:54:46 +0000) X-SA-Exim-Scanned: Yes (on cavan.codon.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org custom_method effectively allows arbitrary access to system memory, making it possible for an attacker to modify the kernel at runtime. Prevent this if trusted_kernel is true. Signed-off-by: Matthew Garrett --- drivers/acpi/custom_method.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c index c68e724..774bb7b 100644 --- a/drivers/acpi/custom_method.c +++ b/drivers/acpi/custom_method.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "internal.h" @@ -29,6 +30,9 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf, struct acpi_table_header table; acpi_status status; + if (get_trusted_kernel()) + return -EPERM; + if (!(*ppos)) { /* parse the table header to get the table length */ if (count <= sizeof(struct acpi_table_header)) -- 2.1.0