Segmentation error in _dl_runtime_resolve ()

I do simple string operations in code, where I get a segmentation error. I could not understand what the problem was. Please see who can help.

Back of the core

(gdb) bt
#0  0x00007f595dee41da in _dl_fixup () from /lib64/ld-linux-x86-64.so.2
#1  0x00007f595deea105 in _dl_runtime_resolve () from /lib64/ld-linux-x86-64.so.2
#2  0x0000000000401d04 in getNodeInfo (node=0x7fffbfb4ba83 "TCU-0")
    at hwdetails.cpp:294
#3  0x0000000000402178 in main (argc=3, argv=0x7fffbfb4aef8)
    at hwdetails.cpp:369

Line 294 fails where the statement is cout.
LdapDNis char *and is not NULL.

if ( Epath && (Epath->Entry[0].EntityType == SAHPI_ENT_UNSPECIFIED ||
         Epath->Entry[0].EntityType == SAHPI_ENT_ROOT )) {
        // nothing is mapped. Degrade the ldap dn path to slot.
        if(LdapDN){
            std::cout << "LdapDN " << LdapDN << std::endl;
        }
        std::string ldapDN;
        ldapDN = LdapDN;
        std::string slot = LDAP_PIU_ID;
        if ( ldapDN.compare(0, slot.length(), slot) != 0 ) {
            size_t pos = ldapDN.find(slot);
            if ( pos != std::string::npos ) {
                ldapDN = ldapDN.substr(pos);
                LdapDN = (char *)ldapDN.c_str();
                //getEntityPathFromLdapDn(ldapDN.c_str(), epath, domid);
            }
        }
     }
+3
source share
3 answers

A crash _dl_fixupusually means that you damaged the runtime bootloader.

The two most common causes are:

  • Heap damage (overflow) or
  • Faulty parts of itself glibc.

, . LD_LIBRARY_PATH, glibc, № 2.

# 1 Valgrind , .

, disas info registers GDB, , .

+7

:

LdapDN,

 if ( pos != std::string::npos ) {
            ldapDN = ldapDN.substr(pos);
            LdapDN = (char *)ldapDN.c_str();
            //getEntityPathFromLdapDn(ldapDN.c_str(), epath, domid);
        }
+1

GOT. _dl_runtime_resolve - , GOT ( ), . , GOT. (, printf() libc.so) :

  • goto PLT ( ). PLT - , GOT.
  • PLT goto GOT
  • PLT
  • _dl_runtime_resolve
    • save the address of the actual transition function in GOT
    • dynamic library call function

Second time function call:

  • goto plt
  • goto got
  • GOT has a direct jump to a functional address from a dynamic library. GOT is a reference to a function called again without going through the _dl_runtime_resolve acceleration.
0
source

All Articles