Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1239030ybi; Fri, 21 Jun 2019 17:07:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHczI6B3g3753uhCFu/HGTiS0iaCx+hJI/FQTcT4H7WYQ47YAm9++vzNk3uGlZihd/Lyfw X-Received: by 2002:a17:902:4aa3:: with SMTP id x32mr12444034pld.119.1561162037928; Fri, 21 Jun 2019 17:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561162037; cv=none; d=google.com; s=arc-20160816; b=FPSc1gnviQuGIZJklPaUFjW9OMt2DVgO8EtIsoX/hFuAM5EakSo3JN4PfVxRm03UNC 0WyiKPiXtUAfKBdR5TWcixcEyHEby2ebBjvB1hJbyVPqRTBtz6+qDGgdyKtLm+LhadFR Tey9OO5fwYCll1Tf3L/XOFrN98JAVHIAhP8TnBb15xMPnnPDy36dLK3f/A6U6g+1tnmC yeKQCXThvvqQD7R0ZVhANXQUjxqbgMgzjc6xVPZrLqAWMyQmRin2Bj8DugiU9rJG7GUL AI5Hy+aVA44Sjiy55fEQFS7Jf4QKb5OEfXDsjpIp+QF9FVeIgwZXv/l8N9OLkZqtPWcC VFHw== 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=RH4r7kndiMZuzkloO60/eV46GQCIwbbHWtivaOQNx8E=; b=jPK87zxLZ1giRz4oIpCTvAqi9Sn67zmIS368+NLVto3z4+gueWfbb6Qww5g2iLQW0f fO1SyhVobFhl2G84+2Jm7PJD474cw0sdh7pwhfmh3ooUm0nz9riwtUVFTzZJFVmMi85f /SM77qi7zEm8c1iHPlNxdUcDOvz8obahZJf1GgAkngAPhTQ6IE31I9VPvs3qgW6jJuPZ rI7acLBUEbePIsq2+63mhJSaUIT7A+GEjYoQvVhW5TCgLQqV5F9fTpSc/j8lITae48zi sUOO16cQe08kTEAHelj0CjIkdTjlqhNirqPrwxoT3W78K6ZMwJMNdE1t4RQwDQBhaW2n He1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=AlJqBCOH; 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 w18si3708966pga.125.2019.06.21.17.07.02; Fri, 21 Jun 2019 17:07:17 -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=AlJqBCOH; 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 S1727037AbfFVAFS (ORCPT + 99 others); Fri, 21 Jun 2019 20:05:18 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:39952 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726990AbfFVAFN (ORCPT ); Fri, 21 Jun 2019 20:05:13 -0400 Received: by mail-pf1-f201.google.com with SMTP id z1so5319754pfb.7 for ; Fri, 21 Jun 2019 17:05:12 -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=RH4r7kndiMZuzkloO60/eV46GQCIwbbHWtivaOQNx8E=; b=AlJqBCOH77JCstgkPmGAZLgRUSD9zvatMOj3hlS41EdO8GggJp6HBONVpx/jhauvgq 8AJYbxCo4G0bCR/ZL4FQ8B8+IWJY2WfIJ1YRwYg5JXFKA/gXZcRwW59UyJpziaVKPJMD w/V/JtAWur3tBIDTeoEHR7ZUYTOlGArmeV75OKSfGB53kteVVkiD50m114i64uhrcDHW kKiF2N+0rp0kEs0/V6xldaibUNauG2QYFkENtyXQ2vJG3z/F6Xg3uIhwM6tlnXlcDucd /iycXpCPysDjGuvfZjg6xm7UFHlgNwKHAPLDV5kfEXLPXmjXQ7Mys9GnXKhb3JR5lTB6 04eQ== 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=RH4r7kndiMZuzkloO60/eV46GQCIwbbHWtivaOQNx8E=; b=tgxQ2Nl3LRIAf8LnPStfI7hnOaVhmGbs0jtapqwWCL67DPB3jaiTY3hLVsBMeeuNXc o0R9975rkGhj/N3r26HnodWeqvdge2ejxiSomdVWVJw9ekQdYcuEpNDGQSG/RERi72rz HamGS2CtoVSBq7yRniJwqpC45BR+RXXMTrnj+dojzKpZ2ZfbIvqCRfjVvI7onDfP+5lV Dy3S+rh0ZEHyUEoFliuXACzk1XgwI5iRCFpHD/O70eBUg+Qa/p7HLrdldyeQp7psHnLB LvXc/J1oxKnKlIgqTEh8kKKh66mo6UlT4bj3C+pxeI61KebihUFF60s4eD/HtHdtGZLv SUSw== X-Gm-Message-State: APjAAAXCK2e2MestcMlBTRkx2/mDB+xVUZjppgKdJQ+EIrviiD+MCIWi RN9zSb+vlizgOvNn5BVtgequZIt7u5MDvPJiXQufdQ== X-Received: by 2002:a63:1d5:: with SMTP id 204mr21711270pgb.207.1561161912148; Fri, 21 Jun 2019 17:05:12 -0700 (PDT) Date: Fri, 21 Jun 2019 17:03:57 -0700 In-Reply-To: <20190622000358.19895-1-matthewgarrett@google.com> Message-Id: <20190622000358.19895-29-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 28/29] efi: Restrict efivar_ssdt_load 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, linux-api@vger.kernel.org, Matthew Garrett , Matthew Garrett , Ard Biesheuvel , linux-efi@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 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 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