RFR: 8367609: serviceability/sa/ClhsdbPmap.java fails when built with Clang [v5]
Francesco Andreuzzi
fandreuzzi at openjdk.org
Wed Oct 1 22:40:47 UTC 2025
On Tue, 23 Sep 2025 14:24:47 GMT, Kevin Walls <kevinw at openjdk.org> wrote:
>> Francesco Andreuzzi has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - nn
>> - comment and rename
>
> Thanks for the additional info.
>
> If I ignore what's said so far and start again, I see the following... (anyone should feel free to correct, we aren't in this
> area every day!...)
>
> hsdb> ERROR: address conflict @ 0x7fa9ff0e4440 (existing map size = 102400, size = 97328, flags = 5)
>
> print_error("address conflict @ 0x%lx (existing map size = %ld, size = %ld, flags = %d)\n",
> target_vaddr, existing_map->memsz, lib_php->p_memsz, lib_php->p_flags);
>
> core has no mapping at exactly 0x7fa9ff0e4440 but has:
>
> Start End Page Offset
> 0x00007fa9ff0db000 0x00007fa9ff0e4000 0x0000000000000000 /home/fandreuz/code/jdk/build/clang/images/jdk/lib/libjimage.so (0x9000 size) 0x841c rounded up
> 0x00007fa9ff0e4000 0x00007fa9ff0fd000 0x0000000000000008 /home/fandreuz/code/jdk/build/clang/images/jdk/lib/libjimage.so (0x19000 size) the existing map size from the error
>
>
> The error is having a size 0x17c30 mapping that should go at 0x00007fa9ff0e4000
> That is the second LOAD phdr from libjimage.
>
> The check which has been working for gcc builds:
> ROUNDUP(existing_map->memsz, page_size) != ROUNDUP(lib_php->p_memsz, page_size)
>
> 102400 = 0x19000 is mem size, page size aligned. The core has a mapping of this size.
> 97328 = 0x17c30 libjimage has this, which rounds up to only 0x18000
>
> libjimage is providing too little data?
> But target vaddr 0x7fa9ff0e4440 is offset into the actual segment 0x00007fa9ff0e4000 by 0x440 (1088 bytes)
>
> 0x17c30 + 0x440 = 0x18070 which rounds up to the wanted 0x19000
>
>
> src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c
>
> 399 uintptr_t target_vaddr = lib_php->p_vaddr + lib_base;
> 400 map_info *existing_map = core_lookup(ph, target_vaddr);
>
> (Existing code expects target_vaddr and existing_map->vaddr to be exactly equal, not to see target_vaddr being
> anything other than 0x1000 aligned.)
>
> Maybe we:
> check if target_vaddr > existing_map->vaddr and add any difference to the library mem size we compare?
>
>
> 429 (ROUNDUP(existing_map->memsz, page_size) != ROUNDUP(lib_php->p_memsz, page_size))) {
>
> + uint64_t lib_memsz = lib_php->p_memsz; // check type
> + if (target_vaddr > existing_map->vaddr) {
> + lib_memsz += (target_vaddr - existing_map->vaddr);
> + }
> + lib_memsz = ROUNDUP(lib_memsz, page_size);
> +
> if ((existing_map->memsz != page_size) &&
> (existing_map->fd != lib_fd) &&
> - (ROUNDUP(existing_map->memsz, page_s...
Thanks for the review @kevinjwalls and @plummercj !
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27274#issuecomment-3358393761
More information about the serviceability-dev
mailing list