Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2161604ybh; Fri, 17 Jul 2020 10:44:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQYwbvYFoA4glLpVWSvVbvlx/089tv2Qg8HTtpYKzQ2YqgnExWX6FbwLrQxPq/kKUWP6S0 X-Received: by 2002:a50:e883:: with SMTP id f3mr10512253edn.220.1595007845503; Fri, 17 Jul 2020 10:44:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595007845; cv=none; d=google.com; s=arc-20160816; b=dkvNSXT3GY0simPqao0r8R4wSz3y03JZjvU+G55MZ1INGwMBH8r7q3QkLTfZEr+qC3 +dJQVOpC+whKsj2xCfYGYy3S7gNNLaBwgtwzivGnyOa0hT3cC5iA1KmPzpDuHK2kRWIs tG6/Nlii8QfU4GMiklIk1MIUEFQb/A11BvEkB7n9YkC7RAAt38O3xD6W5T/ex/wjagQ/ yemOzNu/expa/w4W9Avpl4dJ/aokOrzu4Fhjr4spUijzQ3A7nwoL2HDpKQL+/bKx1xrB CPk6miR3PFwTPHa52rr5PCDsI5S0vQ+9z3mot3dYiyS/98ImA3ZdxOgn58hfqgqDnDIo g2Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7gESCYHdeEc18WmSHoFiRlcOM8qkMy02/gtCzbZTAqQ=; b=skImgDsHnUdu1OCMqiRjzZU+4980YFlPBOIpVsStzdT9Ldfc5DHp0dg2S1Qj5NGoQ+ byIUKBTtGLR4b9E/JIs4VWm/tbxqZIy3pHRW2xSYRmRW04up5BTACmaWmkmsVuVkCQs/ XoRmFuzRNk/4BeDs3n8lZSZfdM3kptiyN2hLXhjGN9SRJYn0oVikmOyw/15dWG7gxM9i +JnUuOOCwVVVKN79Z3phhYLjWQPrqNqcqU42oRoQI4L1fxJ6yy3ldWrTiNSvShPL/71I 9+iV9twD92fkvBs0A149zOXqSW9qt8du8KgNzQ8aebtMUsMKuYc2RC8HWxoMYAa9cTUF SuRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WxPHrXXF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id x24si5310373eju.623.2020.07.17.10.43.42; Fri, 17 Jul 2020 10:44:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WxPHrXXF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728124AbgGQRnU (ORCPT + 99 others); Fri, 17 Jul 2020 13:43:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728027AbgGQRnR (ORCPT ); Fri, 17 Jul 2020 13:43:17 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 930C7C0619D7 for ; Fri, 17 Jul 2020 10:43:16 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id w2so7021862pgg.10 for ; Fri, 17 Jul 2020 10:43:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7gESCYHdeEc18WmSHoFiRlcOM8qkMy02/gtCzbZTAqQ=; b=WxPHrXXFANimi0wbvfcJ6Cfo6RILGM8zrzptr/i4wicbfpzxjVf9s2PSObmLwcn9aq SbUDJlkCbpwtWAmmR9A2NZpribK1YDkwqAQ5TTgN4F0z1JKluyrZrKxbZBHXSmRh0PPQ ei15QxSWG1ELter/xoH0l0moiUBAi1WUPtXtc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7gESCYHdeEc18WmSHoFiRlcOM8qkMy02/gtCzbZTAqQ=; b=J8eaXkGMHrtYxKyDHE8qePi7zEE+Yh6ji4bBiProl4M9xxEjwGAbyLuGvLWN8HfEUe MPu8IBxoNW+Apsx/N3/RSmPVxUiTCAafhFaPNidrG7pgQe6KJ0S8PivlwSXoSEPmE52M ZlNqX8aMJD3awsPlKWz0y+1d0kj0RQzIzyYfIKVY3D0Gcv/X6ApFHD/+kc1iQk3gsA6v q0WjbvU3i/Zu8WJQ8iE1uD5FBbh1j5UUqXxzIDK9kZYWjh+BDlKUTaiiJI3DyFTRadon QLR6UtgzRFLA6C9bj1MCNo2o8Z4x4K59pZ8UxKgD4NqhVsqoZ7XfS2c7bYzhLx3Eu8gp pgBQ== X-Gm-Message-State: AOAM532rpEcUGkVOS9+bsNg1DRJUsgvfblOorM0zsFKq4TVsuHaYwf7G V9uydf3Qscn53xM6+aiNoTib9A== X-Received: by 2002:a63:338c:: with SMTP id z134mr9360703pgz.245.1595007796077; Fri, 17 Jul 2020 10:43:16 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id c139sm8072372pfb.65.2020.07.17.10.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 10:43:13 -0700 (PDT) From: Kees Cook To: Scott Branden Cc: Kees Cook , stable@vger.kernel.org, Mimi Zohar , Matthew Wilcox , James Morris , Luis Chamberlain , Greg Kroah-Hartman , "Rafael J. Wysocki" , Alexander Viro , Jessica Yu , Dmitry Kasatkin , "Serge E. Hallyn" , Casey Schaufler , "Eric W. Biederman" , Peter Zijlstra , Matthew Garrett , David Howells , Mauro Carvalho Chehab , Randy Dunlap , "Joel Fernandes (Google)" , KP Singh , Dave Olsthoorn , Hans de Goede , Peter Jones , Andrew Morton , Stephen Boyd , Paul Moore , Stephen Smalley , linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org, selinux@vger.kernel.org, linux-fsdevel@vger.kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/13] fs/kernel_read_file: Remove FIRMWARE_EFI_EMBEDDED enum Date: Fri, 17 Jul 2020 10:42:58 -0700 Message-Id: <20200717174309.1164575-4-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200717174309.1164575-1-keescook@chromium.org> References: <20200717174309.1164575-1-keescook@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The "FIRMWARE_EFI_EMBEDDED" enum is a "where", not a "what". It should not be distinguished separately from just "FIRMWARE", as this confuses the LSMs about what is being loaded. Additionally, there was no actual validation of the firmware contents happening. Fixes: e4c2c0ff00ec ("firmware: Add new platform fallback mechanism and firmware_request_platform()") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook --- To aid in backporting, this change is made before moving kernel_read_file() to separate header/source files. --- drivers/base/firmware_loader/fallback_platform.c | 2 +- include/linux/fs.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/base/firmware_loader/fallback_platform.c b/drivers/base/firmware_loader/fallback_platform.c index 685edb7dd05a..6958ab1a8059 100644 --- a/drivers/base/firmware_loader/fallback_platform.c +++ b/drivers/base/firmware_loader/fallback_platform.c @@ -17,7 +17,7 @@ int firmware_fallback_platform(struct fw_priv *fw_priv, u32 opt_flags) if (!(opt_flags & FW_OPT_FALLBACK_PLATFORM)) return -ENOENT; - rc = security_kernel_load_data(LOADING_FIRMWARE_EFI_EMBEDDED); + rc = security_kernel_load_data(LOADING_FIRMWARE); if (rc) return rc; diff --git a/include/linux/fs.h b/include/linux/fs.h index 95fc775ed937..f50a35d54a61 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2993,11 +2993,10 @@ static inline void i_readcount_inc(struct inode *inode) #endif extern int do_pipe_flags(int *, int); -/* This is a list of *what* is being read, not *how*. */ +/* This is a list of *what* is being read, not *how* nor *where*. */ #define __kernel_read_file_id(id) \ id(UNKNOWN, unknown) \ id(FIRMWARE, firmware) \ - id(FIRMWARE_EFI_EMBEDDED, firmware) \ id(MODULE, kernel-module) \ id(KEXEC_IMAGE, kexec-image) \ id(KEXEC_INITRAMFS, kexec-initramfs) \ -- 2.25.1