We create SubProcess to run script conf.crush_location_hook.
We pass arguments via add_cmd_args(const char*, ...).
One of the arguments, cct->_conf->name.get_type_str(), is string_view.
x86-64-ABI states that when struct/class is passed by value, its fields are extracted to
registers/pushed on stack.
string_view is a class with fields:
class basic_string_view {
...
size_t _M_len;
const _CharT* _M_str;
};
As a result, a 7th parameter on stack (1st is `this` of SubProcess),
is _M_len, but is it interpreted as char*, which leads to SIGSEGV.
Fixes: https://tracker.ceph.com/issues/50659
Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
set(n.type(), s);
}
-std::string_view EntityName::
+const char* EntityName::
get_type_str() const
{
return ceph_entity_type_name(type);
void set_id(std::string_view id_);
void set_name(entity_name_t n);
- std::string_view get_type_str() const;
+ const char* get_type_str() const;
uint32_t get_type() const { return type; }
bool is_osd() const { return get_type() == CEPH_ENTITY_TYPE_OSD; }