JDK-8225636 : SA can't handle prelinked libraries
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc-agent
  • Affected Version: 8,9,10,11,12,13
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • Submitted: 2019-06-12
  • Updated: 2020-07-14
  • Resolved: 2019-06-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14 Other
11.0.5Fixed 13.0.4Fixed 14 b02Fixed openjdk8u232Fixed
Related Reports
Relates :  
Description
I attempted to open the core which is generated by RHEL 6, but it could not .
I got debug log from SA with LIBSAPROC_DEBUG=1 as below:

```
libsaproc DEBUG: first link map is at 0x3fd6c22188
libsaproc DEBUG: path /lib64/libpthread.so.0 substituted for /lib64/libpthread.so.0
libsaproc DEBUG: reading library /lib64/libpthread.so.0 @ 0x0 [ 0x0 ]
libsaproc DEBUG: address conflict @ 0x0 (existing map size = 129808, size = 93908, flags = 5)
libsaproc DEBUG: can't read shared object's segments
```

The OS which generated the core is set to enable prelink, and libpthread is prelinked.
According to GDB implementation, load address of prelinked library should be calculated by offset of link_map.l_ld and the address of .dynamic section.

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/solib-svr4.c;h=2828c96c68355931332c1704035e9a0d8f691fad;hb=HEAD#l285

I attached the patch for this issue (sa-prelink.patch).
Comments
Fix request for 13u: the change applies cleanly, the followup patch for JDK-8235637 also applies cleanly.
28-04-2020

The fix for this CR causes a regression. Please see JDK-8235637.
10-12-2019

Approved for 8u. I've also flagged the similar JDK-8038392.
18-06-2019

Fix Request for 11u and 8u: SA helps troubleshooter to analyze core images. However it would not work when coredump would happen on prelink-enabled environment - e.g. CentOS 6 and RHEL 6. For analyzing HotSpot issue on production environment, we need to fix this issue for LTS version (8u and 11u). The fix is low risk. This change can pass serviceability/sa jtreg tests. The JDK 14 patch applies as is to JDK 11u. For 8u, we need to change the path to ps_core.c , but we can apply it without further change.
18-06-2019