Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4527284imb; Wed, 6 Mar 2019 16:01:34 -0800 (PST) X-Google-Smtp-Source: APXvYqzhmh/htW0BZBpt6CVNuBjr3+YxCeuUZA6n1m8nIstt+W92sbtwjtvr0hSkiww6feyd04+k X-Received: by 2002:a63:ca:: with SMTP id 193mr8742908pga.288.1551916894576; Wed, 06 Mar 2019 16:01:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551916894; cv=none; d=google.com; s=arc-20160816; b=WHEnkdtYrwT36lUokmiKv0GoDGA4zXNumf/O0Xc4bjInahg5VpoIE3zQw5sFpXng0P itQ4aD/kjElaeumt8ONlzvFCi/paaTzKaqN4AhNChf/rCUoDBqvjYB7be6uiPSvdy5PE RQK2Y/p2eJlJeKO2dvhXWv+Q2H47vU3GNDt7XX4OOjJ4tlwWefvOiJQTK2u/LHgLhSVL +2vHshiryhqGa8Om1DNu8JweTENnwPcJhN8PpxszY9itHZIkO32YIX91Xt7SKKXzGx8h 022LPFoat3VNo0VxvD+8x+SXvXtswk+vIrnYHTaBW8SI2L1p1+oRkXYGzW21q1YVj+Df CNUw== 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=RLZYCznt91X7Gql2FLJuA+D6Xq8z59q436/ddkparrE=; b=YbWeEcCHy4Ec6KuB/GzuB7u3nbcAQdZqtsKEnoGnPvaywCmB0EIpkvwlxWAWuzztKD Uh1ucCiSm0H9gCkaCE8YiroEuvTTzw10kZaLik5gmdCbVXixH5U+AauqQ2HrHyH8lD6O BTncCLIA5k7c5gQoUsuCsPavNg7oqkVmsg/g+HaxHTj9o1b9LXd9lmBhhv9j/Jmlc8yK GNCFY3kaHuIRuwk3Yho8UG3wqpNqA1KV49wf2C+637ibyf1FTIrbYgYZ5oEVy/l04u6Z XJ674i8TLitKWog+1gxOz/QShNZALaFAMBnLcdxrB/APop+g//OW8y2tGGdSK4pPppeZ C4Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="i/MjTXb7"; 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 d4si2715449pla.112.2019.03.06.16.01.19; Wed, 06 Mar 2019 16:01:34 -0800 (PST) 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="i/MjTXb7"; 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 S1726568AbfCGAAH (ORCPT + 99 others); Wed, 6 Mar 2019 19:00:07 -0500 Received: from mail-qt1-f202.google.com ([209.85.160.202]:44158 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbfCGAAD (ORCPT ); Wed, 6 Mar 2019 19:00:03 -0500 Received: by mail-qt1-f202.google.com with SMTP id c9so13386596qte.11 for ; Wed, 06 Mar 2019 16:00:02 -0800 (PST) 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=RLZYCznt91X7Gql2FLJuA+D6Xq8z59q436/ddkparrE=; b=i/MjTXb7CbOG6UdkkS0vRNZvfV6iqT+SJUy26kVbxvGCwjfn8jRCtI1zQO9vj5H2ak apfgI4/baSkKebqMBSvCMvYYCd4lYbo5ztim2Tyika6/fTfhgxfiyzwCe6U8SXuxUH/A QMXQD8oXCYd6+d5dhpHO9MT8ekx8Nhcac8L3GeVKmleZ3xJNOFmMJqTs6o1aMOa/SvMi gfGhsbLGZLzEnc36jFQIkNfeaKcX77AgJBYVu2/DvzZJ1oXI4NCpFzcTHoMVU38SfSl7 DH+AH9U/Yw0/Mu1nSxhw0CQM0XKEcmhK6zNTjbEdD41qts+TJNBsuwJNo9oPQByKvGkt DkxA== 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=RLZYCznt91X7Gql2FLJuA+D6Xq8z59q436/ddkparrE=; b=e/fTOXdpDxzbG+171Z6UL2Y2q76b5+7Dk4jU5PRbzCH5qJ9BgCgHcChGvotQtwhREi s4YMsaSMgy6TUzgjKrrGiRsu3PYAc+SyEP2K84VGWCYbopr2Ve+CO6EjYQr0JAWWSpGa XYUoLNTBXKpUb0mUmg7WlxWYtUG79HfdCEAhPhTSx5/fcGJ6a3FrHDHqrR1rXCERYDqq Sf84UnJEFicGLOfSxAhkfGaI/d9yiaeSm9pT/QbCHsGHmChcO/15QpIaeXK2azfpRZpJ 3V/q/Cxf6JVHc0UCfQy8WxF9X0QpsJHeXR+4FGUGcD0Yn9i8PZWl5yE49jydU3Ws28CK VgIA== X-Gm-Message-State: APjAAAXOl7I2aG2ESOjUr7iDYR1ko1NhmPJkKfHixJ7rBq2Ze6TraKlW KNZ1nQY6BBNVMYybZk4rmz/HVWdJwPkUS70Vc0pdWQ== X-Received: by 2002:a0c:b91c:: with SMTP id u28mr5950718qvf.45.1551916802349; Wed, 06 Mar 2019 16:00:02 -0800 (PST) Date: Wed, 6 Mar 2019 15:59:00 -0800 In-Reply-To: <20190306235913.6631-1-matthewgarrett@google.com> Message-Id: <20190306235913.6631-15-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190306235913.6631-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.21.0.352.gf09ad66450-goog Subject: [PATCH 14/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 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 Reviewed-by: "Lee, Chun-Yi" 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.352.gf09ad66450-goog