* [PATCH v2 00/10] driver core: Disable driver overriding by default
@ 2026-11-20 11:11 Uwe Kleine-König
2026-11-20 11:11 ` [PATCH v2 03/10] vfio: Allow untainted use of driver_override Uwe Kleine-König
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2026-11-20 11:11 UTC (permalink / raw)
To: Greg Kroah-Hartman, Danilo Krummrich, Johan Hovold, Bjorn Helgaas,
Nipun Gupta, Nikhil Agarwal, Ioana Ciornei, Longfang Liu,
Julian Ruess, Ankit Agrawal, Brett Creeley, Giovanni Cabiddu,
Michał Winiarski, Eric Auger, Eric Farman, Matthew Rosato,
Tony Krowiak, Jason Herne, Harald Freudenberger, Holger Dengler,
Haiyang Zhang, Wei Liu, Dexuan Cui, Michael S. Tsirkin,
Mark Brown, Abel Vesa, Stephen Boyd, Brian Masney, Jerome Brunet,
Bjorn Andersson, Mathieu Poirier, Srinivas Kandagatla,
Sylwester Nawrocki, Liam Girdwood, Jaroslav Kysela
Cc: Jonathan Corbet, Rafael J. Wysocki, Steven Rostedt,
Bradley Morgan, Armin Wolf, Masami Hiramatsu, linux-doc,
driver-core, linux-kernel, linux-trace-kernel, linux-pci,
Alex Williamson, Mostafa Saleh, kvm, qat-linux, virtualization,
intel-xe, Vineeth Vijayan, Peter Oberparleiter, Heiko Carstens,
Vasily Gorbik, Alexander Gordeev, linux-s390, linux-hyperv,
linux-spi, Frank Li, Sascha Hauer, linux-clk, imx,
linux-arm-kernel, linux-remoteproc, linux-arm-msm, linux-sound,
Takashi Iwai
Hello,
here comes v2 which addresses the review feedback I got for (implicit)
v1. See https://lore.kernel.org/linux-kernel/20261116110853.3418077-2-u.kleine-koenig@baylibre.com
for the discussion about that previous submission.
The objective is to deny force binding a device to a driver that isn't
prepared for that. There are many drivers that run in a null pointer
exception when this happens and only very few drivers are supposed to be
used like that. So the first patch implements an explicit opt-in for
drivers and denies other matches; the remaining patches implement the
opt-in for drivers that rely on it. This makes it unnecessary to fix
individual drivers to explicitly refuse such bindings. See commit
1e50a0349012 ("iio: adc: mcp3564: reject devices without match data")
for an example of such a driver-specific fix.
Changes since (implicit) v1:
- Rework parameter parsing to just use `allow_driver_override` on the
kernel commandline
- Add review tags
- Add patches by Alex Williamson setting .support_driver_override in
pci and vfio drivers
- Add patches for uio, spidev and a few more drivers setting
.support_driver_override
- align wording in Documentation/admin-guide/tainted-kernels.rst with
tools/debugging/kernel-chktaint
It is sensible to merge the driver core change (patch #1) together with
the individual driver patches setting .support_driver_override because
with the driver core change the driver override doesn't work any more
for the unmodified drivers (unless the new kernel parameter is provided
and a taint is accepted). So I suggest (once there is agreement that the
patches are fine) to merge them all in one go and provide a stable
branch in case a driver was missed to be adapted. I can create such a
branch and ask Greg or Linus to pull it, or Greg can do that.
So if you're the maintainer of one of the drivers touched by patches #2
and later and assuming your ok with that patch, please provide your Ack
(plus the required coordination if applicable) for not merging via your
usual tree.
Best regards
Uwe
Alex Williamson (3):
PCI: Allow untainted driver_override for PCI stub drivers
vfio: Allow untainted use of driver_override
s390/vfio: Allow untainted use of driver_override
Uwe Kleine-König (7):
driver core: Disable driver overriding by default
uio: Allow untainted use of driver_override
spi: spidev: Allow untainted use of driver_override
clk: imx: scu: Allow untainted use of driver_override
remoteproc: Allow untainted use of driver_override
slimbus: qcom-ngd-ctrl: Allow untainted use of driver_override
ASoC: samsung: i2s: Allow untainted use of driver_override
.../admin-guide/kernel-parameters.txt | 6 +++
Documentation/admin-guide/tainted-kernels.rst | 54 ++++++++++---------
drivers/base/bus.c | 51 ++++++++++++++++++
drivers/clk/imx/clk-scu.c | 1 +
drivers/pci/pci-pf-stub.c | 1 +
drivers/pci/pci-stub.c | 1 +
drivers/rpmsg/rpmsg_ctrl.c | 1 +
drivers/rpmsg/rpmsg_ns.c | 5 +-
drivers/s390/cio/vfio_ccw_drv.c | 1 +
drivers/s390/crypto/vfio_ap_drv.c | 1 +
drivers/slimbus/qcom-ngd-ctrl.c | 1 +
drivers/spi/spidev.c | 1 +
drivers/uio/uio_dmem_genirq.c | 1 +
drivers/uio/uio_hv_generic.c | 1 +
drivers/uio/uio_pci_generic.c | 1 +
drivers/uio/uio_pdrv_genirq.c | 1 +
drivers/vfio/cdx/main.c | 1 +
drivers/vfio/fsl-mc/vfio_fsl_mc.c | 1 +
.../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 3 +-
drivers/vfio/pci/ism/main.c | 3 +-
drivers/vfio/pci/mlx5/main.c | 3 +-
drivers/vfio/pci/nvgrace-gpu/main.c | 3 +-
drivers/vfio/pci/pds/pci_drv.c | 3 +-
drivers/vfio/pci/qat/main.c | 3 +-
drivers/vfio/pci/vfio_pci.c | 3 +-
drivers/vfio/pci/virtio/main.c | 3 +-
drivers/vfio/pci/xe/main.c | 3 +-
drivers/vfio/platform/vfio_amba.c | 1 +
drivers/vfio/platform/vfio_platform.c | 1 +
include/linux/device.h | 19 +------
include/linux/device/driver.h | 2 +
include/linux/panic.h | 3 +-
include/trace/events/module.h | 3 +-
kernel/panic.c | 3 +-
sound/soc/samsung/i2s.c | 1 +
tools/debugging/kernel-chktaint | 9 ++++
36 files changed, 144 insertions(+), 55 deletions(-)
base-commit: 7cfbf79c66c63e807ea452abf0546e6f6d6833a6
--
2.56.0.rc1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v2 03/10] vfio: Allow untainted use of driver_override
2026-11-20 11:11 [PATCH v2 00/10] driver core: Disable driver overriding by default Uwe Kleine-König
@ 2026-11-20 11:11 ` Uwe Kleine-König
0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König @ 2026-11-20 11:11 UTC (permalink / raw)
To: Greg Kroah-Hartman, Nipun Gupta, Nikhil Agarwal, Ioana Ciornei,
Longfang Liu, Julian Ruess, Ankit Agrawal, Brett Creeley,
Giovanni Cabiddu, Michał Winiarski, Eric Auger
Cc: Alex Williamson, Mostafa Saleh, kvm, qat-linux, virtualization,
intel-xe
From: Alex Williamson <alex@shazbot.org>
Driver overrides are the standard mechanism for binding vfio drivers
to devices. With the introduction of the support_driver_override flag
in the core driver struct, it's now required for drivers to declare
themselves as driver_override compatible, otherwise driver_override
bindings will be denied or generate a kernel taint.
Set the support_driver_override flag on the driver struct across all
vfio drivers.
Signed-off-by: Alex Williamson <alex@shazbot.org>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Reviewed-by: Mostafa Saleh <smostafa@google.com>
Reviewed-by: Ankit Agrawal <ankita@nvidia.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/vfio/cdx/main.c | 1 +
drivers/vfio/fsl-mc/vfio_fsl_mc.c | 1 +
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 3 ++-
drivers/vfio/pci/ism/main.c | 3 ++-
drivers/vfio/pci/mlx5/main.c | 3 ++-
drivers/vfio/pci/nvgrace-gpu/main.c | 3 ++-
drivers/vfio/pci/pds/pci_drv.c | 3 ++-
drivers/vfio/pci/qat/main.c | 3 ++-
drivers/vfio/pci/vfio_pci.c | 3 ++-
drivers/vfio/pci/virtio/main.c | 3 ++-
drivers/vfio/pci/xe/main.c | 3 ++-
drivers/vfio/platform/vfio_amba.c | 1 +
drivers/vfio/platform/vfio_platform.c | 1 +
13 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/drivers/vfio/cdx/main.c b/drivers/vfio/cdx/main.c
index 28dc8c825600..fb7679bf92fd 100644
--- a/drivers/vfio/cdx/main.c
+++ b/drivers/vfio/cdx/main.c
@@ -358,6 +358,7 @@ static struct cdx_driver vfio_cdx_driver = {
.match_id_table = vfio_cdx_table,
.driver = {
.name = "vfio-cdx",
+ .support_driver_override = true,
},
.driver_managed_dma = true,
};
diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
index 15b05b8c0c90..1603f81e0257 100644
--- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c
+++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
@@ -597,6 +597,7 @@ static struct fsl_mc_driver vfio_fsl_mc_driver = {
.remove = vfio_fsl_mc_remove,
.driver = {
.name = "vfio-fsl-mc",
+ .support_driver_override = true,
},
.driver_managed_dma = true,
};
diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
index c82c59246a3f..5c56aff8db01 100644
--- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
+++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
@@ -1737,7 +1737,8 @@ static struct pci_driver hisi_acc_vfio_pci_driver = {
.id_table = hisi_acc_vfio_pci_table,
.probe = hisi_acc_vfio_pci_probe,
.remove = hisi_acc_vfio_pci_remove,
- .driver = { .pm = pm_ptr(&hisi_acc_vf_pm_ops) },
+ .driver = { .pm = pm_ptr(&hisi_acc_vf_pm_ops),
+ .support_driver_override = true },
.err_handler = &hisi_acc_vf_err_handlers,
.driver_managed_dma = true,
};
diff --git a/drivers/vfio/pci/ism/main.c b/drivers/vfio/pci/ism/main.c
index cce3bdf1f070..263b377e87c4 100644
--- a/drivers/vfio/pci/ism/main.c
+++ b/drivers/vfio/pci/ism/main.c
@@ -399,7 +399,8 @@ static struct pci_driver ism_vfio_pci_driver = {
.id_table = ism_device_table,
.probe = ism_vfio_pci_probe,
.remove = ism_vfio_pci_remove,
- .driver = { .pm = pm_ptr(&ism_vfio_pm_ops) },
+ .driver = { .pm = pm_ptr(&ism_vfio_pm_ops),
+ .support_driver_override = true },
.err_handler = &ism_vfio_err_handlers,
.driver_managed_dma = true,
};
diff --git a/drivers/vfio/pci/mlx5/main.c b/drivers/vfio/pci/mlx5/main.c
index 18a6d224b1fd..63c89e461be8 100644
--- a/drivers/vfio/pci/mlx5/main.c
+++ b/drivers/vfio/pci/mlx5/main.c
@@ -1451,7 +1451,8 @@ static struct pci_driver mlx5vf_pci_driver = {
.id_table = mlx5vf_pci_table,
.probe = mlx5vf_pci_probe,
.remove = mlx5vf_pci_remove,
- .driver = { .pm = pm_ptr(&mlx5vf_pm_ops) },
+ .driver = { .pm = pm_ptr(&mlx5vf_pm_ops),
+ .support_driver_override = true },
.err_handler = &mlx5vf_err_handlers,
.driver_managed_dma = true,
};
diff --git a/drivers/vfio/pci/nvgrace-gpu/main.c b/drivers/vfio/pci/nvgrace-gpu/main.c
index 5ddec340b73b..946da32c61ff 100644
--- a/drivers/vfio/pci/nvgrace-gpu/main.c
+++ b/drivers/vfio/pci/nvgrace-gpu/main.c
@@ -1438,7 +1438,8 @@ static struct pci_driver nvgrace_gpu_vfio_pci_driver = {
.id_table = nvgrace_gpu_vfio_pci_table,
.probe = nvgrace_gpu_probe,
.remove = nvgrace_gpu_remove,
- .driver = { .pm = pm_ptr(&nvgrace_gpu_pm_ops) },
+ .driver = { .pm = pm_ptr(&nvgrace_gpu_pm_ops),
+ .support_driver_override = true },
.err_handler = &nvgrace_gpu_vfio_pci_err_handlers,
.driver_managed_dma = true,
};
diff --git a/drivers/vfio/pci/pds/pci_drv.c b/drivers/vfio/pci/pds/pci_drv.c
index cf7e33d4d17b..1fcef987f1b0 100644
--- a/drivers/vfio/pci/pds/pci_drv.c
+++ b/drivers/vfio/pci/pds/pci_drv.c
@@ -184,7 +184,8 @@ static struct pci_driver pds_vfio_pci_driver = {
.id_table = pds_vfio_pci_table,
.probe = pds_vfio_pci_probe,
.remove = pds_vfio_pci_remove,
- .driver = { .pm = pm_ptr(&pds_vfio_pm_ops) },
+ .driver = { .pm = pm_ptr(&pds_vfio_pm_ops),
+ .support_driver_override = true },
.err_handler = &pds_vfio_pci_err_handlers,
.driver_managed_dma = true,
};
diff --git a/drivers/vfio/pci/qat/main.c b/drivers/vfio/pci/qat/main.c
index 69448fa57df4..8a616f9b6494 100644
--- a/drivers/vfio/pci/qat/main.c
+++ b/drivers/vfio/pci/qat/main.c
@@ -695,7 +695,8 @@ static struct pci_driver qat_vf_vfio_pci_driver = {
.id_table = qat_vf_vfio_pci_table,
.probe = qat_vf_vfio_pci_probe,
.remove = qat_vf_vfio_pci_remove,
- .driver = { .pm = pm_ptr(&qat_vf_pm_ops) },
+ .driver = { .pm = pm_ptr(&qat_vf_pm_ops),
+ .support_driver_override = true },
.err_handler = &qat_vf_err_handlers,
.driver_managed_dma = true,
};
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index e7c012febe91..fde2c3fc88eb 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -260,7 +260,8 @@ static struct pci_driver vfio_pci_driver = {
.remove = vfio_pci_remove,
.sriov_configure = vfio_pci_sriov_configure,
.err_handler = &vfio_pci_err_handlers,
- .driver = { .pm = pm_ptr(&vfio_pci_pm_ops) },
+ .driver = { .pm = pm_ptr(&vfio_pci_pm_ops),
+ .support_driver_override = true },
.driver_managed_dma = true,
};
diff --git a/drivers/vfio/pci/virtio/main.c b/drivers/vfio/pci/virtio/main.c
index 123ff5193812..1e02a8fd4a61 100644
--- a/drivers/vfio/pci/virtio/main.c
+++ b/drivers/vfio/pci/virtio/main.c
@@ -222,7 +222,8 @@ static struct pci_driver virtiovf_pci_driver = {
.id_table = virtiovf_pci_table,
.probe = virtiovf_pci_probe,
.remove = virtiovf_pci_remove,
- .driver = { .pm = pm_ptr(&virtiovf_pm_ops) },
+ .driver = { .pm = pm_ptr(&virtiovf_pm_ops),
+ .support_driver_override = true },
.err_handler = &virtiovf_err_handlers,
.driver_managed_dma = true,
};
diff --git a/drivers/vfio/pci/xe/main.c b/drivers/vfio/pci/xe/main.c
index 7dab3e024aa8..e0ab61f604de 100644
--- a/drivers/vfio/pci/xe/main.c
+++ b/drivers/vfio/pci/xe/main.c
@@ -592,7 +592,8 @@ static struct pci_driver xe_vfio_pci_driver = {
.id_table = xe_vfio_pci_table,
.probe = xe_vfio_pci_probe,
.remove = xe_vfio_pci_remove,
- .driver = { .pm = pm_ptr(&xe_vfio_pm_ops) },
+ .driver = { .pm = pm_ptr(&xe_vfio_pm_ops),
+ .support_driver_override = true },
.err_handler = &xe_vfio_pci_err_handlers,
.driver_managed_dma = true,
};
diff --git a/drivers/vfio/platform/vfio_amba.c b/drivers/vfio/platform/vfio_amba.c
index fa754f203b2d..2c87caf1b7f7 100644
--- a/drivers/vfio/platform/vfio_amba.c
+++ b/drivers/vfio/platform/vfio_amba.c
@@ -137,6 +137,7 @@ static struct amba_driver vfio_amba_driver = {
.id_table = vfio_amba_ids,
.drv = {
.name = "vfio-amba",
+ .support_driver_override = true,
},
.driver_managed_dma = true,
};
diff --git a/drivers/vfio/platform/vfio_platform.c b/drivers/vfio/platform/vfio_platform.c
index a4d3ace3e02d..93d06032cdde 100644
--- a/drivers/vfio/platform/vfio_platform.c
+++ b/drivers/vfio/platform/vfio_platform.c
@@ -116,6 +116,7 @@ static struct platform_driver vfio_platform_driver = {
.remove = vfio_platform_remove,
.driver = {
.name = "vfio-platform",
+ .support_driver_override = true,
},
.driver_managed_dma = true,
};
--
2.56.0.rc1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-20 11:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 11:11 [PATCH v2 00/10] driver core: Disable driver overriding by default Uwe Kleine-König
2026-11-20 11:11 ` [PATCH v2 03/10] vfio: Allow untainted use of driver_override Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox