RFR: 8367609: serviceability/sa/ClhsdbPmap.java fails when built with Clang [v2]
Chris Plummer
cjplummer at openjdk.org
Mon Sep 15 20:17:16 UTC 2025
On Sun, 14 Sep 2025 23:37:02 GMT, Francesco Andreuzzi <fandreuzzi at openjdk.org> wrote:
>> The problem seems to be in read_lib_segments (ps_core.c), this check is too harsh:
>>
>> https://github.com/openjdk/jdk/blob/5271448b3a013b2e3edcd619a4a3b975b292dae1/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c#L423-L425
>>
>> In my run, `existing_map->memsz = 0xe24000`, while the rhs in L425 is `0xe23000`. According to the NT_FILE entry, this segment of `libjvm.so` has file offset 0x67f000. It seems that the linker aligned it down according to the page size (0x1000). The offset of the same segment according to `readelf -l libjvm.so` is 0x67fc80. This additional offset should be added to `p_memsz` to obtain the 0xe24000, which we see in the core dump.
>>
>> I added some files to the ticket for context.
>>
>> Passes `tier1` and `tier2`.
>
> Francesco Andreuzzi has updated the pull request incrementally with one additional commit since the last revision:
>
> simplify
src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c line 432:
> 430: // We should trust the core dump in this case.
> 431: continue;
> 432: }
If this added check passes, then you will ignore any error that may have been caught by the previous page_size and lib_fd checks. It think you will need to redo those here before doing the continue. The other choice is to add this extra check to the original `if` condition, and require that just one of the two `ROUNDUP(existing_map->memsz, page_size)` checks passes.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27274#discussion_r2349998816
More information about the serviceability-dev
mailing list