Prevent runaway privileged processes from writing to block devices bdev_allow_write_mounted=0#334
Conversation
|
This is good for hardening against user error I guess... and I suppose if a process managed to get access to the Edit: This parameter does work on Trixie, but it's usefulness for security is pretty low; it prevents |
|
Merged into my arraybolt3/trixie branch. |
|
@raja-grewal, @adrelanos This option renders it impossible to mount NTFS volumes at least when using the This has also caused problems with zerofree, and telling users how to disable it has proven rather tricky in at least one situation. See https://forums.whonix.org/t/how-to-compress-and-prevent-vdi-from-ballooning-after-each-update-deleting-large-files/22675/9 and the conversation below. Since this provides no theoretical security enhancements in most situations (as explained above), and runaway root processes are likely rare, I think this should be reverted. Edit: This seems to also be causing some issues with fwupd, with messages like |
What is |
bdev_allow_write_mounted=0
I believe it's trying to enumerate and probe all devices on the system so it knows what devices there are that might need firmware updates. (The code paths are a bit tricky to follow since fwupd uses a plugin architecture, but that's my best guess from the bits of code I could find.) Arguably it shouldn't be opening partition devices for that purpose (those will certainly never need firmware updates), but even if it didn't, it wouldn't fix the root issue since people can and do format whole disk devices with a filesystem in some instances. |
Causes breakages with disk management operations such as disk resizing and VDI compaction in virtual machines. Kicksecure#334 https://forums.whonix.org/t/kernel-hardening-security-misc/7296/609 https://forums.whonix.org/t/how-to-compress-and-prevent-vdi-from-ballooning-after-each-update-deleting-large-files/22675/9 https://forums.kicksecure.com/t/resizing-disk-for-guest-in-kvm/1657 https://claude.ai/code/session_01Cd9ka8sC7zLUvB31V4kxMk
This pull request prevents processes from writing to block devices that are mounted by filesystems to protect against runaway privileged processes causing filesystem corruption and kernel crashes.
Credit to the kernel-hardening-checker tool for bringing this to my attention.
Note this is also now only possible using Debian 13 and so should be included in our upcoming port.
Changes
Set the
bdev_allow_write_mounted=0kernel boot parameter.Mandatory Checklist
Terms of Service, Privacy Policy, Cookie Policy, E-Sign Consent, DMCA, Imprint
Optional Checklist
The following items are optional but might be requested in certain cases.