On Thu, 25 Jun 2026 01:41:27 GMT, Yasumasa Suenaga <[email protected]> wrote:
> TestJhsdbJstackMixedWithXComp.java fails on Ubuntu 26.04 on Neoverse V1 and > V2 processor. > > I introduced DWARF support in mixed jstack in > [JDK-8377946](https://bugs.openjdk.org/browse/JDK-8377946), however I > mentioned it does not support PAC (Pointer Authentication Code) in PR #29731. > It is the reason why TestJhsdbJstackMixedWithXComp.java failed on Neoverse V1 > and V2. They support PAC, and it is enabled on the Kernel on Ubuntu 26.04 by > default. > > This PR adds to feature to treat PAC in Linux AArch64. It is Arm-specific > feature, so I separated them in following new classes. It is one of the > reason why this change is bigger. > > - AARCH64DwarfParser.java > - LinuxAARCH64DebuggerLocal.java > - aarch64Dwarf.cpp/hpp (for `DwarfParser` in native) > > serviceability/sa tests passed on Linux AMD64, Linux AArch64 (PAC disabled), > and Linux AArch64 (PAC enabled). > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). src/hotspot/cpu/aarch64/vm_version_aarch64.cpp line 553: > 551: _pac_mask = (uintptr_t)pauth_strip_pointer((address)~(UINT64_C(1) << > 55)); > 552: } > 553: Did this code have to be moved? It looks like the change here is making sure _pac_mask gets set even if the setting of UseBranchProtection indicates that PAC will not be used. Is this change needed because runtime flags are in conflict with what is in the dwarf file. In other words, dwarf says PAC is supported, but hotspot has decided not to enable it? However, this means you are masking addresses that are not PAC signed. Are. you sure this is always ok? What if you mask off bits of the actual unsigned address. It's not clear to my why SA would need _pac_mask set if PAC was disabled at runtime. BTW, where is supports_paca() defined. I'm unable to find it in the source or with a web search. src/jdk.hotspot.agent/linux/native/libsaproc/aarch64Dwarf.cpp line 37: > 35: _sign_state = RA_NOT_SIGNED; > 36: } else { > 37: print_debug("DWARF: DW_CFA_AARCH64_negate_ra_state: illegal state > (%d)\n", _sign_state); I think print_error() would be better here, unless you feel this is something that normally happens. Same below. src/jdk.hotspot.agent/linux/native/libsaproc/aarch64Dwarf.cpp line 67: > 65: void AARCH64DwarfParser::restore_arch_specific_state() { > 66: if (remember_state.empty()) { > 67: print_debug("DWARF Error: DW_CFA_restore_state for AArch64 is > empty.\n"); Use print_error src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.cpp line 231: > 229: default: > 230: if (!process_arch_specific_dwarf_instructions(op)) { > 231: print_debug("DWARF: Unknown opcode: 0x%x\n", op); print_error src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java line 326: > 324: if ((debugger instanceof LinuxAARCH64DebuggerLocal d) && > d.isPACEnabled()) { > 325: > ((MachineDescriptionAArch64)d.getMachineDescription()).enablePAC(); > 326: } Is there a better place for this? Maybe closer to the creation of the MachienDescriptorAArch54? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31669#discussion_r3484361940 PR Review Comment: https://git.openjdk.org/jdk/pull/31669#discussion_r3484238915 PR Review Comment: https://git.openjdk.org/jdk/pull/31669#discussion_r3484263086 PR Review Comment: https://git.openjdk.org/jdk/pull/31669#discussion_r3484267898 PR Review Comment: https://git.openjdk.org/jdk/pull/31669#discussion_r3484369520
