Print this page
OS-5293 lx brand: prelink(8)'d binaries core dump before main()
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/mmapobj.c
          +++ new/usr/src/uts/common/os/mmapobj.c
↓ open down ↓ 1352 lines elided ↑ open up ↑
1353 1353                           */
1354 1354                          if (p_memsz == 0) {
1355 1355                                  STRUCT_SET_HANDLE(mph, model,
1356 1356                                      (struct myphdr *)((size_t)STRUCT_BUF(mph) +
1357 1357                                      hsize));
1358 1358                                  MOBJ_STAT_ADD(nomem_header);
1359 1359                                  continue;
1360 1360                          }
1361 1361                          if (num_segs++ == 0) {
1362 1362                                  /*
1363      -                                 * The p_vaddr of the first PT_LOAD segment
1364      -                                 * must either be NULL or within the first
1365      -                                 * page in order to be interpreted.
1366      -                                 * Otherwise, its an invalid file.
     1363 +                                 * While ELF doesn't specify the meaning of
     1364 +                                 * p_vaddr for PT_LOAD segments in ET_DYN
     1365 +                                 * objects, we mandate that is either NULL or
     1366 +                                 * (to accommodate some historical binaries)
     1367 +                                 * within the first page.  (Note that there
     1368 +                                 * exist non-native ET_DYN objects that violate
     1369 +                                 * this constraint that we nonetheless must be
     1370 +                                 * able to execute; see the ET_DYN handling in
     1371 +                                 * mapelfexec() for details.)
1367 1372                                   */
1368 1373                                  if (e_type == ET_DYN &&
1369 1374                                      ((caddr_t)((uintptr_t)vaddr &
1370 1375                                      (uintptr_t)PAGEMASK) != NULL)) {
1371 1376                                          MOBJ_STAT_ADD(inval_header);
1372 1377                                          return (ENOTSUP);
1373 1378                                  }
1374 1379                                  start_addr = vaddr;
1375 1380                                  /*
1376 1381                                   * For the first segment, we need to map from
↓ open down ↓ 1073 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX