Received: by 10.192.165.156 with SMTP id m28csp934412imm; Wed, 11 Apr 2018 09:30:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+YiziI6kbk7A4f4aHPcPb37DQZ3Oa+L83Rg1iFBUU9HQcxsrRY7zJlCobkUPYcn4utpTIq X-Received: by 2002:a17:902:bd8d:: with SMTP id q13-v6mr3177231pls.330.1523464218647; Wed, 11 Apr 2018 09:30:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523464218; cv=none; d=google.com; s=arc-20160816; b=Ple0wwE2ZjrvldDMzQyvDn2zTb6aef5nuYqiQyV0t+SZm0G1gMo+0In9Y7mQhaJ/ZP Ig9IMItBTOO0EdCOP5mGATyWSya6UuSd2xxGmT+QMon7/6cgELEEyvmqottbSYMAS/9p mDorWcDeZEGbJLZSGJ7tgX+lX4/frbIIvZJUQO5DSHaXYiynpe6ZXlJP2/Tyzw6vC4WG vabJKRu8Pw3oc64NVWTUE8til44Y2GIZbVv9tmDbfww5L6JZxO97ABBmlmt0nu7vRgiO VDS4wN03uOae9iKqFYiknNNWKkPxd/FdwBomq1euKp0zD4H6G3+TMYbeTRwzyy4FVCUd uDkA== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization:arc-authentication-results; bh=I+jir+e92bHBEfxaVqyTawhUWPelV09D1Kg4FjshS70=; b=gBJvlW0NFwUQ9CRCPzW1QxitrrXIJSBBcraYjZ+omLqnwlAsCh8ccEC9RhxZ2RVnJa ytRLmfzUv894aM2FD9c/LSXnY8BAV6EJFMrYJIe+qr6LzIqyNzmRdVoIGoMFPl699Q98 dHol37gqId2tzBahfpivO/2CJUQkREn1ofTXsemgP7Qhdyt7FcRR0auiZ+O8afHuS/px QUtjO3S6mh1r94w2kqD35RW0rW9SbXJFAkp91sNKv2KQpkEq3oKV2rLIGySPi59VGj2r jobIMovml7dLGJKW3K9tbTYbhlOJqG/Mitk5NUPXFwZtc1Ai30ihav0y2K7FmsroN8vF o63A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q6-v6si644083pls.457.2018.04.11.09.29.41; Wed, 11 Apr 2018 09:30:18 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754174AbeDKQ0C (ORCPT + 99 others); Wed, 11 Apr 2018 12:26:02 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54358 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754146AbeDKQZ7 (ORCPT ); Wed, 11 Apr 2018 12:25:59 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF044406F890; Wed, 11 Apr 2018 16:25:58 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-8.rdu2.redhat.com [10.10.120.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 272A110AF9E0; Wed, 11 Apr 2018 16:25:58 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 12/24] ACPI: Limit access to custom_method when the kernel is locked down From: David Howells To: torvalds@linux-foundation.org Cc: linux-man@vger.kernel.org, linux-api@vger.kernel.org, jmorris@namei.org, linux-kernel@vger.kernel.org, dhowells@redhat.com, linux-security-module@vger.kernel.org Date: Wed, 11 Apr 2018 17:25:57 +0100 Message-ID: <152346395768.4030.17020230875159368659.stgit@warthog.procyon.org.uk> In-Reply-To: <152346387861.4030.4408662483445703127.stgit@warthog.procyon.org.uk> References: <152346387861.4030.4408662483445703127.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 11 Apr 2018 16:25:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 11 Apr 2018 16:25:59 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 e967c1173ba3..a07fbe999eb6 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))