aboutsummaryrefslogtreecommitdiff
path: root/scripts/clang-tools/gen_compile_commands.py
diff options
context:
space:
mode:
authorJan Kara <[email protected]>2023-11-01 18:43:08 +0100
committerChristian Brauner <[email protected]>2023-11-18 14:59:25 +0100
commited5cc702d311c14b653323d76062b0294effa66e (patch)
tree09ae02beafc07d6915c41d4991923f9a82233777 /scripts/clang-tools/gen_compile_commands.py
parentcd34758c5238ae6976b10fe15bba7031b409c969 (diff)
block: Add config option to not allow writing to mounted devices
Writing to mounted devices is dangerous and can lead to filesystem corruption as well as crashes. Furthermore syzbot comes with more and more involved examples how to corrupt block device under a mounted filesystem leading to kernel crashes and reports we can do nothing about. Add tracking of writers to each block device and a kernel cmdline argument which controls whether other writeable opens to block devices open with BLK_OPEN_RESTRICT_WRITES flag are allowed. We will make filesystems use this flag for used devices. Note that this effectively only prevents modification of the particular block device's page cache by other writers. The actual device content can still be modified by other means - e.g. by issuing direct scsi commands, by doing writes through devices lower in the storage stack (e.g. in case loop devices, DM, or MD are involved) etc. But blocking direct modifications of the block device page cache is enough to give filesystems a chance to perform data validation when loading data from the underlying storage and thus prevent kernel crashes. Syzbot can use this cmdline argument option to avoid uninteresting crashes. Also users whose userspace setup does not need writing to mounted block devices can set this option for hardening. Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jens Axboe <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'scripts/clang-tools/gen_compile_commands.py')
0 files changed, 0 insertions, 0 deletions