Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3663795img; Mon, 25 Mar 2019 15:13:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqw2HUcMRHlWeYjNdVvzHjSgZTNXsb9c9+PeXDgsXuLAC059f+pgXGUw+jjD20Jr0kXxNQo7 X-Received: by 2002:aa7:920b:: with SMTP id 11mr25484600pfo.3.1553552004139; Mon, 25 Mar 2019 15:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553552004; cv=none; d=google.com; s=arc-20160816; b=dSRvzhWo/ZqcquscyeCSywfklqlq2EGKDMkr0ahNDwViWvKRWjiLDwsg5n94bwc+ZS 050ibUX+KfPd/n2Sbe1fZpe3y9PjiEi/IRlypVeqnbFAUH4WFt1ahsPz5eigzqQ+fJNx lhbGc2YCC4Q/b3fnVkcw4hvb4zJrRB4Hvy3tXvD6b2fRaVHdceVs0ETHcANcoXng9Jjs jzz6OHv/R17ExhNgjo3NTolvXBMdmj46L6tJcpIu6TXdp6WT4KLK8i6O8h971K9S4F7V 9wNEFCPOQ7DCxhJs6N/xgpHr0XjrAFcpbgLew95h9dm5zN+2KlgF/1LJo0LxHyCVOgwq B3Ng== 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=JjClfNcwudfjVo/9wlvsMTmCzUCPUTa4DRML2JJ7YVY=; b=VP5CVDo+dvNZgM8WS2/sZdw9l/aMP2nfSxtvtpcdibC+8tboAHhkJzp36T8bZpcBC8 Y69jNgw5dqLKpL0j0aN0wap0m8A1WPA/QX2CGNtUilQ9iXG4Cjzs3ORWr6EmcYgtNrgn n+kVDes+nJ79rmViWzfYjxTZU8ndEvCs2cBCqhSy7Wmaya6nSgsPSmEPkRJL6Ltms2A7 Te3hY70RB9ImzEVL4KhKTkJ7G/E37xm3xrLY/1QahSBcv49C5HKvZzDHgFwi/O4rQRtW 7OFXXKKN5IOfcDPPPGG6sDuPDnuWW7drL1vjKSI4WBXlUgr4Xfd0a3KgyPaINUIlcQwn s/mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=WlInIGo7; 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 q2si14833201pgc.507.2019.03.25.15.13.09; Mon, 25 Mar 2019 15:13:24 -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=WlInIGo7; 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 S1731028AbfCYWKg (ORCPT + 99 others); Mon, 25 Mar 2019 18:10:36 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:49172 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731003AbfCYWKc (ORCPT ); Mon, 25 Mar 2019 18:10:32 -0400 Received: by mail-pf1-f201.google.com with SMTP id y2so10572390pfl.16 for ; Mon, 25 Mar 2019 15:10:32 -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=JjClfNcwudfjVo/9wlvsMTmCzUCPUTa4DRML2JJ7YVY=; b=WlInIGo7E8Sg1V/FJrdy7246BJfv2IFZBnZYy6waTznK9n+caw2TjPOhGfPZ703SMU HsdZZBq/cfCb9aUasck8HT2YGLHxCNOEM9Dn8gFGDuQRppgl9963pB2bWUbB3OdW0afz R9HQ+dGBSgtqfa4Llibc6rDd6MCdkBpPk9PllURgbs7CB/aHBVoZoDL9rJ67wbDYeM2+ nkvuRWNqfMG3FM8h9H3EFUVkL8vF8uCHI4XGBEht/JE3ERIQt2oTW06JFFUZIo/C2MeG Gup11dIXcq1FY5/CF5EJkioM9JR9kP5hnhmiHGiydSEU3zr+pQBPM+64rv1Ip3uSVYPi STGA== 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=JjClfNcwudfjVo/9wlvsMTmCzUCPUTa4DRML2JJ7YVY=; b=d4buJcswOKo0I34wYLLmII0QUA/UynabJN9oEw3RcYP6ZFKmAvwQev1UQK1e/I58KQ yqyyI76ne45DeJFa2+XPVaqbsjg+H7inVyne1hCBplczbmEEjzspSNOqWQls+VvBtFlg 3xBJFuoFFqhe2WW9mZCpKQ/B7Kda1J9XbJFS7k/WuDHz6pyMdHm8VNMEv5EvhAu/zM7z oqBdv8maoDaxvbOfzMbzXynNZdqkkQBnkdDsTwz3slsWh+vEV1dy0yPvzsGJFipxLxdx ap5tD0/rSyNFQKKVZ2LRJ3wOFdtFE6IyMXpSsxXf+nBYVnTRbb0/3DmrxiQmxMknpQeQ DhFw== X-Gm-Message-State: APjAAAWyJJjtzMmgIZLVqctz8xmhKAGpElflogPy1WPsMZm6pWAnnXWp Bxir909Ep13X7Si0l0XHIfMFfQMGYaNL488EIhuvPw== X-Received: by 2002:a63:6a45:: with SMTP id f66mr6790296pgc.7.1553551831630; Mon, 25 Mar 2019 15:10:31 -0700 (PDT) Date: Mon, 25 Mar 2019 15:09:40 -0700 In-Reply-To: <20190325220954.29054-1-matthewgarrett@google.com> Message-Id: <20190325220954.29054-14-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190325220954.29054-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog Subject: [PATCH 13/27] 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, Matthew Garrett , linux-acpi@vger.kernel.org, Matthew Garrett 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 Signed-off-by: Matthew Garrett --- 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..ac8a90dc7096 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)) -- 2.21.0.392.gf8f6787159e-goog