RFR: 8350201: Out of bounds access on Linux aarch64 in os::print_register_info

Matthias Baesken mbaesken at openjdk.org
Mon Feb 17 15:21:21 UTC 2025


When running jtreg test VendorInfoPluginsTest we noticed the following issue (ubsanized binaries were used)


jdk/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp:369:46: runtime error: index 31 out of bounds for type 'long long unsigned int [31]'
    #0 0xffff84380470 in os::print_register_info(outputStream*, void const*, int&) (/jtreg_jdk_tier2_work/JTwork/scratch/10/images/vendorinfo.image/lib/server/libjvm.so+0x4d80470)
    #1 0xffff84bf566c in VMError::report(outputStream*, bool) (/jtreg_jdk_tier2_work/JTwork/scratch/10/images/vendorinfo.image/lib/server/libjvm.so+0x55f566c)
    #2 0xffff84bf812c in VMError::report_and_die(int, char const*, char const*, std::__va_list, Thread*, unsigned char*, void const*, void const*, char const*, int, unsigned long) (/jtreg_jdk_tier2_work/JTwork/scratch/10/images/vendorinfo.image/lib/server/libjvm.so+0x55f812c)
    #3 0xffff84bf90b4 in VMError::report_and_die(Thread*, unsigned int, unsigned char*, void const*, void const*, char const*, ...) (/jtreg_jdk_tier2_work/JTwork/scratch/10/images/vendorinfo.image/lib/server/libjvm.so+0x55f90b4)
    #4 0xffff84bf9138 in VMError::report_and_die(Thread*, unsigned int, unsigned char*, void const*, void const*) (/jtreg_jdk_tier2_work/JTwork/scratch/10/images/vendorinfo.image/lib/server/libjvm.so+0x55f9138)
    #5 0xffff8489ede8 in JVM_handle_linux_signal (/jtreg_jdk_tier2_work/JTwork/scratch/10/images/vendorinfo.image/lib/server/libjvm.so+0x529ede8)


Looks like we have registers 0 - 30 according to sys/ucontext.h on Linux aarch64


typedef struct
  {
    unsigned long long int __ctx(fault_address);
    unsigned long long int __ctx(regs)[31];
    ....
  } mcontext_t;


and according to the arm developer documentation

https://developer.arm.com/documentation/100069/0606/Overview-of-AArch64-state/Registers-in-AArch64-state#:~:text=In%20AArch64%20state%2C%20the%20following,are%20accessible%20as%20W0%2DW30.

"Thirty-one 64-bit general-purpose registers X0-X30, the bottom halves of which are accessible as W0-W30."

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

Commit messages:
 - JDK-8350201

Changes: https://git.openjdk.org/jdk/pull/23667/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23667&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8350201
  Stats: 3 lines in 3 files changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/23667.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23667/head:pull/23667

PR: https://git.openjdk.org/jdk/pull/23667


More information about the hotspot-runtime-dev mailing list