From: Radoslaw Zarzynski Date: Tue, 31 Mar 2026 13:04:33 +0000 (+0000) Subject: ec: validate memallocs in ErasureCodeIsaDefault::prepare() X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=abfacf696b19aaab7458a0fdb4ca3d7f6285888b;p=ceph.git ec: validate memallocs in ErasureCodeIsaDefault::prepare() When testing FastEC in crimson, segfault have been seen during initialization of the EC plugin based on ISA-L: ``` Got SIGSEGV on shard 0 Backtrace: 0# 0x00007F8A34E3FC30 in /lib64/libc.so.6 1# ErasureCodeIsaDefault::prepare() in /usr/lib64/ceph/erasure-code/libec_isa.so 2# ErasureCodeIsa::init(std::map, std::allocator >, std::__cxx11::basic_string, std::allocator >, std::less, std::allocator > >, std::allocator, std::allocator > const, std::__cxx11: :basic_string, std::allocator > > > >&, std::ostream*) in /usr/lib64/ceph/erasure-code/libec_isa.so 3# ErasureCodePluginIsa::factory(std::__cxx11::basic_string, std::allocator > const&, std::map, std::allocator \>, std::__cxx11::basic_string, std::allocator >, std::less, std::allocator > >, std::allocator, std::allocator > const, std::__cxx11::basic_string, std::allocator > > > >&, std::shared_ptr*, std::ostream*) in /usr/lib64/ceph/erasure-code/libec_isa.so ``` This commit asserts on the invariant that cache tables, after initialization, must be available. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/erasure-code/isa/ErasureCodeIsa.cc b/src/erasure-code/isa/ErasureCodeIsa.cc index 0fbd5c99c312..e31199a35d9d 100644 --- a/src/erasure-code/isa/ErasureCodeIsa.cc +++ b/src/erasure-code/isa/ErasureCodeIsa.cc @@ -640,9 +640,11 @@ ErasureCodeIsaDefault::prepare() // setup shared encoding table and coefficients unsigned char** p_enc_table = tcache.getEncodingTable(matrixtype, k, m); + ceph_assert(p_enc_table); unsigned char** p_enc_coeff = tcache.getEncodingCoefficient(matrixtype, k, m); + ceph_assert(p_enc_coeff); if (!*p_enc_coeff) { dout(10) << "[ cache tables ] creating coeff for k=" << @@ -665,6 +667,7 @@ ErasureCodeIsaDefault::prepare() } else { encode_coeff = *p_enc_coeff; } + ceph_assert(encode_coeff); if (!*p_enc_table) { dout(10) << "[ cache tables ] creating tables for k=" << @@ -680,6 +683,7 @@ ErasureCodeIsaDefault::prepare() } else { encode_tbls = *p_enc_table; } + ceph_assert(encode_tbls); unsigned memory_lru_cache = k * (m + k) * 32 * tcache.decoding_tables_lru_length;