From 58b6520707a79b512f89be52b8a7aa5c498bad3c Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 9 May 2017 11:31:52 -0400 Subject: [PATCH] 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 --- src/common/bit_vector.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/bit_vector.hpp b/src/common/bit_vector.hpp index 62d924d984f2d..c15b0927e376c 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"); -- 2.47.3