From patchwork Tue Mar 26 18:27:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 10871973 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 8A9D713B5 for ; Tue, 26 Mar 2019 18:29:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75346271E6 for ; Tue, 26 Mar 2019 18:29:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6957928C47; Tue, 26 Mar 2019 18:29:51 +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 0DFBC271E6 for ; Tue, 26 Mar 2019 18:29:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732596AbfCZS3u (ORCPT ); Tue, 26 Mar 2019 14:29:50 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:33918 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732733AbfCZS22 (ORCPT ); Tue, 26 Mar 2019 14:28:28 -0400 Received: by mail-pf1-f201.google.com with SMTP id j1so1115696pff.1 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=tfCft1qrA1UgM5mi+GfuXO9sYgfMy0TLE5kgbpV3AGit97ttwq3uQHlZgZpiD7aP9u u74WXqP52hsHIyMJI7jsqJUlumZWoJq8nzssD8C1fcoduXOLPh6yVeHQPc/1t7B2Z/xQ RJ++3UTC3lfYmOEXmDv5/bZj67FHxE5ryumBKa+BGp1bCh8V8A6bfK3VJV/VzeXxP5qg 93ZSQqCJsfYh5vkV066KYffIfvKZwSL09XNOBfKM+nr5oIGkq2ZaCktjXIB594r11+8O WSX1fFgyZIB3PC4zL764pC7mNv1TywejxGitZB1WrDtGLxVQVwmStMwEuTGf9a1NMhhg INNg== X-Gm-Message-State: APjAAAU1I1aLDkQ5HV9c+VDmBRvoKmIyGFO8UGwYdTVTliu35qKwsHUl Dt7fjc2ubNIab+HdtyZkjkNTnyWi5UjlUEOPLnitTA== X-Google-Smtp-Source: APXvYqwMAG8zXNmY8SYtlr6zSMiao5parpM7h46gp9u2mGxgCIj6BeGnsuRx9l4mNv99r59blJSOQTYpZpUTUH4Dvq+5gw== 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 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))