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

Improve error output and fix elf issues in os::dll_load

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 14
    • 13
    • hotspot
    • b04
    • generic
    • linux

      Currently in os_linux.cpp os::dll_load in case of loading errors of a lib the elf header is examined to get the reason of the error and produce a good error message.
      However currently the coding has 2 issues :
      - in case the endianness of the loaded lib and the host architecture do not match, the LE <-> BE conversion of e_machine is missing.
      - the error message could show the real elf architecture name in mismatch cases

      example when loading a x86_64 lib on linux s390x (big-endian platform) - the elf_head.e_machine value is currently read without conversion
      elf_head.e_machine: 15872
      elf_head.e_machine converted: 62 (this is the correct code from elf.h for x86_64/amd64 libs)

      Adjusted error message looks like this :
      example from renaissance db-shootout benchmark (runs on linuxs390x and attempts to load an x86_64 JNI lib "by mistake")
      message without the change :
       .... ELF file data encoding not big-endian (Possible cause: endianness mismatch)]

      with change :
       .... ELF file data encoding not big-endian (Possible cause: can't load AMD 64 .so on a IBM System/390 platform)

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

              Created:
              Updated:
              Resolved: