RFR: 8368522: (fs) BasicFileAttributes Linux musl 1.2.5 incompatibility with statx [v2]

Aleksei Voitylov avoitylov at openjdk.org
Thu Oct 9 08:37:51 UTC 2025


> This cleanup replaces #ifdefs with a standard #include <stdint.h>. Using standard types is less prone to errors.
> 
> JDK-8368522 was reported on ARM32 with musl libc, which is not a supported configuration, but I still believe this code cleanup is worth it.
> 
> After the introduction of statx with musl 1.2.5, a buffer overflow issue with statx() call handling started happening on ARM32. The root cause is incorrect size of __uint64_t type definition in the JDK for musl libc, where it was defined as 4 bytes (unsigned long int) for 32-bit systems instead of 8 bytes (unsigned long long).
> 
> The mismatch between JDK's my_statx structure and kernel's statx structure causes stack corruption when statx() writes beyond the statx_buf boundaries, overwriting adjacent variables, including the 'attrs' argument that was later passed to copy_statx_attributes() function and caused a segfault there.
> 
> Built and ran jtreg on standard OpenJDK platforms with no regressions, including the altered test.

Aleksei Voitylov has updated the pull request incrementally with one additional commit since the last revision:

  address review comments

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/27674/files
  - new: https://git.openjdk.org/jdk/pull/27674/files/cfbb570a..fdb34ff8

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=27674&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27674&range=00-01

  Stats: 2 lines in 1 file changed: 1 ins; 1 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/27674.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27674/head:pull/27674

PR: https://git.openjdk.org/jdk/pull/27674


More information about the nio-dev mailing list