Documentation: Document the kernel flag bdev_allow_write_mounted
Subsystems (3)
PATCH v5 1/1 Documentation: Document the kernel flag bdev_allow_write_mounted
Commit ed5cc702d311 ("block: Add config option to not allow writing to mounted devices") added a Kconfig option along with a kernel command-line tuning to control writes to mounted block devices, as a means to deal with fuzzers like Syzkaller, that provokes kernel crashes by directly writing on block devices bypassing the filesystem (so the FS has no awareness and cannot cope with that).
The patch just missed adding such kernel command-line option to the kernel documentation, so let's fix that.
---
V5:
- s/open a block device/open a mounted block device (thanks Jan!).
- Added the Review tag from Jan.
V4 link: https://lore.kernel.org/r/[email protected]
Documentation/admin-guide/kernel-parameters.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +12 -0
@@ -517,6 +517,18 @@ Format: <io>,<irq>,<mode> See header of drivers/net/hamradio/baycom_ser_hdx.c. + bdev_allow_write_mounted= + Format: <bool> + Control the ability to open a mounted block device + for writing, i.e., allow / disallow writes that bypass + the FS. This was implemented as a means to prevent + fuzzers from crashing the kernel by overwriting the + metadata underneath a mounted FS without its awareness. + This also prevents destructive formatting of mounted + filesystems by naive storage tooling that don't use + O_EXCL. Default is Y and can be changed through the + Kconfig option CONFIG_BLK_DEV_WRITE_MOUNTED. + bert_disable [ACPI] Disable BERT OS support on buggy BIOSes.
Signature · 1 line
2.46.0
Quoted 6 lines · Guilherme G. Piccoli
Commit
ed5cc702d311("block: Add config option to not allow writing to mounted devices") added aKconfigoption along with a kernel command-line tuning to control writes to mounted block devices, as a means to deal with fuzzers like Syzkaller, that provokes kernel crashes by directly writing on block devices bypassing the filesystem (so the FS has no awareness and cannot cope with that).
Quoted 8 lines
The patch just missed adding such kernel command-line option to the kernel documentation, so let's fix that.
Cc Bart Van Assche <[email protected]>Cc Darrick J. Wong <[email protected]>Cc Jens Axboe <[email protected]>Reviewed-by Jan Kara <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>
Looks good to me now,
Fun unrelated question: do we want to turn on bdev_allow_write_mounted if lockdown is enabled? In that kind of environment, we don't want to allow random people to scribble, given how many weird ext4 bugs we've had to fix due to syzbot.
--D
Quoted 39 lines
---
V5:
- s/open a block device/open a mounted block device (thanks Jan!).
- Added the Review tag from Jan.V4 link: https://lore.kernel.org/r/[email protected]
Documentation/admin-guide/kernel-parameters.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+)Documentation/admin-guide/kernel-parameters.txt +12
-0@@ -517,6 +517,18 @@ Format: <io>,<irq>,<mode> See header of drivers/net/hamradio/baycom_ser_hdx.c. + bdev_allow_write_mounted= + Format: <bool> + Control the ability to open a mounted block device + for writing, i.e., allow / disallow writes that bypass + the FS. This was implemented as a means to prevent + fuzzers from crashing the kernel by overwriting the + metadata underneath a mounted FS without its awareness. + This also prevents destructive formatting of mounted + filesystems by naive storage tooling that don't use + O_EXCL. Default is Y and can be changed through the + Kconfig option CONFIG_BLK_DEV_WRITE_MOUNTED. + bert_disable [ACPI] Disable BERT OS support on buggy BIOSes.Signature · 1 line
2.46.0
Jan Kara
reviewerQuoted 16 lines · Darrick J. Wong
Quoted 6 lines · Guilherme G. Piccoli
Commit
ed5cc702d311("block: Add config option to not allow writing to mounted devices") added aKconfigoption along with a kernel command-line tuning to control writes to mounted block devices, as a means to deal with fuzzers like Syzkaller, that provokes kernel crashes by directly writing on block devices bypassing the filesystem (so the FS has no awareness and cannot cope with that).Quoted 8 lines
The patch just missed adding such kernel command-line option to the kernel documentation, so let's fix that.
Cc Bart Van Assche <[email protected]>Cc Darrick J. Wong <[email protected]>Cc Jens Axboe <[email protected]>Reviewed-by Jan Kara <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>
Quoted 7 lines
Looks good to me now,
Reviewed-by Darrick J. Wong <[email protected]>Fun unrelated question: do we want to turn on
bdev_allow_write_mountedif lockdown is enabled? In that kind of environment, we don't want to allow random people to scribble, given how many weird ext4 bugs we've had to fix due to syzbot.
It would be desirable. But it will break some administrative tasks currently so I'm not sure users are really prepared for that? But with recent util-linux those should be mostly limited to filesystem-specific tooling issues (tune2fs is definitely broken and needs new kernel interfaces to be able to work, I think resize2fs is also broken but that should be fixable within e2fsprogs though it requires larger refactoring AFAIR).
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Christian Brauner
maintainerQuoted 16 lines · Darrick J. Wong
Quoted 6 lines · Guilherme G. Piccoli
Commit
ed5cc702d311("block: Add config option to not allow writing to mounted devices") added aKconfigoption along with a kernel command-line tuning to control writes to mounted block devices, as a means to deal with fuzzers like Syzkaller, that provokes kernel crashes by directly writing on block devices bypassing the filesystem (so the FS has no awareness and cannot cope with that).Quoted 8 lines
The patch just missed adding such kernel command-line option to the kernel documentation, so let's fix that.
Cc Bart Van Assche <[email protected]>Cc Darrick J. Wong <[email protected]>Cc Jens Axboe <[email protected]>Reviewed-by Jan Kara <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>
Quoted 7 lines
Looks good to me now,
Reviewed-by Darrick J. Wong <[email protected]>Fun unrelated question: do we want to turn on
bdev_allow_write_mountedif lockdown is enabled? In that kind of environment, we don't want to allow random people to scribble, given how many weird ext4 bugs we've had to fix due to syzbot.
I would say yes, we absolutely do.
Quoted 9 lines · Guilherme G. Piccoli
Commit
ed5cc702d311("block: Add config option to not allow writing to mounted devices") added aKconfigoption along with a kernel command-line tuning to control writes to mounted block devices, as a means to deal with fuzzers like Syzkaller, that provokes kernel crashes by directly writing on block devices bypassing the filesystem (so the FS has no awareness and cannot cope with that).The patch just missed adding such kernel command-line option to the kernel documentation, so let's fix that.
Quoted 6 lines
Cc Bart Van Assche <[email protected]>Cc Darrick J. Wong <[email protected]>Cc Jens Axboe <[email protected]>Reviewed-by Jan Kara <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>---
Applied, thanks.
jon