segfault at 10 ip 00007fbb33028d4e sp 00007ffd8d3bf380 error 4 in libdbus-1.so.3.19.13[7fbb33027000+2e000]

Srinadh Penugonda srinadh0 at yahoo.com
Tue Sep 28 20:50:32 UTC 2021


Hi All,
I am pretty new to using dbus and wondering if someone could help on understanding why I see a seqfault.
I am trying to write a client wrapper to communicate to a module on the host. 
I have generated the proxy header based on the interface of the host module. And have a method to communicate to the particular host module.

When I try to use that method to send a message to the host module, I see the above coredump.

Backtrace does not display anything - looks like stack is all corrupted.
This is my host module:
   @host_service.method(host_service.bus_name(MOD_NAME), in_signature='as', out_signature='is')
    def key_ctl(self, options):
        param = options[0]
        value = options[1]

Busctl shows the following:
root at sonic:~# busctl introspect org.SONiC.HostService.keyhandler  /org/SONiC/HostService/keyhandler
NAME                                TYPE      SIGNATURE RESULT/VALUE FLAGS
org.SONiC.HostService.keyhandler    interface -         -            -
.key_ctl                            method    as        is           -

This is the proxy xml:
  <interface name="org.SONiC.HostService.keyhandler">
      <method name="key_ctl">
          <arg direction="in"  type="as" name="data"/>                <!-- Must be a list of strings -->
          <arg direction="out" type="(is)" name="(success, output)"/> <!-- output -->
      </method>
  </interface>
My wrapper is as below:
static DBus::Connection  & get_dbusconn(){    static DBus::Connection  * conn_p = nullptr;    if (conn_p == nullptr)    {        // DBus::BusDispatcher is a "main loop" construct that        // handles (i.e. dispatched) DBus messages. This should        // be defined as a singleton to avoid memory leaks.        static DBus::BusDispatcher dispatcher;
        // DBus::default_dispatcher must be initialized before DBus::Connection.        DBus::default_dispatcher = &dispatcher;
        static DBus::Connection conn = DBus::Connection::SystemBus();
        conn_p = &conn;    }
    return *conn_p;}

using namespace std;extern "C" ::DBus::Struct<int, string>  HostQuery(const char *path_p, const char *val_p[]) {    // tokenize module and action    string s(path_p);    stringstream ss(s);    vector<string> tokens;    string temp_str;
    while (getline(ss, temp_str, '.')) { //use . as delim for tokenizing string       tokens.push_back(temp_str);    }    syslog(LOG_CRIT, "HostQuery - tokens[0] %s tokens[1] %s\n", tokens[0].c_str(), tokens[1].c_str());    syslog(LOG_CRIT, "HostQuery - val_p[0] %s val_p[1] %s\n", val_p[0], val_p[1]);
    // get absolute paths with the module    string name(DBUS_BUS_NAME_BASE);    name += tokens[0];
    string path(DBUS_OBJ_PATH_BASE);    path += tokens[0];    syslog(LOG_CRIT, "HOstQuery - name %s path %s\n", name.c_str(), path.c_str());    ::DBus::Struct<int/*success*/, std::string/*errmsg*/> ret;
    try {        keyhandler_proxy_c host_client(get_dbusconn(), path.c_str(), name.c_str());
        //TODO: need to find how many elements are there in val_p.        // for encrypt/decrypt, there may be only one element in it.        // but for masterkey update, there could be two elements        vector<string> vals = {"pwEncrypt","eventd"};
        //vector<string> vals;        //string v1(val_p[0]);        //string v2(val_p[1]);        //vals.push_back(v1);        //vals.push_back(v2);
        ret = host_client.key_ctl(vals);    } catch (DBus::Error & ex) {        syslog(LOG_CRIT, "hostquery - DBus Exception %s\n", ex.what());        syslog(LOG_CRIT, "hostquery (path %s val_p[0] %s \n", path_p, val_p[0]);    }
    return ret;}



The log shows the following.
Sep 28 20:37:47.524196+00:00 2021 sonic CRIT eventd#eventd[22]: HostQuery - tokens[0] keyhandler tokens[1] key_ctlSep 28 20:37:47.526096+00:00 2021 sonic CRIT eventd#eventd[22]: HostQuery - val_p[0] pwEncrypt val_p[1] eventdSep 28 20:37:47.526096+00:00 2021 sonic CRIT eventd#eventd[22]: HOstQuery - name org.SONiC.HostService.keyhandler path /org/SONiC/HostService/keyhandlerSep 28 20:37:47.540123+00:00 2021 sonic CRIT kernel: [16070.635164] eventd[29966]: segfault at 10 ip 00007fbb33028d4e sp 00007ffd8d3bf380 error 4 in libdbus-1.so.3.19.13[7fbb33027000+2e000]Sep 28 20:37:47.540105+00:00 2021 sonic WARNING kernel: [16068.361437] IPv6: PREDAD not set IP6: 00000000000000000000000000000001/80 state: 00000001Sep 28 20:37:47.540123+00:00 2021 sonic CRIT kernel: [16070.635164] eventd[29966]: segfault at 10 ip 00007fbb33028d4e sp 00007ffd8d3bf380 error 4 in libdbus-1.so.3.19.13[7fbb33027000+2e000]Sep 28 20:37:47.560482+00:00 2021 sonic CRIT kernel: [16070.647419] Code: 04 00 66 90 ff 25 9a 32 04 00 66 90 ff 25 9a 32 04 00 66 90 ff 25 a2 32 04 00 66 90 48 8d 3d 11 eb 02 00 31 c0 e8 62 f5 ff ff <48> 8b 04 25 10 00 00 00 0f 0b e8 63 e4 ff ff 0f 1f 00 48 8d 3d 41Sep 28 20:37:47.803046+00:00 2021 sonic CRIT systemd-coredump[29978]: Process 29966 (eventd) of user 0 dumped core.#012#012Stack trace of thread 22:#012#0  0x00007fbb33028d4e n/a (libdbus-1.so.3)#012#1  0x00007fbb32e08a77 _ZN4DBus11MessageIter7recurseEv (libdbus-c++-1.so.0)#012#2  0x00007fbb336261ac n/a (/usr/lib/x86_64-linux-gnu/libhostcomm.so.0.0.0)#012#3  0x00007ffd00600000 n/a (n/a)Sep 28 20:37:50.856971+00:00 2021 sonic NOTICE eventd#eventd[23][16073.969937] eventd[30278]: segfault at 10 ip 00007f7b4ba01d4e sp 00007ffe3d7ba040 error 4 in libdbus-1.so.3.19.13[7f7b4ba00000+2e000]: :- read_events[16073.982372] Code: 04 00 66 90 ff 25 9a 32 04 00 66 90 ff 25 9a 32 04 00 66 90 ff 25 a2 32 04 00 66 90 48 8d 3d 11 eb 02 00 31 c0 e8 62 f5 ff ff <48> 8b 04 25 10 00 00 00 0f 0b e8 63 e4 ff ff 0f 1f 00 48 8d 3d 41




~~  Thanks, Srinadh



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20210928/62b8db0d/attachment.htm>


More information about the dbus mailing list