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

Thu, 17 Oct 2013 16:08:01 +0400

author
dsamersoff
date
Thu, 17 Oct 2013 16:08:01 +0400
changeset 5961
1bee3014cf2a
parent 5960
9e0ef3f02648
child 5963
ad8e901ca2e1
child 5965
b942ac65ac86

8025812: tmtools/jmap/heap_config tests fail on Linux-ia32 because it Cant attach to the core file
Summary: Coredump store memsz elf field rounded up to page
Reviewed-by: dholmes, sla

agent/src/os/linux/ps_core.c file | annotate | diff | comparison | revisions
     1.1 --- a/agent/src/os/linux/ps_core.c	Wed Oct 16 15:26:12 2013 -0400
     1.2 +++ b/agent/src/os/linux/ps_core.c	Thu Oct 17 16:08:01 2013 +0400
     1.3 @@ -719,7 +719,7 @@
     1.4    ELF_PHDR* phbuf;
     1.5    ELF_PHDR* lib_php = NULL;
     1.6  
     1.7 -  int page_size=sysconf(_SC_PAGE_SIZE);
     1.8 +  int page_size = sysconf(_SC_PAGE_SIZE);
     1.9  
    1.10    if ((phbuf = read_program_header_table(lib_fd, lib_ehdr)) == NULL) {
    1.11      return false;
    1.12 @@ -736,26 +736,29 @@
    1.13  
    1.14        if (existing_map == NULL){
    1.15          if (add_map_info(ph, lib_fd, lib_php->p_offset,
    1.16 -                          target_vaddr, lib_php->p_filesz) == NULL) {
    1.17 +                          target_vaddr, lib_php->p_memsz) == NULL) {
    1.18            goto err;
    1.19          }
    1.20        } else {
    1.21 +        // Coredump stores value of p_memsz elf field
    1.22 +        // rounded up to page boundary.
    1.23 +
    1.24          if ((existing_map->memsz != page_size) &&
    1.25              (existing_map->fd != lib_fd) &&
    1.26 -            (existing_map->memsz != lib_php->p_filesz)){
    1.27 +            (ROUNDUP(existing_map->memsz, page_size) != ROUNDUP(lib_php->p_memsz, page_size))) {
    1.28  
    1.29 -          print_debug("address conflict @ 0x%lx (size = %ld, flags = %d\n)",
    1.30 -                        target_vaddr, lib_php->p_filesz, lib_php->p_flags);
    1.31 +          print_debug("address conflict @ 0x%lx (existing map size = %ld, size = %ld, flags = %d)\n",
    1.32 +                        target_vaddr, existing_map->memsz, lib_php->p_memsz, lib_php->p_flags);
    1.33            goto err;
    1.34          }
    1.35  
    1.36          /* replace PT_LOAD segment with library segment */
    1.37          print_debug("overwrote with new address mapping (memsz %ld -> %ld)\n",
    1.38 -                     existing_map->memsz, lib_php->p_filesz);
    1.39 +                     existing_map->memsz, ROUNDUP(lib_php->p_memsz, page_size));
    1.40  
    1.41          existing_map->fd = lib_fd;
    1.42          existing_map->offset = lib_php->p_offset;
    1.43 -        existing_map->memsz = lib_php->p_filesz;
    1.44 +        existing_map->memsz = ROUNDUP(lib_php->p_memsz, page_size);
    1.45        }
    1.46      }
    1.47  

mercurial