Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4545788img; Tue, 26 Mar 2019 11:31:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6dDzh7QzwqVOuwXtMompnEOp4h/xEPVW4MnIIhsyq2IZwvHmOwCUuYBUNfQaE1OEKFR9/ X-Received: by 2002:a17:902:1:: with SMTP id 1mr31860041pla.226.1553625081691; Tue, 26 Mar 2019 11:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553625081; cv=none; d=google.com; s=arc-20160816; b=ZnElCgIjPmxBD2Rr2WZ8mD+Z7nGI6EhKTbLARVvhI7vnCMhrzKiz3ynAO1SrEF8HfC aq5oMk/VsVhCegOFwjKfQcbpO88LRCwDJmTO6PUarV4nePFfDb+JlO3zP1+b84xUCyJh vOxwtEvQ9CQEcTe0DN/mgMV73mErtWe4Myitwj7FIVhCWfM4VodLaOZkhhyVhuESKmRy wUZuc1QejKP/f0kOg+6k1ABwl1khw8LacsrN+mq8MScLHrCTdNyRhf3oRD7n9/Ar4U0N NtKSd8dPYiTXqtxc0vKe3By1ALnvyWOEcWzyb713W2Y2DhUdKc+ZQUMozDdJP1zzu3DO t7QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=aQw0KGeWmvPzPQJC9aCiMXHo5RCdIiAFpbvhdBtqfOA=; b=ISdAdnR3OAh9TGOnhjrYdhyUDqiYpTbkjfzqRnrF6QLs+Cl6+4g12qoRXZVFXOzZQf kUi9Wzg16hFoyJarGJ2cPpu+6LKOVe6CB+74u6qEdddVgqc7ZDZ5IVdpdLI75q7y+Tqx Ze1Qk51hRw7+5BdPfxlQkdMpHOHnVgwvdRZOgjtQL0noDu4W8UkfojkurgCHFgYGaCZc b8puaSEdVsVmCku9QyyVTtjRk3r7YZMhvGuezXTID9nE2KTKYq5WTkS6b1eKnaXHRQhE 60/EFwEEKI5niyJiMgnSJPbP50na/Tp2zm1dxu8sb9/3TevbAcfdgaQzw/rKZCZliTwk bo8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=DIlec5t0; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g34si17481311pld.115.2019.03.26.11.31.06; Tue, 26 Mar 2019 11:31:21 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=DIlec5t0; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732944AbfCZS3v (ORCPT + 99 others); Tue, 26 Mar 2019 14:29:51 -0400 Received: from mail-pl1-f202.google.com ([209.85.214.202]:41278 "EHLO mail-pl1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732731AbfCZS22 (ORCPT ); Tue, 26 Mar 2019 14:28:28 -0400 Received: by mail-pl1-f202.google.com with SMTP id 42so2644115pld.8 for ; Tue, 26 Mar 2019 11:28: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=DIlec5t0clil2K3z1mQdY8Ozo7PzlyiRXYNLrqoik42GWf+SWRdQxm0hFn3CDu6CT7 z3l23Zj/4mmAJvQOjaNVvuhjtGBp3PSUL8NIDYIfVFqPmo7Y6tVU4WhqiKb0j0Ovyq4/ uP4N0qPuQ8UBSpbd8J1/FCclbdWKoOxyfSchUBo9pr+auLEflx/O9jYxyHyO2OntwoNa zDIVBPCnINJDBVVQo1xUe9xiaiS1lQhbv4c8ylFNhZNGEiesp70hGeaXM6fmeK6Oi71x UTtqtlH3qdj+vmoGt8YCUW/DXotr4XE7NM7x+YRhhoncOOODmnhhmeTokf2EM59RBNWL 7Shw== 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=nKx+vHSBPOJ9dSYcoeOSnwsvHESuIDHncBZouzz6ncqjMeGOW05B8jA7pYVJ36G6Y0 5JCKN6j5g/4hyLONwngEhx4hujHhHJcv6eS+MOutxuU8NcNNjO1zevuyv0kwOaRYur+m aVrp8njw8+lwWaYZMU+gSEiXfXBGROBqrGWHaJ3nlR18H6cTKaxIW82d+j/rDDg5W6Vc C286718sL+2hJQTJhjvwE3Esm1n04XupbeuzkaKvW/onMNQPcw7cWcTn5VdoeWt8NErR MeQxvBf1cR9CVKqru+ffZXw2SR014XW2CJLDeX5WtKyJo2m/pZbHTOAG+egYQK3z6Asb 85aw== X-Gm-Message-State: APjAAAVsp3b+fWb6CbeGmYE5urtMozw3CAKyGsueDqbBwtrdEoAjTPAH dRBatsCtRp0XdOFbCEDrCUitMpz4AQgK63uAKE+85A== X-Received: by 2002:a63:f80f:: with SMTP id n15mr30302790pgh.283.1553624907693; Tue, 26 Mar 2019 11:28:27 -0700 (PDT) Date: Tue, 26 Mar 2019 11:27:29 -0700 In-Reply-To: <20190326182742.16950-1-matthewgarrett@google.com> Message-Id: <20190326182742.16950-14-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190326182742.16950-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog Subject: [PATCH V31 13/25] 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 Content-Type: text/plain; charset="UTF-8" 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 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)) -- 2.21.0.392.gf8f6787159e-goog