From: Jason Dillaman Date: Tue, 9 May 2017 15:31:52 +0000 (-0400) Subject: common/bit_vector: utilize deep-copy during data decode X-Git-Tag: v12.0.3~34^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F15017%2Fhead;p=ceph.git common/bit_vector: utilize deep-copy during data decode BlueStore utilizes an in-memory cache of bufferlists. If the bit vector directly manipulates the shallow-copied bufferlist, it can corrupt the CRC. Fixes: http://tracker.ceph.com/issues/19863 Signed-off-by: Jason Dillaman --- diff --git a/src/common/bit_vector.hpp b/src/common/bit_vector.hpp index 62d924d984f2..c15b0927e376 100644 --- a/src/common/bit_vector.hpp +++ b/src/common/bit_vector.hpp @@ -231,8 +231,11 @@ void BitVector<_b>::decode_data(bufferlist::iterator& it, uint64_t byte_offset) while (byte_offset < end_offset) { uint64_t len = MIN(BLOCK_SIZE, end_offset - byte_offset); + bufferptr ptr; + it.copy_deep(len, ptr); + bufferlist bit; - it.copy(len, bit); + bit.append(ptr); if (m_crc_enabled && m_data_crcs[byte_offset / BLOCK_SIZE] != bit.crc32c(0)) { throw buffer::malformed_input("invalid data block CRC");