btrfs-progs/check
Qu Wenruo 6dfc69104b btrfs-progs: add extra chunk alignment checks
Recently we had a scrub use-after-free caused by unaligned chunk
length, although the fix was submitted, we may want to do extra checks
for a chunk's alignment.

This patch adds such check for the starting bytenr and length of a
chunk, to make sure they are properly aligned to 64K stripe boundary.

By default, the check only leads to a warning but is not treated as an
error, as we expect kernel to handle such unalignment without any
problem.

But if the new debug environmental variable,
BTRFS_PROGS_DEBUG_STRICT_CHUNK_ALIGNMENT, is specified, then we will
treat it as an error.  So that we can detect unexpected chunks from
btrfs-progs, and fix them before reaching the end users.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-16 19:14:37 +01:00
..
common.h btrfs-progs: add extra chunk alignment checks 2024-01-16 19:14:37 +01:00
main.c btrfs-progs: add extra chunk alignment checks 2024-01-16 19:14:37 +01:00
mode-common.c btrfs-progs: check: drop unsigned long long casts for printf 2023-11-03 18:04:37 +01:00
mode-common.h btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
mode-lowmem.c btrfs-progs: add extra chunk alignment checks 2024-01-16 19:14:37 +01:00
mode-lowmem.h btrfs-progs: check: update error bit definitions 2023-11-03 18:04:37 +01:00
mode-original.h btrfs-progs: check: update error bit definitions 2023-11-03 18:04:37 +01:00
qgroup-verify.c btrfs-progs: check: drop unsigned long long casts for printf 2023-11-03 18:04:37 +01:00
qgroup-verify.h btrfs-progs: check: update include lists 2022-10-11 09:06:12 +02:00
repair.c btrfs-progs: fix all variable shadowing 2023-10-10 19:16:29 +02:00
repair.h btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00