From 121c40286a60a63cda32c7111aaade2043ff18df Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Sat, 30 Dec 2017 02:05:13 +0300 Subject: [PATCH] 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 --- src/os/bluestore/BlueStore.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 6329c2f16122f..278da9ab79dc3 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 { -- 2.39.5