Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp314231iob; Thu, 28 Apr 2022 03:05:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsTOC1K3+nfx+YdLWfYduF24yenrHtKWmO+9yy/ljlujEF7ONqki0QAT4a4ZDU8LPH1rC1 X-Received: by 2002:a17:90b:3806:b0:1d2:6e95:f5cc with SMTP id mq6-20020a17090b380600b001d26e95f5ccmr38056573pjb.23.1651140346595; Thu, 28 Apr 2022 03:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651140346; cv=none; d=google.com; s=arc-20160816; b=GbvYu8pI4jZv8XfrcS6ErYy3BJet8wI09Bvd16nB6is0T6PHw1aG5/pbRfVZ109VUn kFfO71tdy4M5PSRL2ifOYPY6D6C4Pi5Rojo/8kAPGlsBd0mKmgkQSMw95g0yLHBRO2/K 25lhsjKi4PRoRiBo8T0MpwVXnGasfPNGYwIHjPjJm5igKRfM4Rpnzey7wfUojFxkxPLF LHiyaBy2SBgkJV2oHilWMxgebPO2JBI7kfg2FP2zIcCfrbTopHjPeaIEpNzPC4VVzYfy if+fH3XuHBCKmgp5eun+jmZbyJxBymAE235SNNrZ3Wv2YNf9ek6yjWz6TXxfssQhbL4M C/gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cO/YCWPewHHUDy3KPf/VsxDLcGb+Qtjk0Kga1SfA+Vk=; b=yISQJlgqVZKGaJKC8eAYBSY9/wKFoVeBW5z7U3M71xZggE0AeI5L5pvCrLga22hsQT ao1QbCF+loecaO1FTODVnYWAb6DKWWHEfIrJ4J5ns0m66LRTjWo5P/RuNuYm1457hLMQ QnxUgUWgQgjw1XPgJbDH+aBsBxFsfm4SNEY/enFHzNi0vQyrbNqJdS4IYvf63b0k0QHb yLDcL0a86mMVM1NwTBqXd+WhD+XtIeydbyhwwFCH6opPhpxsS86oiRHo0go7Gpl+NeWk JYmqcaXQO2qBr9I7ci0moSV0QuDAT4FZnr8CEUyVG0o9+dGXQLKWb5Vsjs0iQ1wJMAWW 6vvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WTZb83o9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g5-20020a056a0023c500b0050d2671b11esi3967878pfc.203.2022.04.28.03.05.32; Thu, 28 Apr 2022 03:05:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WTZb83o9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344429AbiD1Ifw (ORCPT + 99 others); Thu, 28 Apr 2022 04:35:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344532AbiD1IeI (ORCPT ); Thu, 28 Apr 2022 04:34:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB6E5A27FF; Thu, 28 Apr 2022 01:28:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6E257B82B47; Thu, 28 Apr 2022 08:28:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CBA8C385A9; Thu, 28 Apr 2022 08:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651134524; bh=FQ7tkUBDxzmIQSIuGVBUfG+AlREALsjEt5yG5PjK1+Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WTZb83o9GLYWJwu5A6wCFd9vhs9TWHnnQMLn9YPQvTKTWatkDPxOxcRjCCLvpt0xE gdX0ZvAECJ1PkQafYq81Fr0s2sYLtY1y2R5LiQ2sI8ZmPtJymzoy0SUU9i79cr57fM AMB1B2Xuzv0sDgWi8K2qlDCtllq7+6Ywl+OMBYeI= Date: Thu, 28 Apr 2022 10:28:41 +0200 From: Greg Kroah-Hartman To: =?iso-8859-1?Q?Thi=E9baud?= Weksteen Cc: Luis Chamberlain , Qian Cai , Jeffrey Vander Stoep , Saravana Kannan , Alistair Delva , Adam Shih , selinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] firmware_loader: use kernel credentials when reading firmware Message-ID: References: <20220428061707.768468-1-tweek@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220428061707.768468-1-tweek@google.com> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 28, 2022 at 04:17:07PM +1000, Thi?baud Weksteen wrote: > Device drivers may decide to not load firmware when probed to avoid > slowing down the boot process should the firmware filesystem not be > available yet. In this case, the firmware loading request may be done > when a device file associated with the driver is first accessed. The > credentials of the userspace process accessing the device file may be > used to validate access to the firmware files requested by the driver. > Ensure that the kernel assumes the responsibility of reading the > firmware. > > This was observed on Android for a graphic driver loading their firmware > when the device file (e.g. /dev/mali0) was first opened by userspace > (i.e. surfaceflinger). The security context of surfaceflinger was used > to validate the access to the firmware file (e.g. > /vendor/firmware/mali.bin). > > Previously, Android configurations were not setting up the > firmware_class.path command line argument and were relying on the > userspace fallback mechanism. In this case, the security context of the > userspace daemon (i.e. ueventd) was consistently used to read firmware > files. More Android devices are now found to set firmware_class.path > which gives the kernel the opportunity to read the firmware directly > (via kernel_read_file_from_path_initns). In this scenario, the current > process credentials were used, even if unrelated to the loading of the > firmware file. > > Signed-off-by: Thi?baud Weksteen > --- As stated before, should this go to stable kernels? If so, how far back? And you forgot to cc: John? thanks, greg k-h