public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Thiébaud Weksteen" <tweek@google.com>
Cc: stable@vger.kernel.org, Paul Moore <paul@paul-moore.com>,
	Luis Chamberlain <mcgrof@kernel.org>
Subject: Re: [PATCH] firmware_loader: use kernel credentials when reading firmware
Date: Mon, 23 May 2022 17:16:07 +0200	[thread overview]
Message-ID: <YoulN3eE37EUncSR@kroah.com> (raw)
In-Reply-To: <20220523052444.2421369-1-tweek@google.com>

On Mon, May 23, 2022 at 03:24:44PM +1000, Thiébaud Weksteen wrote:
> commit 581dd69830341d299b0c097fc366097ab497d679 upstream.
> 
> 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 <tweek@google.com>
> Cc: <stable@vger.kernel.org> # 5.4
> Reviewed-by: Paul Moore <paul@paul-moore.com>
> Acked-by: Luis Chamberlain <mcgrof@kernel.org>
> Link: https://lore.kernel.org/r/20220502004952.3970800-1-tweek@google.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/base/firmware_loader/main.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)

Now queued up, thanks.

greg k-h

      reply	other threads:[~2022-05-23 15:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23  5:24 [PATCH] firmware_loader: use kernel credentials when reading firmware Thiébaud Weksteen
2022-05-23 15:16 ` Greg Kroah-Hartman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YoulN3eE37EUncSR@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=mcgrof@kernel.org \
    --cc=paul@paul-moore.com \
    --cc=stable@vger.kernel.org \
    --cc=tweek@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox