Print this page
smatch clean rtld

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c
          +++ new/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c
↓ open down ↓ 229 lines elided ↑ open up ↑
 230  230           */
 231  231          entry = enter(0);
 232  232  
 233  233          lml = LIST(lmp);
 234  234          if ((lmflags = lml->lm_flags) & LML_FLG_RTLDLM) {
 235  235                  dbg_class = dbg_desc->d_class;
 236  236                  dbg_desc->d_class = 0;
 237  237          }
 238  238  
 239  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.
      240 +         * Perform some basic sanity checks.  If the relocation offset is
      241 +         * invalid then its possible someone has walked over the .got entries.
 243  242           */
 244      -        if ((!lmp) && (pltndx <=
 245      -            (ulong_t)PLTRELSZ(lmp) / (ulong_t)RELENT(lmp))) {
      243 +        if (pltndx > (ulong_t)PLTRELSZ(lmp) / (ulong_t)RELENT(lmp)) {
 246  244                  Conv_inv_buf_t inv_buf;
 247  245  
 248  246                  eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_PLTREF),
 249  247                      conv_reloc_amd64_type(R_AMD64_JUMP_SLOT, 0, &inv_buf),
 250  248                      EC_NATPTR(lmp), EC_XWORD(pltndx), EC_NATPTR(from));
 251  249                  rtldexit(lml, 1);
 252  250          }
 253  251          reloff = pltndx * (ulong_t)RELENT(lmp);
 254  252  
 255  253          /*
↓ open down ↓ 709 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX