LWN: Comments on "A firewall for device drivers" https://lwn.net/Articles/865918/ This is a special feed containing comments posted to the individual LWN article titled "A firewall for device drivers". en-us Thu, 06 Nov 2025 09:23:13 +0000 Thu, 06 Nov 2025 09:23:13 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net A firewall for device drivers https://lwn.net/Articles/867192/ https://lwn.net/Articles/867192/ ras <div class="FormattedComment"> <font class="QuotedText">&gt; As long drivers are built as modules, you can just not include banned drivers in the initrd, and stick modprobe blacklists.</font><br> <p> Unfortunately the VM itself can change the blacklists, and obtain the modules from somewhere and insmod them. When your goal is to ensure someone who has taken over the VM can&#x27;t escape from it, that&#x27;s not a solution.<br> <p> However, a simple sysfs &quot;blown fuse flag&quot; (ie, one you can not change back) that turns off module loading would work. You just run set it in the initrd, after it&#x27;s loaded all the modules. There already is a corresponding capability.<br> </div> Tue, 24 Aug 2021 02:07:03 +0000 A firewall for device drivers https://lwn.net/Articles/866965/ https://lwn.net/Articles/866965/ pabs <div class="FormattedComment"> ISTR Linux has a localmodconfig make target that could be used for this; build a full kernel, boot it on the hardware you want, note the loaded modules, and using localmodconfig build a kernel config with those modules and then turn CONFIG_* with =m into =y and build the result.<br> </div> Sat, 21 Aug 2021 00:52:11 +0000 A firewall for device drivers https://lwn.net/Articles/866865/ https://lwn.net/Articles/866865/ bustervill <div class="FormattedComment"> <font class="QuotedText">&gt; A nice idea. I sort of tried to achieve that goal until I realized it would take an insane amount of time to reach it and to stay at it at every release of a new kernel.</font><br> <p> I used to do it as well, spending large amounts of time and attention. I think this is exactly the problem and the reason people (including me) prefer not to have do it anymore.<br> <p> An XKCD comic is worth a thousand words: <a href="https://xkcd.com/1671/">https://xkcd.com/1671/</a><br> </div> Fri, 20 Aug 2021 13:49:14 +0000 A firewall for device drivers https://lwn.net/Articles/866510/ https://lwn.net/Articles/866510/ ssmith32 <div class="FormattedComment"> Or toggle the sysfs knob:<br> <p> <font class="QuotedText">&gt; There is also a new driver attribute in sysfs (called allowed) that can be used to change a driver&#x27;s status at run time. </font><br> </div> Mon, 16 Aug 2021 23:23:36 +0000 A firewall for device drivers https://lwn.net/Articles/866358/ https://lwn.net/Articles/866358/ dullfire <div class="FormattedComment"> While I have never gotten it to consistently work for GPUs (in theory there is a dependencies list you could jump through... I&#x27;ve never management to find it), for well written Wifi drivers, you should be able to unbind them (via sysfs), and then rebind them. Which should result in a new firmware request.<br> <p> I believe buildin modules can also pull firmware from the initrd (since firmware loading has been move into the kernel, for reasons).<br> <p> </div> Mon, 16 Aug 2021 11:45:28 +0000 A firewall for device drivers https://lwn.net/Articles/866319/ https://lwn.net/Articles/866319/ Wol <div class="FormattedComment"> In that case (and I have the same problem with video card firmware), can&#x27;t you include them in the kernel?<br> <p> Cheers,<br> Wol<br> </div> Sun, 15 Aug 2021 22:12:02 +0000 A firewall for device drivers https://lwn.net/Articles/866314/ https://lwn.net/Articles/866314/ iabervon <div class="FormattedComment"> The problem I&#x27;ve had with not having modules is with built-in wifi drivers detecting hardware before the root partition with the firmware is mounted, and not retrying later. Since everybody builds the drivers as modules, the assumption is that the firmware will be available as soon as the driver code is available. I could work around it (unbind and rebind the device once userspace is ready), but I don&#x27;t really want to use an arrangement that clearly nobody else is testing.<br> </div> Sun, 15 Aug 2021 20:47:31 +0000 A firewall for device drivers https://lwn.net/Articles/866299/ https://lwn.net/Articles/866299/ jayalane <div class="FormattedComment"> I used to do this also. Usually once you get a config that builds a kernel that boots your system you use it for the base of new kernels’ config, so the work is mostly one time (this as they mess with new config options etc. you might have to edit it a little, but not so frightful as the first one. <br> </div> Sun, 15 Aug 2021 18:42:31 +0000 A firewall for device drivers https://lwn.net/Articles/866279/ https://lwn.net/Articles/866279/ mokki <div class="FormattedComment"> Could we instead tag each driver as &quot;hardened&quot;. Then in virtualized (and other) environments we set a flag to allow only hardened drivers, built-in or not. Plus of course some whitelist, which should be hopefully smaller. At least the effort to review and harden drivers can be shared by community instead of each admin doing it separately.<br> Maybe the hardening flag could be a bit mask to tell what kind of hardenings have been done on it. Aka input validation, iommu support etc<br> </div> Sun, 15 Aug 2021 08:02:12 +0000 A firewall for device drivers https://lwn.net/Articles/866276/ https://lwn.net/Articles/866276/ dullfire <div class="FormattedComment"> There are even nifty options like &quot;make localmodconfig&quot; which gives you an excellent starting point for selecting which modules you need.<br> <p> Of course that only copies the currently loaded modules, but the thoery is if you currently running system supports most (or even all) the functionality you need, then those are a good base.<br> </div> Sun, 15 Aug 2021 03:59:17 +0000 A firewall for device drivers https://lwn.net/Articles/866274/ https://lwn.net/Articles/866274/ Wol <div class="FormattedComment"> I still run a (almost) only static kernel. I think you&#x27;re misremembering when kernels grew too big to fit in the space available for 32-bit. So a lot of stuff had to be compiled as modules to prevent there be loads of unused code that stopped the kernel from loading.<br> <p> You&#x27;d need to do a bit of work, but not that much - gentoo users do it all the time :-) Just download the distro source kernel, do a lsmod to see what modules are loaded, then alter the config so those modules are compiled in. Leave out the &quot;make modules&quot; and &quot;make modules_install&quot; steps, and you should have a module-free kernel.<br> <p> If you learn there are modules you missed, you can go down one of two routes. Either make a note of them to compile them into your kernel, or manually install them into /lib/modules or wherever they go.<br> <p> Cheers,<br> Wol<br> </div> Sat, 14 Aug 2021 22:49:32 +0000 A firewall for device drivers https://lwn.net/Articles/866271/ https://lwn.net/Articles/866271/ ttuttle <div class="FormattedComment"> I would read that if you wanted to write it and link to it here.<br> </div> Sat, 14 Aug 2021 21:31:32 +0000 A firewall for device drivers https://lwn.net/Articles/866270/ https://lwn.net/Articles/866270/ pebolle <div class="FormattedComment"> <font class="QuotedText">&gt; kernels that had only the exact device drivers I wanted</font><br> <p> A nice idea. I sort of tried to achieve that goal until I realized it would take an insane amount of time to reach it and to stay at it at every release of a new kernel. <br> <p> <font class="QuotedText">&gt; This was a long time ago, so I could be misremembering, but I believe I was forced to stop doing this because the kernel stopped supporting static compilation; it was loadable modules or nothing.</font><br> <p> That would mean CONFIG_MODULES (or its equivalent) was broken. I would be surprised if it still is.<br> </div> Sat, 14 Aug 2021 20:56:19 +0000 A firewall for device drivers https://lwn.net/Articles/866269/ https://lwn.net/Articles/866269/ malor <div class="FormattedComment"> Back in the old days, I used to compile static kernels that had only the exact device drivers I wanted, on the theory that module loading was not secure. <br> <p> I remain convinced that this is the case, and that static kernels would be safer, completely removing a giant attack space. <br> <p> This was a long time ago, so I could be misremembering, but I believe I was forced to stop doing this because the kernel stopped supporting static compilation; it was loadable modules or nothing. <br> <p> </div> Sat, 14 Aug 2021 19:08:11 +0000 A firewall for device drivers https://lwn.net/Articles/866245/ https://lwn.net/Articles/866245/ amboar <div class="FormattedComment"> Perhaps the patch could exploit bootconfig<br> <p> <a href="https://www.kernel.org/doc/html/latest/admin-guide/bootconfig.html">https://www.kernel.org/doc/html/latest/admin-guide/bootco...</a><br> </div> Sat, 14 Aug 2021 09:28:51 +0000 A firewall for device drivers https://lwn.net/Articles/866227/ https://lwn.net/Articles/866227/ pmulholland <div class="FormattedComment"> I thought this article was going to be about hardware level firewalls, so I had prepared a comment about PCIe message signalled interrupts and the requirement to write directly to the interrupt controller from an external device... having RTFA, I see I’ll need to wait for another time to see how hardware firewalls are done. I can definitely see how a rough bus master or interrupt source could wreak havoc on a system.<br> </div> Sat, 14 Aug 2021 00:37:57 +0000 A firewall for device drivers https://lwn.net/Articles/866226/ https://lwn.net/Articles/866226/ dullfire <div class="FormattedComment"> This sounds like a solution in search of a problem<br> <p> I believe all mainstream distros let you select which drivers should go in the initrd (pretty sure most even have tooling to find a reduced, if not minimal set). As long drivers are built as modules, you can just not include banned drivers in the initrd, and stick modprobe blacklists.<br> <p> The only situation that doesn&#x27;t cover is built-in modules (which should both be rare, and usually/always nonsensical to blacklist).<br> <p> Of course this doesn&#x27;t include a solution to bootstrap it, but neither does the proposed solution.<br> </div> Sat, 14 Aug 2021 00:10:04 +0000 A firewall for device drivers https://lwn.net/Articles/866223/ https://lwn.net/Articles/866223/ Paf <div class="FormattedComment"> This seems like a sound and simple solution except that I don’t think the kernel command line can take enough arguments.<br> </div> Fri, 13 Aug 2021 22:05:17 +0000 A firewall for device drivers https://lwn.net/Articles/866222/ https://lwn.net/Articles/866222/ bferrell <div class="FormattedComment"> We could just abandon the concept of modular kernels, but then we&#x27;re back to 1995... It&#x27;s secure. The kernel will have an exactly known set of drivers, but a LOT of modern admins will NOT know how to recompile the kernel to change that set.<br> <p> I&#x27;m all for it!<br> </div> Fri, 13 Aug 2021 21:16:58 +0000 A firewall for device drivers https://lwn.net/Articles/866210/ https://lwn.net/Articles/866210/ derobert <div class="FormattedComment"> That has a similar problem as building different kernel versions. If on a VM I administer, what if I need to enable one extra driver? I might be using PCI pass through, for example. I&#x27;d have to either switch to the unrestricted set, decreasing security of the VM, or build a new kernel with a third set of signatures. <br> </div> Fri, 13 Aug 2021 18:43:54 +0000 A firewall for device drivers https://lwn.net/Articles/866207/ https://lwn.net/Articles/866207/ josh <div class="FormattedComment"> This seems awkward to handle via a full list on the kernel command line. I wonder if this could use the existing driver signing infrastructure with a slight extension: Have two (or more) different signatures on each module, with different keys, and on the command-line pass which key &quot;slot&quot; to use to verify modules. That effectively allows selecting among &quot;module sets&quot; determined at compile time.<br> </div> Fri, 13 Aug 2021 18:08:50 +0000