On Tue, 27 Oct 2026 22:22:11 GMT, Ashay Rane <[email protected]> wrote:

> This patch enables PAC and AUT instructions for pointer signing and
> authentication in JIT code on Windows/ARM64 when "UseBranchProtection"
> flag is set and when the processor supports the feature.
> 
> Specifically, JVM detects hardware support by reading ID_AA64ISAR1_EL1
> and ID_AA64ISAR2_EL1 registers via CP4031 and CP4032 keys in the Windows
> registry.  Then, if the "UseBranchProtection" flag is set, then HotSpot
> emits the signing and authenticating instructions.  Windows uses
> AArch64's "B" key, so this patch selects between "paciaz" and "pacibz"
> instructions (and similarly, between "autiaz" and "autibz" instructions)
> depending on whether HotSpot is being compiled for Linux versus Windows.
> Both the MacroAssembler and the Windows' PAC helpers need to stay in
> sync, so this patch needs changes to both macroAssembler_aarch64.cpp as
> well as pauth_windows_aarch64.inline.hpp.
> 
> Since Linux supports both "A" as well as "B" keys, it's possible to use
> "B" keys for both Linux and Windows, although I fear doing so may
> introduce more churn in the code.
> 
> This patch also introduces a cross-platform (Linux and Windows) test
> that compiles and runs a method under both C1 and C2 before checking
> whether the generated instructions include the "paci[ab]z" and the
> "auti[ab]z" instructions.
> 
> Since CI doesn't test with branch protection enabled, I manually changed
> the default value of "UseBranchProtection" in globals_aarch64.cpp to be
> "pac-ret" before running tier 1 through tier 3 tests in the HotSpot,
> JDK, and LangTools test groups to ensure that this patch does not
> introduce any new failures.  I also validated this patch by running the
> same tests with the default value for "UseBranchProtection".
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

src/hotspot/os_cpu/windows_aarch64/vm_version_windows_aarch64.cpp line 108:

> 106:   // - ISAR1's API field (bits 8 through 11): custom algorithm support
> 107:   // - ISAR2's APA3 field (bits 12 through 15): QARM3 algorithm support
> 108:   // See feature descriptions of the ARM v8 architecture for details.

Please reference chapter and verse.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33595#discussion_r4399842858

Reply via email to