-
Bug
-
Resolution: Fixed
-
P4
-
8u221, 11, 13, 14
-
b17
-
linux
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8231944 | 13.0.2 | Vladimir Kempik | P4 | Resolved | Fixed | b02 |
JDK-8236638 | 11.0.7-oracle | Ravi Reddy | P4 | Resolved | Fixed | b02 |
JDK-8232688 | 11.0.6 | Vladimir Kempik | P4 | Resolved | Fixed | b01 |
JDK-8239336 | openjdk8u252 | Vladimir Kempik | P4 | Resolved | Fixed | b04 |
Currently jni func getmntent uses library's getmntent_r with work buffer of size 1024, allocated on stack.
JNIEXPORT jint JNICALL
Java_sun_nio_fs_LinuxNativeDispatcher_getmntent(JNIEnv* env, jclass this,
jlong value, jobject entry)
{
struct mntent ent;
char buf[1024];
....
m = getmntent_r(fp, &ent, (char*)&buf, buflen);
In some circumstances it's not enough. for example in docker, with overlayfs we can easily go greater than 1024 bytes per line
need to increase that size, it's better to go with library's getmntent, which will allocate 4096 on glibc and as much as needed on musl. In this case java will be on par with other system utils.
example of entry in /proc/mounts which causes parsing failure in java
overlay / overlay rw,relatime,lowerdir=/var/lib/docker/overlay2/l/4OJWMLVEPUYBIINATIJYD5AR4A:/var/lib/docker/overlay2/l/BDPV7JUZMLFT2UTSHLSXAAEXJF:/var/lib/docker/overlay2/l/FJSNMHMQCRZYZ7DM6U7ZNTTDB3:/var/lib/docker/overlay2/l/VD3XKYF5UG747TAPJQARVNZQGS:/var/lib/docker/overlay2/l/FAM4UQVWPZY4VY7OWZYNQTYFKR:/var/lib/docker/overlay2/l/DJKXL7Y4XW736RZHCPHNPYBXST:/var/lib/docker/overlay2/l/EFQNH7TVKW2JE6WPQZ2GOI5IXL:/var/lib/docker/overlay2/l/7ZHB6OK5AAA3BEM5AHC55P52D5:/var/lib/docker/overlay2/l/Z3DKKP4J27SFFJWBJ3BRCFPOEC:/var/lib/docker/overlay2/l/FBREGCKO3ELPH4TDOKME5D7ZN5:/var/lib/docker/overlay2/l/DOVG72SJ7UVTP3NMAMBRVYFIK3:/var/lib/docker/overlay2/l/UT6LTWTRKNCSIVE3SN6KU5OBYD:/var/lib/docker/overlay2/l/IOYADTFJLVEG3E7P6YOT5TPEUM:/var/lib/docker/overlay2/l/3FFG3CZ65N42NXFHPBFS3ZG4DL:/var/lib/docker/overlay2/l/VROD4KBP7ADH5O5JKFHH7BSZJF:/var/lib/docker/overlay2/l/IRAV2XDBVUHXQ5YCOKUHOTI74A:/var/lib/docker/overlay2/l/JD6LPCYSY2ZYD5ZKTLF36S6H6U:/var/lib/docker/overlay2/l/7PM25KREJ3VRRD7AHYMUZO3GAP:/var/lib/docker/overlay2/l/TVAAGWQIIGNRRSW6CFVCTWNQEA,upperdir=/var/lib/docker/overlay2/cb73ac1031f0eb741fbcd882e7349a531a07f8dd5c8423252a4ea9708b8a9ee5/diff,workdir=/var/lib/docker/overlay2/cb73ac1031f0eb741fbcd882e7349a531a07f8dd5c8423252a4ea9708b8a9ee5/work 0 0
JNIEXPORT jint JNICALL
Java_sun_nio_fs_LinuxNativeDispatcher_getmntent(JNIEnv* env, jclass this,
jlong value, jobject entry)
{
struct mntent ent;
char buf[1024];
....
m = getmntent_r(fp, &ent, (char*)&buf, buflen);
In some circumstances it's not enough. for example in docker, with overlayfs we can easily go greater than 1024 bytes per line
need to increase that size, it's better to go with library's getmntent, which will allocate 4096 on glibc and as much as needed on musl. In this case java will be on par with other system utils.
example of entry in /proc/mounts which causes parsing failure in java
overlay / overlay rw,relatime,lowerdir=/var/lib/docker/overlay2/l/4OJWMLVEPUYBIINATIJYD5AR4A:/var/lib/docker/overlay2/l/BDPV7JUZMLFT2UTSHLSXAAEXJF:/var/lib/docker/overlay2/l/FJSNMHMQCRZYZ7DM6U7ZNTTDB3:/var/lib/docker/overlay2/l/VD3XKYF5UG747TAPJQARVNZQGS:/var/lib/docker/overlay2/l/FAM4UQVWPZY4VY7OWZYNQTYFKR:/var/lib/docker/overlay2/l/DJKXL7Y4XW736RZHCPHNPYBXST:/var/lib/docker/overlay2/l/EFQNH7TVKW2JE6WPQZ2GOI5IXL:/var/lib/docker/overlay2/l/7ZHB6OK5AAA3BEM5AHC55P52D5:/var/lib/docker/overlay2/l/Z3DKKP4J27SFFJWBJ3BRCFPOEC:/var/lib/docker/overlay2/l/FBREGCKO3ELPH4TDOKME5D7ZN5:/var/lib/docker/overlay2/l/DOVG72SJ7UVTP3NMAMBRVYFIK3:/var/lib/docker/overlay2/l/UT6LTWTRKNCSIVE3SN6KU5OBYD:/var/lib/docker/overlay2/l/IOYADTFJLVEG3E7P6YOT5TPEUM:/var/lib/docker/overlay2/l/3FFG3CZ65N42NXFHPBFS3ZG4DL:/var/lib/docker/overlay2/l/VROD4KBP7ADH5O5JKFHH7BSZJF:/var/lib/docker/overlay2/l/IRAV2XDBVUHXQ5YCOKUHOTI74A:/var/lib/docker/overlay2/l/JD6LPCYSY2ZYD5ZKTLF36S6H6U:/var/lib/docker/overlay2/l/7PM25KREJ3VRRD7AHYMUZO3GAP:/var/lib/docker/overlay2/l/TVAAGWQIIGNRRSW6CFVCTWNQEA,upperdir=/var/lib/docker/overlay2/cb73ac1031f0eb741fbcd882e7349a531a07f8dd5c8423252a4ea9708b8a9ee5/diff,workdir=/var/lib/docker/overlay2/cb73ac1031f0eb741fbcd882e7349a531a07f8dd5c8423252a4ea9708b8a9ee5/work 0 0
- backported by
-
JDK-8231944 (fs) Increase buffer size used with getmntent
- Resolved
-
JDK-8232688 (fs) Increase buffer size used with getmntent
- Resolved
-
JDK-8236638 (fs) Increase buffer size used with getmntent
- Resolved
-
JDK-8239336 (fs) Increase buffer size used with getmntent
- Resolved
- relates to
-
JDK-8315506 C99 compatibility issue in LinuxNativeDispatcher
- Resolved
-
JDK-8208175 (fs) Mount point not found for a file which is present in overlayfs
- Resolved
(1 relates to)