Created attachment 231441 [details] btrfs-image causing endless loop in btrfsck More news from the fuzzer. The attached image causes btrfsck to enter what seems to be an endless loop; using btrfs-progs v4.7-42-g56e9586.
Created attachment 231451 [details] GDB log interrupting btrfsck within endless loop
This one happens when found_key.offset is 0. Key never advances and found_key.offset never changes, so we just loop forever.
Created attachment 232291 [details] [PATCH] btrfsprogs: avoid looping forever when a bad blockgroup key is found If we discover a bad BLOCK_GROUP_ITEM_KEY with offset = 0, we'll end up looping forever when we read the block groups in. This is due to the search for the next block group starting at the current object + the offset. If offset is 0, we'll just get the same key over and over and never advance. This patch ensures that we'll advance at least one objectid per iteration.
Shouldn't there be a warning if found_key.offset == 0 ?
That's the job of the checker.
Patch merged, image added to the testsuite.