linux-stable/drivers/base/firmware_loader
Thiébaud Weksteen 3677563eb8 firmware_loader: use kernel credentials when reading firmware
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).

Because previous configurations were relying on the userspace fallback
mechanism, the security context of the userspace daemon (i.e. ueventd)
was consistently used to read firmware files. More devices are found to
use the command line argument firmware_class.path which gives the kernel
the opportunity to read the firmware directly, hence surfacing this
misattribution.

Signed-off-by: Thiébaud Weksteen <tweek@google.com>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Tested-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/r/20220422013215.2301793-1-tweek@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-22 17:13:56 +02:00
..
builtin kbuild: do not quote string values in include/config/auto.conf 2022-01-08 18:03:57 +09:00
fallback.c firmware_loader: Check fw_state_is_done in loading_store 2022-04-22 17:13:54 +02:00
fallback.h firmware_loader: move firmware sysctl to its own files 2022-01-22 08:33:35 +02:00
fallback_platform.c firmware: Store opt_flags in fw_priv 2020-10-05 13:37:04 +02:00
fallback_table.c firmware_loader: move firmware sysctl to its own files 2022-01-22 08:33:35 +02:00
firmware.h firmware_loader: Check fw_state_is_done in loading_store 2022-04-22 17:13:54 +02:00
Kconfig firmware: Add the support for ZSTD-compressed firmware files 2022-04-22 08:51:16 +02:00
main.c firmware_loader: use kernel credentials when reading firmware 2022-04-22 17:13:56 +02:00
Makefile firmware: Add new platform fallback mechanism and firmware_request_platform() 2020-03-20 14:54:04 +01:00