Print this page
smatch clean rtld


 220         Slookup         sl;
 221         Sresult         sr;
 222         int             entry, lmflags;
 223         Lm_list         *lml;
 224 
 225         /*
 226          * For compatibility with libthread (TI_VERSION 1) we track the entry
 227          * value.  A zero value indicates we have recursed into ld.so.1 to
 228          * further process a locking request.  Under this recursion we disable
 229          * tsort and cleanup activities.
 230          */
 231         entry = enter(0);
 232 
 233         lml = LIST(lmp);
 234         if ((lmflags = lml->lm_flags) & LML_FLG_RTLDLM) {
 235                 dbg_class = dbg_desc->d_class;
 236                 dbg_desc->d_class = 0;
 237         }
 238 
 239         /*
 240          * Perform some basic sanity checks.  If we didn't get a load map or
 241          * the relocation offset is invalid then its possible someone has walked
 242          * over the .got entries or jumped to plt0 out of the blue.
 243          */
 244         if ((!lmp) && (pltndx <=
 245             (ulong_t)PLTRELSZ(lmp) / (ulong_t)RELENT(lmp))) {
 246                 Conv_inv_buf_t inv_buf;
 247 
 248                 eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_PLTREF),
 249                     conv_reloc_amd64_type(R_AMD64_JUMP_SLOT, 0, &inv_buf),
 250                     EC_NATPTR(lmp), EC_XWORD(pltndx), EC_NATPTR(from));
 251                 rtldexit(lml, 1);
 252         }
 253         reloff = pltndx * (ulong_t)RELENT(lmp);
 254 
 255         /*
 256          * Use relocation entry to get symbol table entry and symbol name.
 257          */
 258         addr = (ulong_t)JMPREL(lmp);
 259         rptr = (Rela *)(addr + reloff);
 260         rsymndx = ELF_R_SYM(rptr->r_info);
 261         rsym = (Sym *)((ulong_t)SYMTAB(lmp) + (rsymndx * SYMENT(lmp)));
 262         name = (char *)(STRTAB(lmp) + rsym->st_name);
 263 
 264         /*
 265          * Determine the last link-map of this list, this'll be the starting




 220         Slookup         sl;
 221         Sresult         sr;
 222         int             entry, lmflags;
 223         Lm_list         *lml;
 224 
 225         /*
 226          * For compatibility with libthread (TI_VERSION 1) we track the entry
 227          * value.  A zero value indicates we have recursed into ld.so.1 to
 228          * further process a locking request.  Under this recursion we disable
 229          * tsort and cleanup activities.
 230          */
 231         entry = enter(0);
 232 
 233         lml = LIST(lmp);
 234         if ((lmflags = lml->lm_flags) & LML_FLG_RTLDLM) {
 235                 dbg_class = dbg_desc->d_class;
 236                 dbg_desc->d_class = 0;
 237         }
 238 
 239         /*
 240          * Perform some basic sanity checks.  If the relocation offset is
 241          * invalid then its possible someone has walked over the .got entries.

 242          */
 243         if (pltndx > (ulong_t)PLTRELSZ(lmp) / (ulong_t)RELENT(lmp)) {

 244                 Conv_inv_buf_t inv_buf;
 245 
 246                 eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_PLTREF),
 247                     conv_reloc_amd64_type(R_AMD64_JUMP_SLOT, 0, &inv_buf),
 248                     EC_NATPTR(lmp), EC_XWORD(pltndx), EC_NATPTR(from));
 249                 rtldexit(lml, 1);
 250         }
 251         reloff = pltndx * (ulong_t)RELENT(lmp);
 252 
 253         /*
 254          * Use relocation entry to get symbol table entry and symbol name.
 255          */
 256         addr = (ulong_t)JMPREL(lmp);
 257         rptr = (Rela *)(addr + reloff);
 258         rsymndx = ELF_R_SYM(rptr->r_info);
 259         rsym = (Sym *)((ulong_t)SYMTAB(lmp) + (rsymndx * SYMENT(lmp)));
 260         name = (char *)(STRTAB(lmp) + rsym->st_name);
 261 
 262         /*
 263          * Determine the last link-map of this list, this'll be the starting