JDK-8241439 : jdk.NativeLibraryEvent hooks all opened regular files
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • Submitted: 2020-03-23
  • Updated: 2024-10-17
  • Resolved: 2020-06-08
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 15
15 b27Fixed
Related Reports
Relates :  
Relates :  
Description
https://mail.openjdk.java.net/pipermail/hotspot-jfr-dev/2020-March/001302.html

We would get multiple jdk.NativeLibrary events from 1 library as below:

```
jdk.NativeLibrary {
   startTime = 16:59:06.621
   name = "/usr/lib64/libc-2.30.so"
   baseAddress = 0x7FDB06ACC000
   topAddress = 0x7FDB06AF1000
}

jdk.NativeLibrary {
   startTime = 16:59:06.621
   name = "/usr/lib64/libc-2.30.so"
   baseAddress = 0x7FDB06AF1000
   topAddress = 0x7FDB06C40000
}

    :

```

In addition, we would get the events even if they are not shared library as below:

```
jdk.NativeLibrary {
   startTime = 16:59:06.621
   name = "/home/ysuenaga/OpenJDK/jdk/build/linux-x86_64-server-fastdebug/images/jdk/lib/server/cl
asses.jsa"
   baseAddress = 0x800000000
   topAddress = 0x800007000
}
```

os::get_loaded_modules_info() has introduced in JDK-8056242, and it says this function is for dll/so/dylibs.
In fact, os::get_loaded_modules_info() uses EnumProcessModules() in Windows.

We should merge same library to one event, and should not hook regular files (not shared library).
Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/b10be698fbaa User: ysuenaga Date: 2020-06-08 08:21:46 +0000
08-06-2020

Suggested fix: http://hg.openjdk.java.net/jdk/submit/rev/873cb61ba446 We can use dl_iterate_phdr(3) to fix this issue instead of /proc/<PID>/maps. It affects for JFR NativeLibrary event on Linux only.
26-05-2020