RFR: 8371048: ImageFileReader::open fails to check return value of osSupport::map_memory
David Beaumont
duke at openjdk.org
Thu Nov 13 14:03:09 UTC 2025
On Fri, 31 Oct 2025 14:00:38 GMT, Justin King <jcking at openjdk.org> wrote:
> Check whether `osSupport::map_memory` actually succeeded in all compliation modes, instead of crashing shortly after in non-debug builds. Ideally we should fall back to just reading the entire file into memory manually or use seek+read, but this is good enough for now to avoid crashing.
If it must fail if the jimage file cannot be opened, that should mean it must fail when the file is not present, unless the existence of the file is what defines "an images build".
If "is an images build" is meant to be a synonym for "the jimage file exists on disk", then this change might create a case where one observer decides "the is an images build" (by looking for the file) but the JVM behaves as if it's an "exploded" build and loads classes from elsewhere (though equally, this might not be possible based on other code paths).
The jimage file existing on disk is something that the JVM build/installation controls, but whether mmap works is something the underlying system controls. This change conflates the two things in terms of subsequent behaviour, and I'm not 100% sure that's what we want.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28087#issuecomment-3527950696
More information about the core-libs-dev
mailing list