TestMockPoolReplayer.Namespaces and NamespacesError tests leave behind
a dangling pointer to a stack-allocated MockNamespace which leads to an
easily reproducible use-after-free and segfault when tests are shuffled.
Fixes: https://tracker.ceph.com/issues/70041
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
}
Namespace() {
+ ceph_assert(s_instance == nullptr);
s_instance = this;
}
+ ~Namespace() {
+ ceph_assert(s_instance == this);
+ s_instance = nullptr;
+ }
+
void add(const std::string &name) {
std::lock_guard locker{m_lock};