RFR(xs): 8216559: [JFR] Native libraries not correctly parsed from /proc/self/maps

Severin Gehwolf sgehwolf at redhat.com
Fri Jan 11 13:35:00 UTC 2019


Hi,

Could I please get a review of this tiny fix for native libraries
parsing from /proc/<pid>/maps? It's a Linux-only change and seems to
surface only on certain systems (with 3-digit device ids in /proc). The
issue has been noticed since TestNativeLibrariesEvent.java was failing
for me.

What's the problem? The Linux impl of os::get_loaded_modules_info reads
/proc/self/maps and scans each line into variables via sscanf(). The
format for the device pointer allowed up to 5 characters. In my case it
was 6 characters long. As a result, the last digit of the device id got
interpreted as inode value and the inode value as name. Thus, the
failing test was showing strange library names like "25847051".

According to the spec, major:minor device numbers may be up to 3-digits 
in length. Hence, I propose to change the format from '%5s' to '%7s': 3
digits for major/minor each, plus one for ':'.

Bug: https://bugs.openjdk.java.net/browse/JDK-8216559
webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8216559/webrev.01/

Testing: jdk_jfr tests on Linux x86_64 including TestNativeLibrariesEvent.java
         which now passes.

Thoughts?

Thanks,
Severin



More information about the hotspot-jfr-dev mailing list