Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp35835ybl; Tue, 20 Aug 2019 15:09:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQGugACW0fG5YMNHuMbWvSTD660jN5JZjaZvhX4XK07rrDcPr5n6ZDP72xegkc2uW6jed4 X-Received: by 2002:aa7:91cc:: with SMTP id z12mr32354088pfa.76.1566338959948; Tue, 20 Aug 2019 15:09:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566338959; cv=none; d=google.com; s=arc-20160816; b=atqM9zp0mE7/n5FefsQncDyjQrXIJyCeuoHJapGpK0CX3yU/Kwd3HjSQ5gvmZi7yfy B8Y4T8eptbEPJRXtHw/oso9gW8ippVYZlat741O7nQJ3OBsqLFSKFItUoJsSnd/w0PDs 3AZrt2N/k0OIvdjVViYrWKNcW3UJ1TRyFhG1xQqpeY8jIuECKG2Xk8QV/5YJTInTqbOs jh8B7OkI+iD/edrCanAAVo3PdxYAcqIzXghP/Vt5nZQbKTbW89dOURgXjnub4GDPeTWA eBGzDkD0aYeCUqAth2oj/XsmRrMMA8afs7V4skVLrlI+JOb8umNyuy7S4qdAZSF0gmg+ lbhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=LfT5pr1ZUQvJNGEdGwnV9/RKpDB0FrkYAr8DLlWot8c=; b=iRKjAI+BAiGKHKHpUX+MsJOvAm9NnLVKDYozp5kTziDrSYvUIV46S045Jbr80RBqNu JeJYBJaCXw/cGk4bA16EXU5MfYCJcUm65AUUPRVfvD/vEB6/IeaaXY2RpIIRxHJpQxvz juA9PWZNfgCFRMZdqRjwz1sAhky1mcKxC14YmRie0fkGiwewWsgvblVXLk+wbIDj1Kn+ o4lKoBS24gOQzyu/g6Z0StQQqbg+s1dutj5Xhr+31rZ9/FoH6s8nHEeVw+yFalGILKw0 +Mp9Yqu+OEcQvk6Kz2xQhPAKIipzMOf9ZXBSiTxlKOBPAa2D+wwrQcDEgpqLDv8Aq+EB 3c/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12si823648pjq.60.2019.08.20.15.08.41; Tue, 20 Aug 2019 15:09:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730953AbfHTWHN (ORCPT + 99 others); Tue, 20 Aug 2019 18:07:13 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:48419 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730092AbfHTWHN (ORCPT ); Tue, 20 Aug 2019 18:07:13 -0400 Received: from 79.184.254.79.ipv4.supernova.orange.pl (79.184.254.79) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.275) id 3012fa65b7f729fb; Wed, 21 Aug 2019 00:07:10 +0200 From: "Rafael J. Wysocki" To: Matthew Garrett Cc: jmorris@namei.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Matthew Garrett , Matthew Garrett , David Howells , Kees Cook , linux-acpi@vger.kernel.org Subject: Re: [PATCH V40 14/29] ACPI: Limit access to custom_method when the kernel is locked down Date: Wed, 21 Aug 2019 00:07:10 +0200 Message-ID: <2669800.DxYg3DGudY@kreacher> In-Reply-To: <20190820001805.241928-15-matthewgarrett@google.com> References: <20190820001805.241928-1-matthewgarrett@google.com> <20190820001805.241928-15-matthewgarrett@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, August 20, 2019 2:17:50 AM CEST Matthew Garrett wrote: > 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: Kees Cook > cc: linux-acpi@vger.kernel.org > Signed-off-by: James Morris Acked-by: Rafael J. Wysocki > --- > drivers/acpi/custom_method.c | 6 ++++++ > include/linux/security.h | 1 + > security/lockdown/lockdown.c | 1 + > 3 files changed, 8 insertions(+) > > diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c > index b2ef4c2ec955..7031307becd7 100644 > --- a/drivers/acpi/custom_method.c > +++ b/drivers/acpi/custom_method.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > > #include "internal.h" > > @@ -29,6 +30,11 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf, > > struct acpi_table_header table; > acpi_status status; > + int ret; > + > + ret = security_locked_down(LOCKDOWN_ACPI_TABLES); > + if (ret) > + return ret; > > if (!(*ppos)) { > /* parse the table header to get the table length */ > diff --git a/include/linux/security.h b/include/linux/security.h > index 010637a79eac..390e39395112 100644 > --- a/include/linux/security.h > +++ b/include/linux/security.h > @@ -110,6 +110,7 @@ enum lockdown_reason { > LOCKDOWN_PCI_ACCESS, > LOCKDOWN_IOPORT, > LOCKDOWN_MSR, > + LOCKDOWN_ACPI_TABLES, > LOCKDOWN_INTEGRITY_MAX, > LOCKDOWN_CONFIDENTIALITY_MAX, > }; > diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c > index b1c1c72440d5..6d44db0ddffa 100644 > --- a/security/lockdown/lockdown.c > +++ b/security/lockdown/lockdown.c > @@ -25,6 +25,7 @@ static char *lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1] = { > [LOCKDOWN_PCI_ACCESS] = "direct PCI access", > [LOCKDOWN_IOPORT] = "raw io port access", > [LOCKDOWN_MSR] = "raw MSR access", > + [LOCKDOWN_ACPI_TABLES] = "modifying ACPI tables", > [LOCKDOWN_INTEGRITY_MAX] = "integrity", > [LOCKDOWN_CONFIDENTIALITY_MAX] = "confidentiality", > }; >