On Sat,  9 Oct 2021 00:58:30 +0100
Ferruh Yigit <ferruh.yi...@intel.com> wrote:

> To enable bifurcated device support, rtnl_lock is released before calling
> userspace callbacks and asynchronous requests are enabled.
> 
> But these changes caused more issues, like bug #809, #816. To reduce the
> scope of the problems, the bifurcated device support related changes are
> only enabled when it is requested explicitly with new 'enable_bifurcated'
> module parameter.
> And bifurcated device support is disabled by default.
> 
> So the bifurcated device related problems are isolated and they can be
> fixed without impacting all use cases.
> 
> Bugzilla ID: 816
> Fixes: 631217c76135 ("kni: fix kernel deadlock with bifurcated device")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Ferruh Yigit <ferruh.yi...@intel.com>

Calling userspace with semaphore held is still risky and buggy.
There is no guarantee that the userspace DPDK application will be well behaved.
And if it is not, the spinning holding RTNL would break any other network 
management
functions in the kernel.

These are the kind of problems that make me think it there should be a
big "DO NOT USE THIS" onto KNI. Maybe make it print a big nasty message
(see kernel VFIO without IOMMU description) or mark kernel as tainted??

See: https://fedoraproject.org/wiki/KernelStagingPolicy

Something like:

diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c
index 611719b5ee27..d47fc6133cbe 100644
--- a/kernel/linux/kni/kni_net.c
+++ b/kernel/linux/kni/kni_net.c
@@ -838,6 +838,14 @@ kni_net_init(struct net_device *dev)
        dev->header_ops      = &kni_net_header_ops;
        dev->ethtool_ops     = &kni_net_ethtool_ops;
        dev->watchdog_timeo = WD_TIMEOUT;
+
+       /*
+        * KNI is unsafe since it requires calling userspace to do
+        * control operations. And the overall quality according to
+        * kernel standards is the same as devices in staging.
+        */
+       add_taint(TAINT_CRAP, LOCKDEP_STILL_OK);
+       netdev_warn(dev, "Adding kernel taint for KNI because it is not 
safe\n");
 }
 
 void

Reply via email to