[jdk21u-dev] RFR: 8337966: (fs) Files.readAttributes fails with Operation not permitted on older docker releases
Severin Gehwolf
sgehwolf at openjdk.org
Mon Sep 2 12:29:30 UTC 2024
On Fri, 30 Aug 2024 21:32:42 GMT, Alexey Bakhtin <abakhtin at openjdk.org> wrote:
> … on older docker releases
>
> Please review the fix for regression on the old Docker versions (before v18.04).
>
> [JDK-8316304](https://bugs.openjdk.org/browse/JDK-8316304) was backported to JDK21, requiring statx syscall support.
> In the old Docker versions, the default seccomp profile does not allow statx syscall and fails with EPERM error code.
> Suggest fixing this issue by fallback to alternative implementation at runtime if syscall is not allowed.
>
> The same issue with copy_file_range syscall.
>
> The fix was initially submitted against upstream jdk ( https://github.com/openjdk/jdk/pull/20484 ) but after discussion submitted to JDK21
This seems to do more that what is says on the tin. Please explain if both fixes are needed or just the one for the relatively new `statx` issue.
It's a work-around for an old Docker version. Since we introduced `statx` fairly recently it might be OK.
src/java.base/linux/native/libnio/ch/FileDispatcherImpl.c line 75:
> 73: }
> 74: if (errno == EPERM)
> 75: return IOS_UNSUPPORTED;
This is unrelated to [JDK-8316304](https://bugs.openjdk.org/browse/JDK-8316304). If you want to fix this as well, then please as a separate patch. The bug speaks about JDK-8316304 and JDK-8316304 only.
src/java.base/linux/native/libnio/ch/FileDispatcherImpl.c line 108:
> 106: case ENOSYS:
> 107: case EXDEV:
> 108: case EPERM:
This is unrelated to [JDK-8316304](https://bugs.openjdk.org/browse/JDK-8316304). If you want to fix this as well, then please as a separate patch.
src/java.base/linux/native/libnio/fs/LinuxNativeDispatcher.c line 202:
> 200: case ENOSYS:
> 201: case EXDEV:
> 202: case EPERM:
This is unrelated to [JDK-8316304](https://bugs.openjdk.org/browse/JDK-8316304). If you want to fix this as well, then please as a separate patch. The bug speaks about JDK-8316304 and JDK-8316304 only.
src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c line 690:
> 688: copy_statx_attributes(env, &statx_buf, attrs);
> 689: return 0;
> 690: } else if (errno != ENOSYS && errno != EPERM) {
I'd prefer if we only handled `EPERM` with a comment about the docker version issue. `ENOSYS` shouldn't happen since we test for `statx` availability in init() [here](https://github.com/openjdk/jdk21u-dev/blob/bd5b120f516db77c12233d53c8b834dda5b82a89/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c#L432-L435). Also, we are in the `my_statx_func != NULL` branch.
src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c line 722:
> 720: copy_statx_attributes(env, &statx_buf, attrs);
> 721: return;
> 722: } else if (errno != ENOSYS && errno != EPERM) {
Same here `EPERM` only, please.
-------------
Changes requested by sgehwolf (Reviewer).
PR Review: https://git.openjdk.org/jdk21u-dev/pull/951#pullrequestreview-2275454313
PR Review Comment: https://git.openjdk.org/jdk21u-dev/pull/951#discussion_r1740802598
PR Review Comment: https://git.openjdk.org/jdk21u-dev/pull/951#discussion_r1740802346
PR Review Comment: https://git.openjdk.org/jdk21u-dev/pull/951#discussion_r1740801426
PR Review Comment: https://git.openjdk.org/jdk21u-dev/pull/951#discussion_r1740816249
PR Review Comment: https://git.openjdk.org/jdk21u-dev/pull/951#discussion_r1740816791
More information about the jdk-updates-dev
mailing list