]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: add asserts for fsck's used_blocks bitmap access as 19718/head
authorIgor Fedotov <ifedotov@suse.com>
Fri, 29 Dec 2017 23:05:13 +0000 (02:05 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Sat, 30 Dec 2017 00:42:37 +0000 (03:42 +0300)
boost doesn't always handle out-of-range access properly.

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/bluestore/BlueStore.cc

index 6329c2f16122fd25ce800619e067de06e35403e1..278da9ab79dc3cdbe6244a0a142dd33205fcf0f5 100644 (file)
@@ -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 {