RFR: 8356597: AOT cache and CDS archive should not be created in read-only mode

Aleksey Shipilev shade at openjdk.org
Fri May 9 11:36:54 UTC 2025


On Fri, 9 May 2025 11:25:11 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> For some unknown historical reasons, AOT caches and CDS archives have been created in read-only mode. This makes them hard to delete, causing problems when running tests that creates a lot of these files.
>> 
>> Since all other JDK tools create binary files in read-write mode, AOT caches and CDS archives should do the same.
>
> src/hotspot/share/cds/filemap.cpp line 750:
> 
>> 748:   // allow processes that have it open continued access to the file.
>> 749:   remove(_full_path);
>> 750:   int fd = os::open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0666);
> 
> Why `0666`, though, i.e. world-writable? None of the tools, AFAICS from your examples, do world-writability. Should be at most `0664`?

Also matches what Linux does:


$ rm 1; touch 1; stat 1 | grep Access
Access: (0664/-rw-rw-r--)  Uid: ( 1000/   shade)   Gid: ( 1000/   shade)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25137#discussion_r2081487700


More information about the hotspot-runtime-dev mailing list