A change to mempool https://github.com/ceph/ceph/pull/55696 has
exposed a use after free bug in crushtool during process exit
where dtors are being called to free up mempool data structures
at the same time that the ceph context service thread is trying
to update them.
This commit modifies crushtool's initialization to prevent
this (unneeded) thread from being created. See issue for more
details about why the thread was not terminiating.
Fixes: https://tracker.ceph.com/issues/71027
Signed-off-by: Connor Fawcett <connorfa@uk.ibm.com>
(cherry picked from commit
2f3ffff3476763bd7cb6ecd378b16cd39eb5f302)
vector<const char *> empty_args;
auto cct = global_init(NULL, empty_args, CEPH_ENTITY_TYPE_CLIENT,
CODE_ENVIRONMENT_UTILITY,
- CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
+ CINIT_FLAG_NO_DEFAULT_CONFIG_FILE|
+ CINIT_FLAG_NO_DAEMON_ACTIONS);
// crushtool times out occasionally when quits. so do not
- // release the g_ceph_context.
+ // release the g_ceph_context. This causes other problems
+ // see https://tracker.ceph.com/issues/71027
cct->get();
common_init_finish(g_ceph_context);