8025812: tmtools/jmap/heap_config tests fail on Linux-ia32 because it Cant attach to the core file

Coredump store memsz elf field rounded up to page

Reviewed-by: dholmes, sla
This commit is contained in:
Dmitry Samersoff 2013-10-17 16:08:01 +04:00
parent 8a70ecee80
commit d6f90baf17

View file

@ -736,26 +736,29 @@ static bool read_lib_segments(struct ps_prochandle* ph, int lib_fd, ELF_EHDR* li
if (existing_map == NULL){ if (existing_map == NULL){
if (add_map_info(ph, lib_fd, lib_php->p_offset, if (add_map_info(ph, lib_fd, lib_php->p_offset,
target_vaddr, lib_php->p_filesz) == NULL) { target_vaddr, lib_php->p_memsz) == NULL) {
goto err; goto err;
} }
} else { } else {
// Coredump stores value of p_memsz elf field
// rounded up to page boundary.
if ((existing_map->memsz != page_size) && if ((existing_map->memsz != page_size) &&
(existing_map->fd != lib_fd) && (existing_map->fd != lib_fd) &&
(existing_map->memsz != lib_php->p_filesz)){ (ROUNDUP(existing_map->memsz, page_size) != ROUNDUP(lib_php->p_memsz, page_size))) {
print_debug("address conflict @ 0x%lx (size = %ld, flags = %d\n)", print_debug("address conflict @ 0x%lx (existing map size = %ld, size = %ld, flags = %d)\n",
target_vaddr, lib_php->p_filesz, lib_php->p_flags); target_vaddr, existing_map->memsz, lib_php->p_memsz, lib_php->p_flags);
goto err; goto err;
} }
/* replace PT_LOAD segment with library segment */ /* replace PT_LOAD segment with library segment */
print_debug("overwrote with new address mapping (memsz %ld -> %ld)\n", print_debug("overwrote with new address mapping (memsz %ld -> %ld)\n",
existing_map->memsz, lib_php->p_filesz); existing_map->memsz, ROUNDUP(lib_php->p_memsz, page_size));
existing_map->fd = lib_fd; existing_map->fd = lib_fd;
existing_map->offset = lib_php->p_offset; existing_map->offset = lib_php->p_offset;
existing_map->memsz = lib_php->p_filesz; existing_map->memsz = ROUNDUP(lib_php->p_memsz, page_size);
} }
} }