Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6480479ybi; Wed, 31 Jul 2019 15:23:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQN2fGxQVDTwhEwdH5cipUbumM5wmmR4KaZmk654Ik1QgLkYpLR8msi1aYIVQsBSdDaMBM X-Received: by 2002:a65:6248:: with SMTP id q8mr76174689pgv.311.1564611793476; Wed, 31 Jul 2019 15:23:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564611793; cv=none; d=google.com; s=arc-20160816; b=hogbo4j4AKxRSmt1W+u0js+YmRWC41HNfvZWh/JYjtT8McOKUwcpWQH2Of1KXKBYc4 12bPo/3/LkDVPB1TB23bnBf2LGRinS+Z+2Z5SBd00vGIep+MkaPatgNyYHR5AeR8E84X BJifvj/Z+DDVZAzm8IlVvlUET3eLLdVbcBKtY6sCampZ2w0RIhIjFLT1wyxewCazNVCS dF2wKT5IO6nPbZBY7SnaMeMayMR8oaQ/Q6dtHF+0DTsZIHT0oVqUb5WDvYVEigefRw7C QGa52oLgqhW/od8X3pY4L8JRSkfmG5Eu7lwuWnRcVH2HKy4efPO7yIT68sqPau25s2Zy Seyg== 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=Tmn4zMTjEPlUC2x7KbFrZqCSBZYi0Bx5tDyyMiSTkHI=; b=AKN06oX2r6mPX0QllYYxqVKHK4HaWwiT9Xiy0rud1WxFJ5FYidzJG2Uy81rPuvR20S 3dxQJWIxDgKPeO/4+xc2031L9/denvLOcYy+ye+bFw5/PAkvxCSsTH6j3Fbtu9BLB7du MIfnVCVCMqCHBcbd6gpqOuAudklec0PIvRUX9mKLzFQ9z1pXVUbO/NrYBL+B91D7MVMv Zb+ruuiHw8gE0QfDOytvMulrVEl+MC6e3vw7dSY5a4Soqo5e3KBCpfd8qmHvHo+VoPLc v0ijo6jRYvtKdvSVSOJW6qzkibH9cn/5+7rE9Gbaau+vCwxqg6Ijm9VonT/6OLaz5Uc7 4k3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=KNtYwwW1; 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 h38si33874651plb.149.2019.07.31.15.22.58; Wed, 31 Jul 2019 15:23:13 -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=KNtYwwW1; 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 S1729565AbfGaWTJ (ORCPT + 99 others); Wed, 31 Jul 2019 18:19:09 -0400 Received: from mail-vk1-f202.google.com ([209.85.221.202]:39858 "EHLO mail-vk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729694AbfGaWRI (ORCPT ); Wed, 31 Jul 2019 18:17:08 -0400 Received: by mail-vk1-f202.google.com with SMTP id d14so29968230vka.6 for ; Wed, 31 Jul 2019 15:17:07 -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=Tmn4zMTjEPlUC2x7KbFrZqCSBZYi0Bx5tDyyMiSTkHI=; b=KNtYwwW10pBzgMhIxkJCS/uENsLSdnfeR4Sv0jIZjE/kqgEDSSHm7qFmZbYcYGhoW6 ah/D6endKWnFZUJYaYj7c4Z+Ww90IGwhNDxIsN8ddpHHjZu1K7WMe4g+HC9ErAOL+Oan P+BwGpuxFHwb5gLspVTRu+6V+KSMYrvGqWk/8uA5Bh2vAksZ/MPON9EHcNcYaMbAc+XA C8a2S8I67YkszaV+R1icsFv0U0LpSf3kIpJXXD+cQD5wRZp78DzPMYAZY0V+NEYlQnJJ vgeuo4JK2gW0U5FN7kBmSeEw1cE/vN5M3uTg1hBFh/FZ4R94jpLxHeYydBoPJgYD3CRN TwlQ== 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=Tmn4zMTjEPlUC2x7KbFrZqCSBZYi0Bx5tDyyMiSTkHI=; b=QGajRbMZkHP3TrqDr/ssbXxMF1BRQ5BrZiETBn8ocuwr+vpr8MwHzypYbSuR0/HI95 mdZzFTc8B+dxz3FvRKaEKACP/7k3/+7NcB9mS9OgRdsAchTc961KfEuGdoHuOWtfLqWR +ub5QHVNSywZaZnTpuacSh/xHIFH/oDPKtS0aA1ciwlwtw8Lb5HkRVPNg29voLbUF5UT gAB8Di1I2pOIWvxC3wIaP5MmrtNiUczN5+I+5fc07iKASTojnVG5IcEGwtr5+eZwwHaS 4Leki/LFR7Zv7HPjtve8JvwdL5wrCkM16/1tQlJpdYG/QVd2Y+wfvG1RnA+1KMeoiKS+ ER5A== X-Gm-Message-State: APjAAAVfhifx1XRWFeeuNy1MDYgy824wBGdUX9t0CdMNrdbHgR0Owh3e vgWTHmEDcIebnpiuJ6FrrzXis1j2mQhGALM2qRb1rA== X-Received: by 2002:ab0:4307:: with SMTP id k7mr12696958uak.45.1564611426939; Wed, 31 Jul 2019 15:17:06 -0700 (PDT) Date: Wed, 31 Jul 2019 15:16:04 -0700 In-Reply-To: <20190731221617.234725-1-matthewgarrett@google.com> Message-Id: <20190731221617.234725-17-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190731221617.234725-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog Subject: [PATCH V37 16/29] acpi: Disable ACPI table override if the kernel is locked down From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Linn Crosetto , David Howells , Matthew Garrett , Kees Cook , 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: Linn Crosetto From the kernel documentation (initrd_table_override.txt): If the ACPI_INITRD_TABLE_OVERRIDE compile option is true, it is possible to override nearly any ACPI table provided by the BIOS with an instrumented, modified one. When lockdown is enabled, the kernel should disallow any unauthenticated changes to kernel space. ACPI tables contain code invoked by the kernel, so do not allow ACPI tables to be overridden if the kernel is locked down. Signed-off-by: Linn Crosetto Signed-off-by: David Howells Signed-off-by: Matthew Garrett Reviewed-by: Kees Cook cc: linux-acpi@vger.kernel.org --- drivers/acpi/tables.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index b32327759380..180ac4329763 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "internal.h" #ifdef CONFIG_ACPI_CUSTOM_DSDT @@ -578,6 +579,11 @@ void __init acpi_table_upgrade(void) if (table_nr == 0) return; + if (security_locked_down(LOCKDOWN_ACPI_TABLES)) { + pr_notice("kernel is locked down, ignoring table override\n"); + return; + } + acpi_tables_addr = memblock_find_in_range(0, ACPI_TABLE_UPGRADE_MAX_PHYS, all_tables_size, PAGE_SIZE); -- 2.22.0.770.g0f2c4a37fd-goog