RFR: 8229872: (fs) Increase buffer size used with getmntent

Vladimir Kempik vkempik at azul.com
Mon Aug 19 11:22:21 UTC 2019


Hello

Please review the suggested fix for bug JDK-8229872

Files.getFileStore() will fail if there is an entry in /proc/mounts which is greater than 1024 bytes length
This happens because we allocate 1024 bytes size buffer on stack for use with getmntent_r.

A possible way is to use getmntent instead, it will allocated 4kb buffer on glibc and «as much as needed» on musl (https://www.openwall.com/lists/musl/2016/09/08/1 <https://www.openwall.com/lists/musl/2016/09/08/1>)
But getmntent is dubbed "MT-Unsafe race:mntentbuf locale»

I have tested this fix on openjdk8u222 and it can parse long entries fine.

Any suggestions?

Thanks, Vladimir


The bug: https://bugs.openjdk.java.net/browse/JDK-8229872

The webrev: http://cr.openjdk.java.net/~vkempik/8229872/webrev.01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190819/bee6561f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190819/bee6561f/signature.asc>


More information about the nio-dev mailing list