Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp856259ybd; Sat, 22 Jun 2019 17:16:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVXeHHubcJ9Mp8EMJPif8qKoIRRoPYaecNfzQgy+Hf38eC5wgBT84KxWlfIFhLPihc+vgd X-Received: by 2002:a63:5c16:: with SMTP id q22mr23472405pgb.200.1561248973939; Sat, 22 Jun 2019 17:16:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561248973; cv=none; d=google.com; s=arc-20160816; b=imp8dxKkjmOSyeLlW5Y4YYMeR8umCi+6yqvjghe+J3+uRRXjqd9jFFmtTVix44UBPe Zu4e/BlQmjSFP+lpJH3v+r7qJK9GwceEIdVlRqXIHrZs1/MnC66fXA+d91pqdHkV5sXH VwDtPBXnN1yucjz7bYkZvOSLH7mk+Y8nu+l9KwTc46OeSJjmFsJrRb4M8Sb6cXJGo51G y1jSIfHcXeYEtQg4FN07YOr6fwBy+xL6ggMI2xBO2exjC1PoXN1c0UCertz8eQcaFuES HKAaYJtfw0TSeQgnWFWNfJnPJd71tjTaHvoxM0zh4fKUz97WSaJXW05rzhV3bUdwvk5k vCyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=btG6avAzDAyvn5JxuzcdJRsv07F3W0fAi+zvzELLu4g=; b=V+kpZwFkDaxJ0JHu3yGdFvmgUJXEx45ZN7jyS7Vt8KF4b0tNyE1+0758uOdT+W/ayV 89Z6dskNrDCA1O0tjonSN4qw0xyjJEtRSBoj7dMQou+cBcA1KRCtH5eRxnu2y1xsfYFP 4eYKX6ciWKhHOCB/LOlzgAqTmHtut04TSRF65g05uhKXLj+plzgScKIcQvtC9rudEAFb iXB4MVy193rs9RDC8zUFhiZcnlgMZIOoWInytWxluImtRiHUlMHIY3dAuy9aTQ8z6Ph6 aTf7XgjrHbUl7vDPq600bDQrbAnivGjIVB4pRFW7/UHzMXYsaO+0ccVHe8pw18NpcdeM aGwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="G10ix/75"; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c38si6198464pgc.65.2019.06.22.17.15.55; Sat, 22 Jun 2019 17:16: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=@chromium.org header.s=google header.b="G10ix/75"; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726498AbfFWAOt (ORCPT + 99 others); Sat, 22 Jun 2019 20:14:49 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:40960 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726413AbfFWAOs (ORCPT ); Sat, 22 Jun 2019 20:14:48 -0400 Received: by mail-pl1-f196.google.com with SMTP id m7so4788610pls.8 for ; Sat, 22 Jun 2019 17:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=btG6avAzDAyvn5JxuzcdJRsv07F3W0fAi+zvzELLu4g=; b=G10ix/75gAlaiLGUlBh565tLQ8+aylPU/RQBBsKWCCMUORUSsygtn+q15t9tr59J2A cUiEQyECiFsC4UExccIv11GBw77rxdlv0rlsUUNpDdl5FmjAPK3GAviiQ1EbJBhyAJCJ C48HUkgUK3dqaC+1Ih76fePbjemx7QzQ6cHf8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=btG6avAzDAyvn5JxuzcdJRsv07F3W0fAi+zvzELLu4g=; b=nb9NcPXrDrbt+6zxE2pGOkmF68lf/LgE8RE+ivRKkkN9LbV0+jMhqHh+16ud/k+fcp kXQkDgDzPQDzR6HsXpIPOEZm/De+YWHfM+oqeDVm1OpDdI/aF4WYsaqeC1m+Z1TAN7Nk N0w+YPFPNpBn8aNDqQ8B/5achDKlRJGFXwFi29i2BHIf2e3CMznZmL/LMR28D2Nnz2zb 4XB7Ul59YTIRH81Lq5s+2n3owR8H8SdZI/C2iTgcX9Nh9EJQwy6yRiYg6w/yByrShlOf 14f18ns/yxY6rVcMCQfhUvyVn8e1UD5Ve6De+C2nD9IJN3DFf1JEYxHvlb5g2WwLWIAo y6rw== X-Gm-Message-State: APjAAAUAuXnJMhQinw4JrBT8pz0PaaOLFGtEfwJOHTNhFMX8yJwIQSrM xt+ZLRVTMmFWWnp0LMNcjLQ4bw== X-Received: by 2002:a17:902:7443:: with SMTP id e3mr3104455plt.176.1561248887361; Sat, 22 Jun 2019 17:14:47 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q10sm6534267pgg.35.2019.06.22.17.14.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 22 Jun 2019 17:14:46 -0700 (PDT) Date: Sat, 22 Jun 2019 17:14:45 -0700 From: Kees Cook To: Matthew Garrett Cc: jmorris@namei.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Matthew Garrett , Ard Biesheuvel , linux-efi@vger.kernel.org Subject: Re: [PATCH V34 28/29] efi: Restrict efivar_ssdt_load when the kernel is locked down Message-ID: <201906221714.CDECCAEDA6@keescook> References: <20190622000358.19895-1-matthewgarrett@google.com> <20190622000358.19895-29-matthewgarrett@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190622000358.19895-29-matthewgarrett@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 21, 2019 at 05:03:57PM -0700, Matthew Garrett wrote: > efivar_ssdt_load allows the kernel to import arbitrary ACPI code from an > EFI variable, which gives arbitrary code execution in ring 0. Prevent > that when the kernel is locked down. > > Signed-off-by: Matthew Garrett Reviewed-by: Kees Cook -Kees > Cc: Ard Biesheuvel > Cc: linux-efi@vger.kernel.org > --- > drivers/firmware/efi/efi.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c > index 55b77c576c42..9f92a013ab27 100644 > --- a/drivers/firmware/efi/efi.c > +++ b/drivers/firmware/efi/efi.c > @@ -31,6 +31,7 @@ > #include > #include > #include > +#include > > #include > > @@ -242,6 +243,11 @@ static void generic_ops_unregister(void) > static char efivar_ssdt[EFIVAR_SSDT_NAME_MAX] __initdata; > static int __init efivar_ssdt_setup(char *str) > { > + int ret = security_locked_down(LOCKDOWN_ACPI_TABLES); > + > + if (ret) > + return ret; > + > if (strlen(str) < sizeof(efivar_ssdt)) > memcpy(efivar_ssdt, str, strlen(str)); > else > -- > 2.22.0.410.gd8fdbe21b5-goog > -- Kees Cook