Re: [PATCH] drm/i915: taint kernel when force probing unsupported devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 3 May 2023 at 11:48, Jani Nikula <jani.nikula@xxxxxxxxx> wrote:
>
> For development and testing purposes, the i915.force_probe module
> parameter and DRM_I915_FORCE_PROBE kconfig option allow probing of
> devices that aren't supported by the driver.
>
> The i915.force_probe module parameter is "unsafe" and setting it taints
> the kernel. However, using the kconfig option does not.
>
> Always taint the kernel when force probing a device that is not
> supported.
>
> Fixes: 7ef5ef5cdead ("drm/i915: add force_probe module parameter to replace alpha_support")
> Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
> Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxxxxxxxx>
> Cc: Daniel Vetter <daniel@xxxxxxxx>
> Cc: Dave Airlie <airlied@xxxxxxxxx>
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>

Acked-by: Daniel Vetter <daniel.vetter@xxxxxxxx>

> ---
>  drivers/gpu/drm/i915/Kconfig    | 13 ++++++++-----
>  drivers/gpu/drm/i915/i915_pci.c |  6 ++++++
>  2 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
> index 06a0ca157e89..12ba19da9bc3 100644
> --- a/drivers/gpu/drm/i915/Kconfig
> +++ b/drivers/gpu/drm/i915/Kconfig
> @@ -58,14 +58,16 @@ config DRM_I915
>  config DRM_I915_FORCE_PROBE
>         string "Force probe i915 for selected Intel hardware IDs"
>         depends on DRM_I915
> +       depends on EXPERT
>         help
>           This is the default value for the i915.force_probe module
>           parameter. Using the module parameter overrides this option.
>
> -         Force probe the i915 for Intel graphics devices that are
> -         recognized but not properly supported by this kernel version. It is
> -         recommended to upgrade to a kernel version with proper support as soon
> -         as it is available.
> +         Force probe the i915 driver for Intel graphics devices that are
> +         recognized but not properly supported by this kernel version. Force
> +         probing an unsupported device taints the kernel. It is recommended to
> +         upgrade to a kernel version with proper support as soon as it is
> +         available.
>
>           It can also be used to block the probe of recognized and fully
>           supported devices.
> @@ -75,7 +77,8 @@ config DRM_I915_FORCE_PROBE
>           Use "<pci-id>[,<pci-id>,...]" to force probe the i915 for listed
>           devices. For example, "4500" or "4500,4571".
>
> -         Use "*" to force probe the driver for all known devices.
> +         Use "*" to force probe the driver for all known devices. Not
> +         recommended.
>
>           Use "!" right before the ID to block the probe of the device. For
>           example, "4500,!4571" forces the probe of 4500 and blocks the probe of
> diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> index 5fcc9cfed671..c509ea4aa70f 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -1346,6 +1346,12 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>                 return -ENODEV;
>         }
>
> +       if (intel_info->require_force_probe) {
> +               dev_info(&pdev->dev, "Force probing unsupported Device ID %04x, tainting kernel\n",
> +                        pdev->device);
> +               add_taint(TAINT_USER, LOCKDEP_STILL_OK);
> +       }
> +
>         /* Only bind to function 0 of the device. Early generations
>          * used function 1 as a placeholder for multi-head. This causes
>          * us confusion instead, especially on the systems where both
> --
> 2.39.2
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux