Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8350201

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 25
    • 25
    • hotspot
    • b11
    • aarch64
    • linux

      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.

            mbaesken Matthias Baesken
            mbaesken Matthias Baesken
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: