From: Igor Fedotov Date: Fri, 29 Dec 2017 23:05:13 +0000 (+0300) Subject: os/bluestore: add asserts for fsck's used_blocks bitmap access as X-Git-Tag: v13.0.2~646^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F19718%2Fhead;p=ceph.git os/bluestore: add asserts for fsck's used_blocks bitmap access as boost doesn't always handle out-of-range access properly. Signed-off-by: Igor Fedotov --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 6329c2f16122..278da9ab79dc 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5594,6 +5594,7 @@ int BlueStore::_fsck_check_extents( apply( e.offset, e.length, granularity, used_blocks, [&](uint64_t pos, mempool_dynamic_bitset &bs) { + assert(pos < bs.size()); if (bs.test(pos)) already = true; else @@ -5702,6 +5703,7 @@ int BlueStore::_fsck(bool deep, bool repair) apply( 0, MAX(min_alloc_size, SUPER_RESERVED), fm->get_alloc_size(), used_blocks, [&](uint64_t pos, mempool_dynamic_bitset &bs) { + assert(pos < bs.size()); bs.set(pos); } ); @@ -5711,6 +5713,7 @@ int BlueStore::_fsck(bool deep, bool repair) apply( e.get_start(), e.get_len(), fm->get_alloc_size(), used_blocks, [&](uint64_t pos, mempool_dynamic_bitset &bs) { + assert(pos < bs.size()); bs.set(pos); } ); @@ -6128,6 +6131,7 @@ int BlueStore::_fsck(bool deep, bool repair) apply( e.get_start(), e.get_len(), fm->get_alloc_size(), used_blocks, [&](uint64_t pos, mempool_dynamic_bitset &bs) { + assert(pos < bs.size()); bs.set(pos); } ); @@ -6143,6 +6147,7 @@ int BlueStore::_fsck(bool deep, bool repair) apply( e.get_start(), e.get_len(), fm->get_alloc_size(), used_blocks, [&](uint64_t pos, mempool_dynamic_bitset &bs) { + assert(pos < bs.size()); bs.reset(pos); } ); @@ -6154,6 +6159,7 @@ int BlueStore::_fsck(bool deep, bool repair) apply( offset, length, fm->get_alloc_size(), used_blocks, [&](uint64_t pos, mempool_dynamic_bitset &bs) { + assert(pos < bs.size()); if (bs.test(pos)) { intersects = true; } else {