Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1240072ybi; Fri, 21 Jun 2019 17:08:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzw7ak7n7jeIl7p2BomuFVA+xn21uV3pUmVUAm08fg6aqUl2n9bq/omH5sktyfm0jn7xTdz X-Received: by 2002:a63:490a:: with SMTP id w10mr20729169pga.6.1561162117987; Fri, 21 Jun 2019 17:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561162117; cv=none; d=google.com; s=arc-20160816; b=HvyANWL9xI00J9DYgKc/nochCm9hE7BalBPRzuk0HAIUd2FHXkTCCeXv3TTxU0SqFG BZ9GFnnWdX7qgKp2oWi7qBsTqZ0INttDaA9T96HYPZY0cwkI7yvYkQupzRHU48WcvJ8+ 6Ynw7YJEH8GXzVNPyV2Y2/HF3RQQBxqh+cJdZv5xFYNeIg6zhKwC8t1z/rx43hjpm/8u 9YdYxwZyRdCayw/z2yZIvbseZlaEPldH4eWdlNofQfiQwy0oJABcSPihpt+0knXb30/i BhMr2NcamWxlYAtuCvPGhKHICYSu1IcA6OSuvE5v2/LK+yLYVpGd4nupbltu3kVBacCf b6Gw== 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=n33H2caFWJMziV8Vl9fEyuQPirYfKy2HcqzebAjjbEk=; b=w0Y8u0LO7/nJlIIL+cFMxniRraOB/Cwb6QAWsOuxQhaFDvMxuIYVKxqn+u1YM6CjXN 0NxWBkfxhjkC3AUtxlg5DuzSz591bHKAX6nyWgAF2syO2npu9mMAPpc8FYsPhUb19RzG wVMhQsz3FxRH/YQIVWCl5pfkvF0zkJpcWAqmpTf/Fds6Lsr6NFUd/3u1bjjdLu3SXbbZ BS2uCvUa/xaFC4T0KhFpiP7sY+oGy33PU9yxw0ZsX6NYnu93Kq0NTj3PbeQYzIOWwTVb 9bu6jaUxSYkX/hpetZmiJ1DHKl3RRIYn5is/CmEkT2cJbrtiN8uqvdto5dQpU6EBmHW3 QtPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QWSAua9g; 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 h76si4121642pfe.76.2019.06.21.17.08.22; Fri, 21 Jun 2019 17:08:37 -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=QWSAua9g; 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 S1726801AbfFVAGZ (ORCPT + 99 others); Fri, 21 Jun 2019 20:06:25 -0400 Received: from mail-vk1-f202.google.com ([209.85.221.202]:48995 "EHLO mail-vk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726809AbfFVAEn (ORCPT ); Fri, 21 Jun 2019 20:04:43 -0400 Received: by mail-vk1-f202.google.com with SMTP id f184so3036477vkd.15 for ; Fri, 21 Jun 2019 17:04:43 -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=n33H2caFWJMziV8Vl9fEyuQPirYfKy2HcqzebAjjbEk=; b=QWSAua9g9RwKP0uU2R678HQj1nTTQlk+ccuY/QK3BB9zuEyoAp2MVYhulrYkxknxtp 8CcguRHGvVDf5J0QYKG9GN2mG6EWCobGgzOL2HDjpsFhBVlDO71Hs+o0pLtXh/p3Ed4V N5nM6O7m5g2LG2oUQZP1CsRN/M4x/GGJNW1x6vRcXwslO1ZZEosxSyRhL7850ntFt/Qr 0nB8h31WahXFNIUcWpZ86cgp6VcJyrAzNoEdvFqSnlqNyhwwQTw4mGjPAMnnSJ4bBY5N uVnBjMN4HatYvmQyuAT2EkWPBDPyZag+Wolf4TT6MIZc1eWQtxhPUA57hp8Msm/MWMnW KRIA== 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=n33H2caFWJMziV8Vl9fEyuQPirYfKy2HcqzebAjjbEk=; b=tUz7sbUAksJ/GCC2UU9R7qtWjPZdufLO+QFRKB40NUy64oURrYOtQndbi1LSJ2RNzl SFpoD0v13OCwxaFYRZzXPC/sGAvX0rpLQHWuLxz7aPAn7GloRWYfVo4llsZxGrPEd30G 1beBDxGPve/1xxVvre9rQcPP6+yWhJWxCvELKEPJp5+l583PlFKTE+sCqulzALUBtA2q QeO4N9iQY0dwJOsTtZYl9qVnbpY8uPLzCvhbvPr26wu1npQlN3+Is9XDqL+W0RQjq5xM RrlOrht9f8+nMQwML2UewhEYF6akjTZsINAKbjx99mVGCz3+wAOnZTWlibZE7jVwpKIw 4AnQ== X-Gm-Message-State: APjAAAWM03NBQkHiiO7z2fsNM+6tUQoIQp+ezjTBIQtF+U+bAZ0DXJBV o12Qq/GlJ4URulm6q8eKUuyi9igP3oXJHFgxkpmXZQ== X-Received: by 2002:a67:7fd8:: with SMTP id a207mr52544296vsd.85.1561161882682; Fri, 21 Jun 2019 17:04:42 -0700 (PDT) Date: Fri, 21 Jun 2019 17:03:45 -0700 In-Reply-To: <20190622000358.19895-1-matthewgarrett@google.com> Message-Id: <20190622000358.19895-17-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190622000358.19895-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog Subject: [PATCH V34 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 , 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 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 8fccbe49612a..41d9ccd0e075 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "internal.h" #ifdef CONFIG_ACPI_CUSTOM_DSDT @@ -539,6 +540,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.410.gd8fdbe21b5-goog