btrfs-progs/common
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
..
array.c btrfs-progs: add an extensible pointer array struct 2023-08-28 17:24:24 +02:00
array.h btrfs-progs: add an extensible pointer array struct 2023-08-28 17:24:24 +02:00
box.h btrfs-progs: add btrfs-find-root to btrfs.box 2023-07-26 15:00:48 +02:00
clear-cache.c btrfs-progs: move clear-cache.[ch] from check/ to common/ directory 2023-10-13 18:13:12 +02:00
clear-cache.h btrfs-progs: move clear-cache.[ch] from check/ to common/ directory 2023-10-13 18:13:12 +02:00
cpu-utils.c btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
cpu-utils.h btrfs-progs: detect PCLMUL CPU support for accelerated crc32c 2023-09-13 00:38:50 +02:00
defs.h btrfs-progs: move common-defs to common/ 2020-03-31 18:37:35 +02:00
device-scan.c btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
device-scan.h btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
device-utils.c btrfs-progs: change all sysfs helpers to return errno 2023-12-09 01:17:22 +01:00
device-utils.h btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
extent-cache.c btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
extent-cache.h btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
extent-tree-utils.c btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
extent-tree-utils.h btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
filesystem-utils.c btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
filesystem-utils.h btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
format-output.c btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
format-output.h btrfs-progs: rename time-long format name to date-time 2023-08-28 17:24:23 +02:00
fsfeatures.c btrfs-progs: move raid-stripe-tree and squota build out of experimental 2023-10-17 19:33:59 +02:00
fsfeatures.h btrfs-progs: increase size of BTRFS_FEATURE_STRING_BUF_SIZE 2023-10-02 18:41:08 +02:00
help.c btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
help.h btrfs-progs: add support for dry-run options 2023-11-03 18:04:37 +01:00
inject-error.c btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
inject-error.h btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
internal.h btrfs-progs: pull in the full max/min/clamp implementation from kernel 2023-10-10 19:16:29 +02:00
messages.c btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
messages.h btrfs-progs: add musl compatibility for printf format %pV 2023-05-26 18:02:28 +02:00
open-utils.c btrfs-progs: add noscan parameter to check_where_mounted 2023-07-26 15:00:48 +02:00
open-utils.h btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
parse-utils.c btrfs-progs: reset errno before strtoull() 2023-12-01 02:13:37 +01:00
parse-utils.h btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
path-utils.c btrfs-progs: path-utils: rename path_is_mount_point to avoid potential symbol name clash 2023-04-03 19:14:13 +02:00
path-utils.h btrfs-progs: path-utils: rename path_is_mount_point to avoid potential symbol name clash 2023-04-03 19:14:13 +02:00
rbtree-utils.c btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
rbtree-utils.h btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
send-stream.c btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
send-stream.h btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
send-utils.c btrfs-progs: common: drop unsigned long long casts for printf 2023-11-03 18:04:37 +01:00
send-utils.h btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
sort-utils.c btrfs-progs: add sorting API 2023-08-28 17:24:24 +02:00
sort-utils.h btrfs-progs: add sorting API 2023-08-28 17:24:24 +02:00
string-table.c btrfs-progs: string-table: add ranged API for printing and clearing 2022-12-05 20:32:02 +01:00
string-table.h btrfs-progs: string-table: add ranged API for printing and clearing 2022-12-05 20:32:02 +01:00
string-utils.c btrfs-progs: rename prefixcmp to string_has_prefix 2023-08-28 17:24:24 +02:00
string-utils.h btrfs-progs: rename prefixcmp to string_has_prefix 2023-08-28 17:24:24 +02:00
sysfs-utils.c btrfs-progs: change all sysfs helpers to return errno 2023-12-09 01:17:22 +01:00
sysfs-utils.h btrfs-progs: add write helpers for sysfs files 2023-12-09 01:17:22 +01:00
task-utils.c btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
task-utils.h btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
units.c btrfs-progs: introduce UASSERT() for purely userspace code 2023-05-26 18:02:28 +02:00
units.h btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
utils.c btrfs-progs: add extra chunk alignment checks 2024-01-16 19:14:37 +01:00
utils.h btrfs-progs: add extra chunk alignment checks 2024-01-16 19:14:37 +01:00