Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2220626ybh; Fri, 17 Jul 2020 12:12:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHM/yfxQalCcoOxl1Jf78j4M2b1DZdnyhqR1Wh6UmOjxefzLtjc7dIS0w/8Ccvt6pNS/A2 X-Received: by 2002:a17:907:1051:: with SMTP id oy17mr10402340ejb.394.1595013126095; Fri, 17 Jul 2020 12:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595013126; cv=none; d=google.com; s=arc-20160816; b=gdSP8IySJ1KpYmDdnOgWvuJ4GI08VRROqfmjde5XHTCIWAtRmx7jihYXuOLeN65ILr ITG9bH3mXDurqUGYG3m8R0hr1OsCGR43KJhc2BYJSI5NZlln5G6O7q9Y5xHFnCavJZ/L GTSVZQladfvuZFjedDZ36y8Gk7lrAJN9+BSDtMFqZekvOP9XbXuwzMUp8NsCwhgEh4BS moHWx0t0Ycau6nVOUKKlVRJXNF33aQLBRFngM0eQOpAbCaRlF+XHl0/qle4eMKCH+Pyv dl0N6Qb5oru7v21CAbG6wqpjCMrX8frHjoZta6xDITFfGoYCqlQpgs6QxP9TXKXsXMtz kTbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=/3tZLNgSUaBUOYFtarysCRR7+220ug8Q6HlgI7Nzn9o=; b=h6XjjGiqud6GZNkmb2Ehq31dRh1yILCfUuOa8SXbVF9wa/FKAFiERJJesk30OkoAOP oCgDoL35UR2G9Jpeq+rOmy2Y5XzUGRiCuidAAK+A4JBrLb3V7+npKi6F2YZ9ZgapZO+V Kz2qzM2Lv6rZpSZ5Ozw41LxK7ss0ODj1ysJa61YmIP+cTaMQb0VZguJmVVBhU6cICqkA 7H/Yg4hkgl/vhuXxe1Zoc5ISydJtgcjKENgeDGI1jrwtjmnzWX308Hi4cY/esiRrusBp /ySMrvkGNRuHHf04LSk0hZEYXFv/EPOe78bgMgLtOV/mSVw/hZSFLZ3iwbsMyHlTmK8Q ZoLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=cCAmvlsU; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h16si5996293ejx.446.2020.07.17.12.11.43; Fri, 17 Jul 2020 12:12:06 -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=@broadcom.com header.s=google header.b=cCAmvlsU; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728511AbgGQTK3 (ORCPT + 99 others); Fri, 17 Jul 2020 15:10:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728182AbgGQTK2 (ORCPT ); Fri, 17 Jul 2020 15:10:28 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1090FC0619D7 for ; Fri, 17 Jul 2020 12:10:26 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id j4so12173596wrp.10 for ; Fri, 17 Jul 2020 12:10:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=/3tZLNgSUaBUOYFtarysCRR7+220ug8Q6HlgI7Nzn9o=; b=cCAmvlsUDJwZwJmRNK+H8fKklO9LVaNEl+TESiR0wM/9WOl4gqHrJeLLeokHptEi2Z mfVfnI/DQ8lbV43KW3fF7PXHYTWvLqhPUhdCtFftcUTV+1kYZkNMZ9L6n2F4V2hhM24M ygVUtqyThgYUVvXc2UchbsmG8Ns2cFz4iS3+c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=/3tZLNgSUaBUOYFtarysCRR7+220ug8Q6HlgI7Nzn9o=; b=OsI8yEi8B+bh8wpjgdrJuOBZZeJlpQHe+qVJKwd214BynPmn36xbSqWcQFAA4HecTj a58dmVJZQDeKbzdph12GFTBEfuvgCzv0BEGEnLv0aECjyu1dQmdXudzVQmJ9+WSwzwOj VnCKO/XYuYTrkzZdJZXKNGxn3lJ8tU2DoXMDVyl8qWwAANF8fyZZ9AT0UpKqVgGdfa9k 8d50j9ZgM4IEMI+XZ3x9Y3Md0azr+Vjri9P9iOzFFMYIiaVPzFKZ8PPO7n4g8vBcuQeB 2doCWySEvgSuW7dxsxWTiQ1opyHEesQndUoJYIOdpGaMZBGvBmfW6cPmozfhImJblQ8G tvGQ== X-Gm-Message-State: AOAM532jvUyoX9OIGIhz+YLaSsvS/VGOJZDBxPkpoEz3e6khy4kDQ2SF Rk4oQ1VzUmSxaYAMVi1ky8Kk37Zel7CcsXSV+E3Jn2IRAc7K4dgxgE6El891nxWTaCjmE9gUxiN pxW1KQyaSDzAwNmrgigW6Qv5+BDe/BkSMMNfVePHtAlc7nMFRw2Ot8eUpM0O3JXcAMHbWXugVrp x9U2hJJYsM X-Received: by 2002:a5d:68cc:: with SMTP id p12mr11463924wrw.111.1595013024363; Fri, 17 Jul 2020 12:10:24 -0700 (PDT) Received: from [10.136.13.65] ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id c15sm15320664wme.23.2020.07.17.12.10.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jul 2020 12:10:23 -0700 (PDT) Subject: Re: [PATCH 03/13] fs/kernel_read_file: Remove FIRMWARE_EFI_EMBEDDED enum To: Kees Cook Cc: 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 , 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 References: <20200717174309.1164575-1-keescook@chromium.org> <20200717174309.1164575-4-keescook@chromium.org> From: Scott Branden Message-ID: <8ee5f0f1-8eae-510a-a3bb-7420a3fca001@broadcom.com> Date: Fri, 17 Jul 2020 12:10:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200717174309.1164575-4-keescook@chromium.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-07-17 10:42 a.m., Kees Cook wrote: > 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 Acked-by: Scott Branden > --- > 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) \