RFR: 8330174: Protection zone for easier detection of accidental zero-nKlass use [v5]

Thomas Stuefe stuefe at openjdk.org
Sat Feb 22 06:38:53 UTC 2025


On Fri, 14 Feb 2025 20:58:29 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> It might be easier if we introduce a new "core" region called "protection" that's 16MB in size, and allocate that before the rw region in the output buffer. We never map this region so it doesn't need to be stored in the archive file. 
>> 
>> Let me try this out and see if it works.
>
>> It might be easier if we introduce a new "core" region called "protection" that's 16MB in size, and allocate that before the rw region in the output buffer. We never map this region so it doesn't need to be stored in the archive file.
>> 
>> Let me try this out and see if it works.
> 
> Hi Thomas, please try this out:
> 
> https://github.com/openjdk/jdk/compare/master...iklam:jdk:8330174-protection-zone-ioi-contributions
> 
> It passes all CDS tests. You can see the gap:
> 
> 
> $ java -Xlog:cds -XX:ArchiveRelocationMode=0 --version | egrep '(Mapped)|(_rs)'
> [0.017s][info][cds] Reserved archive_space_rs [0x0000000800000000 - 0x0000000801000000] (16777216) bytes
> [0.017s][info][cds] Reserved class_space_rs   [0x0000000801000000 - 0x0000000841000000] (1073741824) bytes
> [0.017s][info][cds] Mapped static  region #0 at base 0x0000000800001000 top 0x0000000800557000 (ReadWrite)
> [0.017s][info][cds] Mapped static  region #1 at base 0x0000000800557000 top 0x0000000800dee000 (ReadOnly)
> [0.017s][info][cds] Mapped static  region #2 at base 0x000079ff9c021000 top 0x000079ff9c056000 (Bitmap)
> 
> 
> You'd need to add code to disable all RWX access in 0x800000000 ~ 0x800001000.

@iklam I incorporated your proposal; could you take another look?

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

PR Comment: https://git.openjdk.org/jdk/pull/23190#issuecomment-2676051797


More information about the hotspot-dev mailing list