* [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 04/10] s390/vfio: Allow untainted use of driver_override Uwe Kleine-König
` (2 more replies)
0 siblings, 3 replies; 13+ 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] 13+ messages in thread
* [PATCH v2 04/10] s390/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
2026-11-20 11:58 ` Harald Freudenberger
` (2 more replies)
2026-11-21 1:16 ` [PATCH v2 00/10] driver core: Disable driver overriding by default Danilo Krummrich
2026-11-26 1:57 ` Gary Guo
2 siblings, 3 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2026-11-20 11:11 UTC (permalink / raw)
To: Greg Kroah-Hartman, Eric Farman, Matthew Rosato, Tony Krowiak,
Jason Herne, Harald Freudenberger, Holger Dengler
Cc: Alex Williamson, Vineeth Vijayan, Peter Oberparleiter,
Heiko Carstens, Vasily Gorbik, Alexander Gordeev, linux-s390, kvm
From: Alex Williamson <alex@shazbot.org>
The vfio_ap and vfio_ccw drivers bind devices through driver_override.
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 vfio_ap and vfio_ccw driver
structs.
Signed-off-by: Alex Williamson <alex@shazbot.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/s390/cio/vfio_ccw_drv.c | 1 +
drivers/s390/crypto/vfio_ap_drv.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c
index 7546bd137e4e..77765cde87f7 100644
--- a/drivers/s390/cio/vfio_ccw_drv.c
+++ b/drivers/s390/cio/vfio_ccw_drv.c
@@ -375,6 +375,7 @@ static struct css_driver vfio_ccw_sch_driver = {
.drv = {
.name = "vfio_ccw",
.owner = THIS_MODULE,
+ .support_driver_override = true,
},
.subchannel_type = vfio_ccw_sch_ids,
.irq = vfio_ccw_sch_irq,
diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
index 8e69ed286bb9..2d47dc643269 100644
--- a/drivers/s390/crypto/vfio_ap_drv.c
+++ b/drivers/s390/crypto/vfio_ap_drv.c
@@ -62,6 +62,7 @@ static struct ap_driver vfio_ap_drv = {
.on_config_changed = vfio_ap_on_cfg_changed,
.on_scan_complete = vfio_ap_on_scan_complete,
.ids = ap_queue_ids,
+ .driver.support_driver_override = true,
};
static void vfio_ap_matrix_dev_release(struct device *dev)
--
2.56.0.rc1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 04/10] s390/vfio: Allow untainted use of driver_override
2026-11-20 11:11 ` [PATCH v2 04/10] s390/vfio: Allow untainted use of driver_override Uwe Kleine-König
@ 2026-11-20 11:58 ` Harald Freudenberger
2026-11-20 14:05 ` Uwe Kleine-König
2026-11-23 13:55 ` Harald Freudenberger
2026-11-30 8:13 ` Harald Freudenberger
2 siblings, 1 reply; 13+ messages in thread
From: Harald Freudenberger @ 2026-11-20 11:58 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Greg Kroah-Hartman, Eric Farman, Matthew Rosato, Tony Krowiak,
Jason Herne, Holger Dengler, Alex Williamson, Vineeth Vijayan,
Peter Oberparleiter, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, linux-s390, kvm
On 2026-11-20 12:11, Uwe Kleine-König wrote:
> From: Alex Williamson <alex@shazbot.org>
>
> The vfio_ap and vfio_ccw drivers bind devices through driver_override.
> 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 vfio_ap and vfio_ccw driver
> structs.
>
> Signed-off-by: Alex Williamson <alex@shazbot.org>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/s390/cio/vfio_ccw_drv.c | 1 +
> drivers/s390/crypto/vfio_ap_drv.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/drivers/s390/cio/vfio_ccw_drv.c
> b/drivers/s390/cio/vfio_ccw_drv.c
> index 7546bd137e4e..77765cde87f7 100644
> --- a/drivers/s390/cio/vfio_ccw_drv.c
> +++ b/drivers/s390/cio/vfio_ccw_drv.c
> @@ -375,6 +375,7 @@ static struct css_driver vfio_ccw_sch_driver = {
> .drv = {
> .name = "vfio_ccw",
> .owner = THIS_MODULE,
> + .support_driver_override = true,
> },
> .subchannel_type = vfio_ccw_sch_ids,
> .irq = vfio_ccw_sch_irq,
> diff --git a/drivers/s390/crypto/vfio_ap_drv.c
> b/drivers/s390/crypto/vfio_ap_drv.c
> index 8e69ed286bb9..2d47dc643269 100644
> --- a/drivers/s390/crypto/vfio_ap_drv.c
> +++ b/drivers/s390/crypto/vfio_ap_drv.c
> @@ -62,6 +62,7 @@ static struct ap_driver vfio_ap_drv = {
> .on_config_changed = vfio_ap_on_cfg_changed,
> .on_scan_complete = vfio_ap_on_scan_complete,
> .ids = ap_queue_ids,
> + .driver.support_driver_override = true,
> };
>
> static void vfio_ap_matrix_dev_release(struct device *dev)
Hm, honestly I don' get this...
The driver_override is a bus thing. So the AP bus has support for
driver_override.
The sysfs functions are in drivers/s390/crypto/ap_queue.c. There exist
currently
two drivers which shall be bound to an AP queue: vfio_ap and the default
driver
which is the zcrypt driver "cex4queue". It sounds like the driver needs
the
tagging about driver_override support and then similar to the
vfio_ap_drv.c
the static struct ap_driver initialization may also need a
.driver.support_driver_override = true line.
regards
Harald Freudenberger
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 04/10] s390/vfio: Allow untainted use of driver_override
2026-11-20 11:58 ` Harald Freudenberger
@ 2026-11-20 14:05 ` Uwe Kleine-König
2026-11-23 16:31 ` Christian Borntraeger
0 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2026-11-20 14:05 UTC (permalink / raw)
To: Harald Freudenberger
Cc: Greg Kroah-Hartman, Eric Farman, Matthew Rosato, Tony Krowiak,
Jason Herne, Holger Dengler, Alex Williamson, Vineeth Vijayan,
Peter Oberparleiter, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, linux-s390, kvm
[-- Attachment #1: Type: text/plain, Size: 3059 bytes --]
On Fri, Nov 20, 2026 at 12:58:52PM +0100, Harald Freudenberger wrote:
> On 2026-11-20 12:11, Uwe Kleine-König wrote:
> > From: Alex Williamson <alex@shazbot.org>
> >
> > The vfio_ap and vfio_ccw drivers bind devices through driver_override.
> > 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 vfio_ap and vfio_ccw driver
> > structs.
> >
> > Signed-off-by: Alex Williamson <alex@shazbot.org>
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> > ---
> > drivers/s390/cio/vfio_ccw_drv.c | 1 +
> > drivers/s390/crypto/vfio_ap_drv.c | 1 +
> > 2 files changed, 2 insertions(+)
> >
> > diff --git a/drivers/s390/cio/vfio_ccw_drv.c
> > b/drivers/s390/cio/vfio_ccw_drv.c
> > index 7546bd137e4e..77765cde87f7 100644
> > --- a/drivers/s390/cio/vfio_ccw_drv.c
> > +++ b/drivers/s390/cio/vfio_ccw_drv.c
> > @@ -375,6 +375,7 @@ static struct css_driver vfio_ccw_sch_driver = {
> > .drv = {
> > .name = "vfio_ccw",
> > .owner = THIS_MODULE,
> > + .support_driver_override = true,
> > },
> > .subchannel_type = vfio_ccw_sch_ids,
> > .irq = vfio_ccw_sch_irq,
> > diff --git a/drivers/s390/crypto/vfio_ap_drv.c
> > b/drivers/s390/crypto/vfio_ap_drv.c
> > index 8e69ed286bb9..2d47dc643269 100644
> > --- a/drivers/s390/crypto/vfio_ap_drv.c
> > +++ b/drivers/s390/crypto/vfio_ap_drv.c
> > @@ -62,6 +62,7 @@ static struct ap_driver vfio_ap_drv = {
> > .on_config_changed = vfio_ap_on_cfg_changed,
> > .on_scan_complete = vfio_ap_on_scan_complete,
> > .ids = ap_queue_ids,
> > + .driver.support_driver_override = true,
> > };
> >
> > static void vfio_ap_matrix_dev_release(struct device *dev)
>
> Hm, honestly I don' get this...
> The driver_override is a bus thing. So the AP bus has support for
> driver_override.
Yes, and ap_device_probe() calls device_match_driver_override() which
requires .driver.support_driver_override to be true to make the override
work.
> The sysfs functions are in drivers/s390/crypto/ap_queue.c. There exist
> currently
> two drivers which shall be bound to an AP queue: vfio_ap and the default
> driver
> which is the zcrypt driver "cex4queue". It sounds like the driver needs the
> tagging about driver_override support and then similar to the vfio_ap_drv.c
> the static struct ap_driver initialization may also need a
> .driver.support_driver_override = true line.
Can you please talk in form of a patch? I have difficulties following
your words. (Hint: "the driver" is ambigous if you just talked about two
different ones. Also what is "the static struct ap_driver
initialization"?)
Alternatively something like: "I tested you changes and the xyz driver
fails to bind, this is the respective kernel output: ..." would be
welcome, too.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 00/10] driver core: Disable driver overriding by default
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 04/10] s390/vfio: Allow untainted use of driver_override Uwe Kleine-König
@ 2026-11-21 1:16 ` Danilo Krummrich
2026-11-26 1:57 ` Gary Guo
2 siblings, 0 replies; 13+ messages in thread
From: Danilo Krummrich @ 2026-11-21 1:16 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Greg Kroah-Hartman, 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,
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
On Fri Nov 20, 2026 at 12:11 PM CET, Uwe Kleine-König wrote:
> 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.
I think it should be good enough to just take them all through driver-core. If
it turns out in linux-next that we missed a driver we can always add another
patch to the driver-core tree.
Those patches only set support_driver_override = true, so there shouldn't be
interactions with other trees.
So, let's keep it simple. I can pick this up once we have all the ACKs.
Thanks,
Danilo
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 04/10] s390/vfio: Allow untainted use of driver_override
2026-11-20 11:11 ` [PATCH v2 04/10] s390/vfio: Allow untainted use of driver_override Uwe Kleine-König
2026-11-20 11:58 ` Harald Freudenberger
@ 2026-11-23 13:55 ` Harald Freudenberger
2026-11-23 14:48 ` Alex Williamson
2026-11-30 8:13 ` Harald Freudenberger
2 siblings, 1 reply; 13+ messages in thread
From: Harald Freudenberger @ 2026-11-23 13:55 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Greg Kroah-Hartman, Eric Farman, Matthew Rosato, Tony Krowiak,
Jason Herne, Holger Dengler, Alex Williamson, Vineeth Vijayan,
Peter Oberparleiter, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, linux-s390, kvm
On 2026-11-20 12:11, Uwe Kleine-König wrote:
> From: Alex Williamson <alex@shazbot.org>
>
> The vfio_ap and vfio_ccw drivers bind devices through driver_override.
> 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 vfio_ap and vfio_ccw driver
> structs.
>
> Signed-off-by: Alex Williamson <alex@shazbot.org>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/s390/cio/vfio_ccw_drv.c | 1 +
> drivers/s390/crypto/vfio_ap_drv.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/drivers/s390/cio/vfio_ccw_drv.c
> b/drivers/s390/cio/vfio_ccw_drv.c
> index 7546bd137e4e..77765cde87f7 100644
> --- a/drivers/s390/cio/vfio_ccw_drv.c
> +++ b/drivers/s390/cio/vfio_ccw_drv.c
> @@ -375,6 +375,7 @@ static struct css_driver vfio_ccw_sch_driver = {
> .drv = {
> .name = "vfio_ccw",
> .owner = THIS_MODULE,
> + .support_driver_override = true,
> },
> .subchannel_type = vfio_ccw_sch_ids,
> .irq = vfio_ccw_sch_irq,
> diff --git a/drivers/s390/crypto/vfio_ap_drv.c
> b/drivers/s390/crypto/vfio_ap_drv.c
> index 8e69ed286bb9..2d47dc643269 100644
> --- a/drivers/s390/crypto/vfio_ap_drv.c
> +++ b/drivers/s390/crypto/vfio_ap_drv.c
> @@ -62,6 +62,7 @@ static struct ap_driver vfio_ap_drv = {
> .on_config_changed = vfio_ap_on_cfg_changed,
> .on_scan_complete = vfio_ap_on_scan_complete,
> .ids = ap_queue_ids,
> + .driver.support_driver_override = true,
> };
>
> static void vfio_ap_matrix_dev_release(struct device *dev)
Please add the s390 zcrypt device driver ("cex4queue") to this patch:
diff --git a/drivers/s390/crypto/zcrypt_cex4.c
b/drivers/s390/crypto/zcrypt_cex4.c
index 43871cd89b04..2765f82f32d6 100644
--- a/drivers/s390/crypto/zcrypt_cex4.c
+++ b/drivers/s390/crypto/zcrypt_cex4.c
@@ -746,6 +746,7 @@ static void zcrypt_cex4_queue_remove(struct
ap_device *ap_dev)
}
static struct ap_driver zcrypt_cex4_queue_driver = {
+ .driver.support_driver_override = true,
.probe = zcrypt_cex4_queue_probe,
.remove = zcrypt_cex4_queue_remove,
.ids = zcrypt_cex4_queue_ids,
and when done add
Acked-by: Harald Freudenberger <freude@linux.ibm.com>
Thanks
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 04/10] s390/vfio: Allow untainted use of driver_override
2026-11-23 13:55 ` Harald Freudenberger
@ 2026-11-23 14:48 ` Alex Williamson
0 siblings, 0 replies; 13+ messages in thread
From: Alex Williamson @ 2026-11-23 14:48 UTC (permalink / raw)
To: Harald Freudenberger
Cc: Uwe Kleine-König, Greg Kroah-Hartman, Eric Farman,
Matthew Rosato, Tony Krowiak, Jason Herne, Holger Dengler,
Vineeth Vijayan, Peter Oberparleiter, Heiko Carstens,
Vasily Gorbik, Alexander Gordeev, linux-s390, kvm, alex
On Mon, 23 Nov 2026 14:55:36 +0100
Harald Freudenberger <freude@linux.ibm.com> wrote:
> On 2026-11-20 12:11, Uwe Kleine-König wrote:
> > From: Alex Williamson <alex@shazbot.org>
> >
> > The vfio_ap and vfio_ccw drivers bind devices through driver_override.
> > 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 vfio_ap and vfio_ccw driver
> > structs.
> >
> > Signed-off-by: Alex Williamson <alex@shazbot.org>
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> > ---
> > drivers/s390/cio/vfio_ccw_drv.c | 1 +
> > drivers/s390/crypto/vfio_ap_drv.c | 1 +
> > 2 files changed, 2 insertions(+)
> >
> > diff --git a/drivers/s390/cio/vfio_ccw_drv.c
> > b/drivers/s390/cio/vfio_ccw_drv.c
> > index 7546bd137e4e..77765cde87f7 100644
> > --- a/drivers/s390/cio/vfio_ccw_drv.c
> > +++ b/drivers/s390/cio/vfio_ccw_drv.c
> > @@ -375,6 +375,7 @@ static struct css_driver vfio_ccw_sch_driver = {
> > .drv = {
> > .name = "vfio_ccw",
> > .owner = THIS_MODULE,
> > + .support_driver_override = true,
> > },
> > .subchannel_type = vfio_ccw_sch_ids,
> > .irq = vfio_ccw_sch_irq,
> > diff --git a/drivers/s390/crypto/vfio_ap_drv.c
> > b/drivers/s390/crypto/vfio_ap_drv.c
> > index 8e69ed286bb9..2d47dc643269 100644
> > --- a/drivers/s390/crypto/vfio_ap_drv.c
> > +++ b/drivers/s390/crypto/vfio_ap_drv.c
> > @@ -62,6 +62,7 @@ static struct ap_driver vfio_ap_drv = {
> > .on_config_changed = vfio_ap_on_cfg_changed,
> > .on_scan_complete = vfio_ap_on_scan_complete,
> > .ids = ap_queue_ids,
> > + .driver.support_driver_override = true,
> > };
> >
> > static void vfio_ap_matrix_dev_release(struct device *dev)
>
> Please add the s390 zcrypt device driver ("cex4queue") to this patch:
>
> diff --git a/drivers/s390/crypto/zcrypt_cex4.c
> b/drivers/s390/crypto/zcrypt_cex4.c
> index 43871cd89b04..2765f82f32d6 100644
> --- a/drivers/s390/crypto/zcrypt_cex4.c
> +++ b/drivers/s390/crypto/zcrypt_cex4.c
> @@ -746,6 +746,7 @@ static void zcrypt_cex4_queue_remove(struct
> ap_device *ap_dev)
> }
>
> static struct ap_driver zcrypt_cex4_queue_driver = {
> + .driver.support_driver_override = true,
> .probe = zcrypt_cex4_queue_probe,
> .remove = zcrypt_cex4_queue_remove,
> .ids = zcrypt_cex4_queue_ids,
>
> and when done add
> Acked-by: Harald Freudenberger <freude@linux.ibm.com>
That's not a vfio driver, it needs to make its own case for why it
needs to support driver_override. Thanks,
Alex
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 04/10] s390/vfio: Allow untainted use of driver_override
2026-11-20 14:05 ` Uwe Kleine-König
@ 2026-11-23 16:31 ` Christian Borntraeger
2026-11-26 10:01 ` Uwe Kleine-König
0 siblings, 1 reply; 13+ messages in thread
From: Christian Borntraeger @ 2026-11-23 16:31 UTC (permalink / raw)
To: Uwe Kleine-König, Harald Freudenberger
Cc: Greg Kroah-Hartman, Eric Farman, Matthew Rosato, Tony Krowiak,
Jason Herne, Holger Dengler, Alex Williamson, Vineeth Vijayan,
Peter Oberparleiter, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, linux-s390, kvm
Am 20.11.26 um 15:05 schrieb Uwe Kleine-König:
> On Fri, Nov 20, 2026 at 12:58:52PM +0100, Harald Freudenberger wrote:
>> On 2026-11-20 12:11, Uwe Kleine-König wrote:
>>> From: Alex Williamson <alex@shazbot.org>
>>>
>>> The vfio_ap and vfio_ccw drivers bind devices through driver_override.
>>> 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 vfio_ap and vfio_ccw driver
>>> structs.
>>>
>>> Signed-off-by: Alex Williamson <alex@shazbot.org>
>>> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
>>> ---
>>> drivers/s390/cio/vfio_ccw_drv.c | 1 +
>>> drivers/s390/crypto/vfio_ap_drv.c | 1 +
>>> 2 files changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/s390/cio/vfio_ccw_drv.c
>>> b/drivers/s390/cio/vfio_ccw_drv.c
>>> index 7546bd137e4e..77765cde87f7 100644
>>> --- a/drivers/s390/cio/vfio_ccw_drv.c
>>> +++ b/drivers/s390/cio/vfio_ccw_drv.c
>>> @@ -375,6 +375,7 @@ static struct css_driver vfio_ccw_sch_driver = {
>>> .drv = {
>>> .name = "vfio_ccw",
>>> .owner = THIS_MODULE,
>>> + .support_driver_override = true,
>>> },
>>> .subchannel_type = vfio_ccw_sch_ids,
>>> .irq = vfio_ccw_sch_irq,
>>> diff --git a/drivers/s390/crypto/vfio_ap_drv.c
>>> b/drivers/s390/crypto/vfio_ap_drv.c
>>> index 8e69ed286bb9..2d47dc643269 100644
>>> --- a/drivers/s390/crypto/vfio_ap_drv.c
>>> +++ b/drivers/s390/crypto/vfio_ap_drv.c
>>> @@ -62,6 +62,7 @@ static struct ap_driver vfio_ap_drv = {
>>> .on_config_changed = vfio_ap_on_cfg_changed,
>>> .on_scan_complete = vfio_ap_on_scan_complete,
>>> .ids = ap_queue_ids,
>>> + .driver.support_driver_override = true,
>>> };
>>>
>>> static void vfio_ap_matrix_dev_release(struct device *dev)
>>
>> Hm, honestly I don' get this...
>> The driver_override is a bus thing. So the AP bus has support for
>> driver_override.
>
> Yes, and ap_device_probe() calls device_match_driver_override() which
> requires .driver.support_driver_override to be true to make the override
> work.
>
>> The sysfs functions are in drivers/s390/crypto/ap_queue.c. There exist
>> currently
>> two drivers which shall be bound to an AP queue: vfio_ap and the default
>> driver
>> which is the zcrypt driver "cex4queue". It sounds like the driver needs the
>> tagging about driver_override support and then similar to the vfio_ap_drv.c
>> the static struct ap_driver initialization may also need a
>> .driver.support_driver_override = true line.
>
> Can you please talk in form of a patch? I have difficulties following
> your words. (Hint: "the driver" is ambigous if you just talked about two
> different ones. Also what is "the static struct ap_driver
> initialization"?)
>
> Alternatively something like: "I tested you changes and the xyz driver
> fails to bind, this is the respective kernel output: ..." would be
> welcome, too.
So let me try to translate
On s390, driver_override is how a device moves
between the host and a guest, in both directions:
driverctl -b css set-override 0.0.0004 vfio_ccw # to the guest
driverctl -b css set-override 0.0.0004 io_subchannel # back to the host
driverctl -b ap set-override 17.0005 vfio_ap # to the guest
driverctl -b ap set-override 17.0005 cex4queue # back to the host
Your series keeps the first direction working but breaks the second
one, because io_subchannel_driver and zcrypt_cex4_queue_driver do not
set support_driver_override. On the AP bus this is unwanted:
driver_override and apmask/aqmask are mutually exclusive
(46030379f13c "s390/ap: Restrict driver_override versus apmask and
aqmask use"), so once overrides are in use there is no other way to
assign a queue to zcrypt.
We want to keep the way back working, and there is no reason not to.
The problem patch 1 addresses, i.e. a driver being forced onto a
device it was never written for, cannot happen on these two buses:
- css_bus_match() still requires the driver's subchannel_type to match
after the override matched. This was a deliberate design decision
when driver_override was added for css (ebc3d17915034 "s390/cio:
introduce driver_override on the css bus": "unlike pci we still
require a driver override to match the subchannel type")
- ap_bus_match() always does the device type match. driver_override
only decides in ap_device_probe() which of the matching drivers
gets the queue, and the AP bus handles an override to the default
driver explicitly (ap_owned_by_def_drv()).
So on css and AP, driver_override never force binds anything. It only
selects between drivers that already match the device, and
io_subchannel and cex4queue are the regular drivers for exactly these
devices. They are unbound and rebound every time a device moves to
vfio and back.
I am not aware of a single bug report caused by driver_override on these
buses, so tainting or denying here would only break working setups
without fixing anything.
As these two are not vfio drivers, this should not be folded into
04/10.
We (s390 team) should probably send two followup patches, simple oneliners
s390/cio: Allow untainted use of driver_override for io_subchannel
sets .support_driver_override in io_subchannel_driver.drv
(drivers/s390/cio/device.c)
s390/zcrypt: Allow untainted use of driver_override for cex4queue
sets .driver.support_driver_override in zcrypt_cex4_queue_driver
(drivers/s390/crypto/zcrypt_cex4.c)
Peter/Vineeth for cio and Harald for zcrypt: could you provide such
changes as additional patches?
Uwe, would you be willing to take those in your series?
With these two patches included, for 04/10:
Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
also for merging through driver-core.
Christian
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 00/10] driver core: Disable driver overriding by default
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 04/10] s390/vfio: Allow untainted use of driver_override Uwe Kleine-König
2026-11-21 1:16 ` [PATCH v2 00/10] driver core: Disable driver overriding by default Danilo Krummrich
@ 2026-11-26 1:57 ` Gary Guo
2026-11-26 2:13 ` Gary Guo
2 siblings, 1 reply; 13+ messages in thread
From: Gary Guo @ 2026-11-26 1:57 UTC (permalink / raw)
To: Uwe Kleine-König, 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
On Fri Nov 20, 2026 at 11:11 AM GMT, Uwe Kleine-König wrote:
> 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.
For PCI, there is actually already a mechanism for it -- override_only. VFIO
devices already have that annotation. I think it's a better mechanism. In
addition to providing a useful id_info, you can also say what IDs you want the
override match to become possible.
We can do something like this?
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 2398f03a77c1..2cf4659b36a4 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -218,8 +218,8 @@ static const struct pci_device_id *pci_match_device(struct pci_driver *drv,
if (found_id)
return found_id;
- /* driver_override will always match, send a dummy id */
- if (ret > 0)
+ /* For a forced driver override, send a dummy id */
+ if (ret > 0 && device_forced_driver_override(dev))
return &pci_device_id_any;
return NULL;
}
Where device_forced_driver_override your added logic about parameter and
tainting/warning logic.
I suppose the issue is that only CDX and PCI have this mechanism via ID table.
That said, other buses can gain a bus-specific allow_override field and you just
do
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 720a72ecd174..7539b43961e6 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -563,7 +563,8 @@ static int spi_match_device(struct device *dev, const struct device_driver *drv)
/* Check override first, and if set, only use the named driver */
ret = device_match_driver_override(dev, drv);
- if (ret >= 0)
+ if (ret >= 0 && (sdrv->support_driver_override ||
+ device_force_driver_override(dev, drv)))
return ret;
Thoughts?
Best,
Gary
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 00/10] driver core: Disable driver overriding by default
2026-11-26 1:57 ` Gary Guo
@ 2026-11-26 2:13 ` Gary Guo
0 siblings, 0 replies; 13+ messages in thread
From: Gary Guo @ 2026-11-26 2:13 UTC (permalink / raw)
To: Gary Guo, Uwe Kleine-König, 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
On Thu Nov 26, 2026 at 1:57 AM GMT, Gary Guo wrote:
> On Fri Nov 20, 2026 at 11:11 AM GMT, Uwe Kleine-König wrote:
>> 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.
>
> For PCI, there is actually already a mechanism for it -- override_only. VFIO
> devices already have that annotation. I think it's a better mechanism. In
> addition to providing a useful id_info, you can also say what IDs you want the
> override match to become possible.
>
> We can do something like this?
>
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index 2398f03a77c1..2cf4659b36a4 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -218,8 +218,8 @@ static const struct pci_device_id *pci_match_device(struct pci_driver *drv,
> if (found_id)
> return found_id;
>
> - /* driver_override will always match, send a dummy id */
> - if (ret > 0)
> + /* For a forced driver override, send a dummy id */
> + if (ret > 0 && device_forced_driver_override(dev))
> return &pci_device_id_any;
> return NULL;
> }
>
> Where device_forced_driver_override your added logic about parameter and
> tainting/warning logic.
>
> I suppose the issue is that only CDX and PCI have this mechanism via ID table.
> That said, other buses can gain a bus-specific allow_override field and you just
> do
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 720a72ecd174..7539b43961e6 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -563,7 +563,8 @@ static int spi_match_device(struct device *dev, const struct device_driver *drv)
>
> /* Check override first, and if set, only use the named driver */
> ret = device_match_driver_override(dev, drv);
> - if (ret >= 0)
> + if (ret >= 0 && (sdrv->support_driver_override ||
> + device_force_driver_override(dev, drv)))
> return ret;
To add on this, from
https://lore.kernel.org/all/7008c5ea-58fd-4452-a70a-2162cc3d562b@linux.ibm.com/
tt looks like that for some buses, the "driver_override" is a mere preference
mechanism and not forced override, as ID/filter must still match.
I took another look at this direction, and it seems that s390/css, s390/ap, cdx
and vdpa all have this property where forced override wouldn't occur, which is
probably a hint that this direction is worth exploring.
Best,
Gary
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 04/10] s390/vfio: Allow untainted use of driver_override
2026-11-23 16:31 ` Christian Borntraeger
@ 2026-11-26 10:01 ` Uwe Kleine-König
2026-11-27 18:38 ` Peter Oberparleiter
0 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2026-11-26 10:01 UTC (permalink / raw)
To: Christian Borntraeger
Cc: Harald Freudenberger, Greg Kroah-Hartman, Eric Farman,
Matthew Rosato, Tony Krowiak, Jason Herne, Holger Dengler,
Alex Williamson, Vineeth Vijayan, Peter Oberparleiter,
Heiko Carstens, Vasily Gorbik, Alexander Gordeev, linux-s390, kvm
[-- Attachment #1: Type: text/plain, Size: 7625 bytes --]
On Mon, Nov 23, 2026 at 05:31:42PM +0100, Christian Borntraeger wrote:
> Am 20.11.26 um 15:05 schrieb Uwe Kleine-König:
> > On Fri, Nov 20, 2026 at 12:58:52PM +0100, Harald Freudenberger wrote:
> > > On 2026-11-20 12:11, Uwe Kleine-König wrote:
> > > > From: Alex Williamson <alex@shazbot.org>
> > > >
> > > > The vfio_ap and vfio_ccw drivers bind devices through driver_override.
> > > > 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 vfio_ap and vfio_ccw driver
> > > > structs.
> > > >
> > > > Signed-off-by: Alex Williamson <alex@shazbot.org>
> > > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> > > > ---
> > > > drivers/s390/cio/vfio_ccw_drv.c | 1 +
> > > > drivers/s390/crypto/vfio_ap_drv.c | 1 +
> > > > 2 files changed, 2 insertions(+)
> > > >
> > > > diff --git a/drivers/s390/cio/vfio_ccw_drv.c
> > > > b/drivers/s390/cio/vfio_ccw_drv.c
> > > > index 7546bd137e4e..77765cde87f7 100644
> > > > --- a/drivers/s390/cio/vfio_ccw_drv.c
> > > > +++ b/drivers/s390/cio/vfio_ccw_drv.c
> > > > @@ -375,6 +375,7 @@ static struct css_driver vfio_ccw_sch_driver = {
> > > > .drv = {
> > > > .name = "vfio_ccw",
> > > > .owner = THIS_MODULE,
> > > > + .support_driver_override = true,
> > > > },
> > > > .subchannel_type = vfio_ccw_sch_ids,
> > > > .irq = vfio_ccw_sch_irq,
> > > > diff --git a/drivers/s390/crypto/vfio_ap_drv.c
> > > > b/drivers/s390/crypto/vfio_ap_drv.c
> > > > index 8e69ed286bb9..2d47dc643269 100644
> > > > --- a/drivers/s390/crypto/vfio_ap_drv.c
> > > > +++ b/drivers/s390/crypto/vfio_ap_drv.c
> > > > @@ -62,6 +62,7 @@ static struct ap_driver vfio_ap_drv = {
> > > > .on_config_changed = vfio_ap_on_cfg_changed,
> > > > .on_scan_complete = vfio_ap_on_scan_complete,
> > > > .ids = ap_queue_ids,
> > > > + .driver.support_driver_override = true,
> > > > };
> > > >
> > > > static void vfio_ap_matrix_dev_release(struct device *dev)
> > >
> > > Hm, honestly I don' get this...
> > > The driver_override is a bus thing. So the AP bus has support for
> > > driver_override.
> >
> > Yes, and ap_device_probe() calls device_match_driver_override() which
> > requires .driver.support_driver_override to be true to make the override
> > work.
> >
> > > The sysfs functions are in drivers/s390/crypto/ap_queue.c. There exist
> > > currently
> > > two drivers which shall be bound to an AP queue: vfio_ap and the default
> > > driver
> > > which is the zcrypt driver "cex4queue". It sounds like the driver needs the
> > > tagging about driver_override support and then similar to the vfio_ap_drv.c
> > > the static struct ap_driver initialization may also need a
> > > .driver.support_driver_override = true line.
> >
> > Can you please talk in form of a patch? I have difficulties following
> > your words. (Hint: "the driver" is ambigous if you just talked about two
> > different ones. Also what is "the static struct ap_driver
> > initialization"?)
> >
> > Alternatively something like: "I tested you changes and the xyz driver
> > fails to bind, this is the respective kernel output: ..." would be
> > welcome, too.
> So let me try to translate
> On s390, driver_override is how a device moves
> between the host and a guest, in both directions:
>
> driverctl -b css set-override 0.0.0004 vfio_ccw # to the guest
> driverctl -b css set-override 0.0.0004 io_subchannel # back to the host
>
> driverctl -b ap set-override 17.0005 vfio_ap # to the guest
> driverctl -b ap set-override 17.0005 cex4queue # back to the host
>
> Your series keeps the first direction working but breaks the second
> one, because io_subchannel_driver and zcrypt_cex4_queue_driver do not
> set support_driver_override. On the AP bus this is unwanted:
> driver_override and apmask/aqmask are mutually exclusive
> (46030379f13c "s390/ap: Restrict driver_override versus apmask and
> aqmask use"), so once overrides are in use there is no other way to
> assign a queue to zcrypt.
>
> We want to keep the way back working, and there is no reason not to.
> The problem patch 1 addresses, i.e. a driver being forced onto a
> device it was never written for, cannot happen on these two buses:
>
> - css_bus_match() still requires the driver's subchannel_type to match
> after the override matched. This was a deliberate design decision
> when driver_override was added for css (ebc3d17915034 "s390/cio:
> introduce driver_override on the css bus": "unlike pci we still
> require a driver override to match the subchannel type")
>
> - ap_bus_match() always does the device type match. driver_override
> only decides in ap_device_probe() which of the matching drivers
> gets the queue, and the AP bus handles an override to the default
> driver explicitly (ap_owned_by_def_drv()).
>
> So on css and AP, driver_override never force binds anything. It only
> selects between drivers that already match the device, and
> io_subchannel and cex4queue are the regular drivers for exactly these
> devices. They are unbound and rebound every time a device moves to
> vfio and back.
Ah, understood better now. Feels like a misuse of driver_override to me
and because the ap_bus's usecase doesn't match the intention of
driver_override, keeping the bus working is strange as it exposes this
difference.
Without having checked all the details, I wonder if something like that
would be the more robust change then:
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index efd3df3e90ba..2d07bca149cc 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -1398,6 +1398,15 @@ static const struct bus_type css_bus_type = {
int css_driver_register(struct css_driver *cdrv)
{
cdrv->drv.bus = &css_bus_type;
+
+ /*
+ * The driver_override mechanism provided via sysfs is used in a
+ * non-common way for the AP bus: There might be more than one regular
+ * driver per device and using driver_override the right one is
+ * selected. Wrong drivers cannot be forced on a devices as the
+ * subchannel type still has to match.
+ */
+ cdrv->drv.support_driver_override = true;
return driver_register(&cdrv->drv);
}
EXPORT_SYMBOL_GPL(css_driver_register);
(plus the respective change for the AP bus).
> I am not aware of a single bug report caused by driver_override on these
> buses, so tainting or denying here would only break working setups
> without fixing anything.
>
> As these two are not vfio drivers, this should not be folded into
> 04/10.
>
> We (s390 team) should probably send two followup patches, simple oneliners
>
> s390/cio: Allow untainted use of driver_override for io_subchannel
> sets .support_driver_override in io_subchannel_driver.drv
> (drivers/s390/cio/device.c)
>
> s390/zcrypt: Allow untainted use of driver_override for cex4queue
> sets .driver.support_driver_override in zcrypt_cex4_queue_driver
> (drivers/s390/crypto/zcrypt_cex4.c)
>
>
> Peter/Vineeth for cio and Harald for zcrypt: could you provide such
> changes as additional patches?
>
> Uwe, would you be willing to take those in your series?
If you don't like the above change, that would be fine for me.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 04/10] s390/vfio: Allow untainted use of driver_override
2026-11-26 10:01 ` Uwe Kleine-König
@ 2026-11-27 18:38 ` Peter Oberparleiter
0 siblings, 0 replies; 13+ messages in thread
From: Peter Oberparleiter @ 2026-11-27 18:38 UTC (permalink / raw)
To: Uwe Kleine-König, Christian Borntraeger
Cc: Harald Freudenberger, Greg Kroah-Hartman, Eric Farman,
Matthew Rosato, Tony Krowiak, Jason Herne, Holger Dengler,
Alex Williamson, Vineeth Vijayan, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, linux-s390, kvm
On 26.11.2026 11:01, Uwe Kleine-König wrote:
> On Mon, Nov 23, 2026 at 05:31:42PM +0100, Christian Borntraeger wrote:
[...]
>> So let me try to translate
>> On s390, driver_override is how a device moves
>> between the host and a guest, in both directions:
>>
>> driverctl -b css set-override 0.0.0004 vfio_ccw # to the guest
>> driverctl -b css set-override 0.0.0004 io_subchannel # back to the host
>>
>> driverctl -b ap set-override 17.0005 vfio_ap # to the guest
>> driverctl -b ap set-override 17.0005 cex4queue # back to the host
>>
>> Your series keeps the first direction working but breaks the second
>> one, because io_subchannel_driver and zcrypt_cex4_queue_driver do not
>> set support_driver_override. On the AP bus this is unwanted:
>> driver_override and apmask/aqmask are mutually exclusive
>> (46030379f13c "s390/ap: Restrict driver_override versus apmask and
>> aqmask use"), so once overrides are in use there is no other way to
>> assign a queue to zcrypt.
>>
>> We want to keep the way back working, and there is no reason not to.
>> The problem patch 1 addresses, i.e. a driver being forced onto a
>> device it was never written for, cannot happen on these two buses:
>>
>> - css_bus_match() still requires the driver's subchannel_type to match
>> after the override matched. This was a deliberate design decision
>> when driver_override was added for css (ebc3d17915034 "s390/cio:
>> introduce driver_override on the css bus": "unlike pci we still
>> require a driver override to match the subchannel type")
>>
>> - ap_bus_match() always does the device type match. driver_override
>> only decides in ap_device_probe() which of the matching drivers
>> gets the queue, and the AP bus handles an override to the default
>> driver explicitly (ap_owned_by_def_drv()).
>>
>> So on css and AP, driver_override never force binds anything. It only
>> selects between drivers that already match the device, and
>> io_subchannel and cex4queue are the regular drivers for exactly these
>> devices. They are unbound and rebound every time a device moves to
>> vfio and back.
>
> Ah, understood better now. Feels like a misuse of driver_override to me
> and because the ap_bus's usecase doesn't match the intention of
> driver_override, keeping the bus working is strange as it exposes this
> difference.
>
> Without having checked all the details, I wonder if something like that
> would be the more robust change then:
>
> diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
> index efd3df3e90ba..2d07bca149cc 100644
> --- a/drivers/s390/cio/css.c
> +++ b/drivers/s390/cio/css.c
> @@ -1398,6 +1398,15 @@ static const struct bus_type css_bus_type = {
> int css_driver_register(struct css_driver *cdrv)
> {
> cdrv->drv.bus = &css_bus_type;
> +
> + /*
> + * The driver_override mechanism provided via sysfs is used in a
> + * non-common way for the AP bus: There might be more than one regular
> + * driver per device and using driver_override the right one is
> + * selected. Wrong drivers cannot be forced on a devices as the
> + * subchannel type still has to match.
> + */
> + cdrv->drv.support_driver_override = true;
> return driver_register(&cdrv->drv);
> }
> EXPORT_SYMBOL_GPL(css_driver_register);
I consider this approach not preferable since someone who doesn’t know
about the extra logic might get confused why driver_override works
despite a driver not specifying it explicitly.
[...]
>> We (s390 team) should probably send two followup patches, simple oneliners
>>
>> s390/cio: Allow untainted use of driver_override for io_subchannel
>> sets .support_driver_override in io_subchannel_driver.drv
>> (drivers/s390/cio/device.c)
>>
>> s390/zcrypt: Allow untainted use of driver_override for cex4queue
>> sets .driver.support_driver_override in zcrypt_cex4_queue_driver
>> (drivers/s390/crypto/zcrypt_cex4.c)
>>
>>
>> Peter/Vineeth for cio and Harald for zcrypt: could you provide such
>> changes as additional patches?
>>
>> Uwe, would you be willing to take those in your series?
>
> If you don't like the above change, that would be fine for me.
Here's the patch for the CSS bus:
From ea91296ce7ee0f31aa584736f130a86237f054eb Mon Sep 17 00:00:00 2001
From: Peter Oberparleiter <oberpar@linux.ibm.com>
Date: Thu, 26 Nov 2026 17:27:04 +0100
Subject: [PATCH] s390/cio: Allow untainted use of driver_override
I/O subchannel devices on the CSS bus can be bound to either of two
drivers:
1. io_subchannel: the default driver
2. vfio_ccw: used for KVM guest pass-through
Although the CSS bus also hosts devices that are not I/O subchannels,
css_bus_match() ensures that only compatible drivers can be bound, even
when driver_override is used.
A previous change marked vfio_ccw as compatible with driver_override as
part of the logic that disables driver_override by default. This created
an asymmetry between vfio_ccw and io_subchannel: users can switch a
subchannel device from io_subchannel to vfio_ccw, but not back to
io_subchannel.
Restore symmetry by marking io_subchannel as compatible with
driver_override as well.
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
---
drivers/s390/cio/device.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 68dd4a62975d..bfb0a18c395a 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -164,6 +164,7 @@ static struct css_driver io_subchannel_driver = {
.drv = {
.owner = THIS_MODULE,
.name = "io_subchannel",
+ .support_driver_override = true,
},
.subchannel_type = io_subchannel_ids,
.irq = io_subchannel_irq,
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 04/10] s390/vfio: Allow untainted use of driver_override
2026-11-20 11:11 ` [PATCH v2 04/10] s390/vfio: Allow untainted use of driver_override Uwe Kleine-König
2026-11-20 11:58 ` Harald Freudenberger
2026-11-23 13:55 ` Harald Freudenberger
@ 2026-11-30 8:13 ` Harald Freudenberger
2 siblings, 0 replies; 13+ messages in thread
From: Harald Freudenberger @ 2026-11-30 8:13 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Greg Kroah-Hartman, Eric Farman, Matthew Rosato, Tony Krowiak,
Jason Herne, Holger Dengler, Alex Williamson, Vineeth Vijayan,
Peter Oberparleiter, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, linux-s390, kvm, Christian Borntraeger
On 2026-11-20 12:11, Uwe Kleine-König wrote:
> From: Alex Williamson <alex@shazbot.org>
>
> The vfio_ap and vfio_ccw drivers bind devices through driver_override.
> 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 vfio_ap and vfio_ccw driver
> structs.
>
> Signed-off-by: Alex Williamson <alex@shazbot.org>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/s390/cio/vfio_ccw_drv.c | 1 +
> drivers/s390/crypto/vfio_ap_drv.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/drivers/s390/cio/vfio_ccw_drv.c
> b/drivers/s390/cio/vfio_ccw_drv.c
> index 7546bd137e4e..77765cde87f7 100644
> --- a/drivers/s390/cio/vfio_ccw_drv.c
> +++ b/drivers/s390/cio/vfio_ccw_drv.c
> @@ -375,6 +375,7 @@ static struct css_driver vfio_ccw_sch_driver = {
> .drv = {
> .name = "vfio_ccw",
> .owner = THIS_MODULE,
> + .support_driver_override = true,
> },
> .subchannel_type = vfio_ccw_sch_ids,
> .irq = vfio_ccw_sch_irq,
> diff --git a/drivers/s390/crypto/vfio_ap_drv.c
> b/drivers/s390/crypto/vfio_ap_drv.c
> index 8e69ed286bb9..2d47dc643269 100644
> --- a/drivers/s390/crypto/vfio_ap_drv.c
> +++ b/drivers/s390/crypto/vfio_ap_drv.c
> @@ -62,6 +62,7 @@ static struct ap_driver vfio_ap_drv = {
> .on_config_changed = vfio_ap_on_cfg_changed,
> .on_scan_complete = vfio_ap_on_scan_complete,
> .ids = ap_queue_ids,
> + .driver.support_driver_override = true,
> };
>
> static void vfio_ap_matrix_dev_release(struct device *dev)
The patch for the zcrpyt driver zoo will come later via s390 subsystem
when this patch series has settled down.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-11-30 8:13 UTC | newest]
Thread overview: 13+ 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 04/10] s390/vfio: Allow untainted use of driver_override Uwe Kleine-König
2026-11-20 11:58 ` Harald Freudenberger
2026-11-20 14:05 ` Uwe Kleine-König
2026-11-23 16:31 ` Christian Borntraeger
2026-11-26 10:01 ` Uwe Kleine-König
2026-11-27 18:38 ` Peter Oberparleiter
2026-11-23 13:55 ` Harald Freudenberger
2026-11-23 14:48 ` Alex Williamson
2026-11-30 8:13 ` Harald Freudenberger
2026-11-21 1:16 ` [PATCH v2 00/10] driver core: Disable driver overriding by default Danilo Krummrich
2026-11-26 1:57 ` Gary Guo
2026-11-26 2:13 ` Gary Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox