Re: RFR: 8241439: jdk.NativeLibraryEvent hooks all opened regular files

Denghui Dong denghui.ddh at alibaba-inc.com
Thu Apr 9 08:11:34 UTC 2020


Hi Yasumasa,
I'm not a reviewer, but the following code looks strange:
=====
2096       if ((base == NULL) && (base < phdr_base)) {
=====

if the condition is right, it could be simplified: if (base < phdr_base),
but IMO, the correct condition should be if (base > phdr_base), I may be wrong. ��


Thanks,
Denghui
------------------------------------------------------------------
From:Yasumasa Suenaga <suenaga at oss.nttdata.com>
Send Time:2020年4月9日(星期四) 15:01
To:Hotspot dev runtime <hotspot-runtime-dev at openjdk.java.net>; hotspot-jfr-dev at openjdk.java.net <hotspot-jfr-dev at openjdk.java.net>
Cc:yasuenag at gmail.com <yasuenag at gmail.com>
Subject:RFR: 8241439: jdk.NativeLibraryEvent hooks all opened regular files

Hi all,

Please review this change:

   JBS: https://bugs.openjdk.java.net/browse/JDK-8241439
   webrev: http://cr.openjdk.java.net/~ysuenaga/JDK-8241439/webrev.00/

HotSpot has os::get_loaded_modules_info() to get all loaded native libraries, however it would call callback in twice on same library on Linux. Also it would call callback even if the file is not a library.

We can see this problem in jdk.NativeLibrary JFR event 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
}

     :

```

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

This change uses dl_iterate_phdr() to get them, so these problem has gone.


Thanks,

Yasumasa


More information about the hotspot-runtime-dev mailing list