Skip to content

Failure to inspect ELF binaries #1121

Description

@pombredanne

When scanning https://repo1.maven.org/maven2/com/sun/jna/jna/3.0.9/jna-3.0.9.jar
with scan_single_package, followed by inspect_elf_binaries inspect_elf_binaries fails with trace pasted below

We have two issues here:

In ScanCode.io:

Unsupported relocation type: 22

Traceback:
  File "/opt/scancodeio/scanpipe/pipelines/__init__.py", line 191, in execute
    step(self)
  File "/opt/scancodeio/scanpipe/pipelines/inspect_elf_binaries.py", line 46, in collect_dwarf_source_path_references
    dwarf_paths = get_dwarf_paths(Path(self.project.codebase_path / elf.path))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/scancodeio/venv/lib/python3.11/site-packages/elf_inspector/dwarf.py", line 41, in get_dwarf_paths
    for ptype, path in get_dwarf_cu_and_die_paths(location):
  File "/opt/scancodeio/venv/lib/python3.11/site-packages/elf_inspector/dwarf.py", line 74, in get_dwarf_cu_and_die_paths
    dwarfinfo = elffile.get_dwarf_info()
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/scancodeio/venv/lib/python3.11/site-packages/elftools/elf/elffile.py", line 275, in get_dwarf_info
    dwarf_section = self._read_dwarf_section(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/scancodeio/venv/lib/python3.11/site-packages/elftools/elf/elffile.py", line 801, in _read_dwarf_section
    reloc_handler.apply_section_relocations(
  File "/opt/scancodeio/venv/lib/python3.11/site-packages/elftools/elf/relocation.py", line 238, in apply_section_relocations
    self._do_apply_relocation(stream, reloc, symtab)
  File "/opt/scancodeio/venv/lib/python3.11/site-packages/elftools/elf/relocation.py", line 293, in _do_apply_relocation
    raise ELFRelocationError(

In bare ScanCode toolkit:

pip install scancode-toolkit elf-inspector
scancode --dwarf --yaml - --verbose com/sun/jna/ 

I get this:

Scanning done.
Some files failed to scan properly:
Path: jna/sunos-sparcv9/libjnidispatch.so
  ERROR: for scanner: dwarf-inspector:
  ERROR: Unknown error:
  Traceback (most recent call last):
    File "/tmp/foo/tmp/jna-3.0.9/venv/lib/python3.10/site-packages/scancode/interrupt.py", line 91, in interruptible
      return NO_ERROR, func(*(args or ()), **(kwargs or {}))
    File "/tmp/foo/tmp/jna-3.0.9/venv/lib/python3.10/site-packages/elf_inspector/plugin_dwarf.py", line 54, in get_dwarfs
      return dict(dwarf_source_paths=get_dwarf_paths(location))
    File "/tmp/foo/tmp/jna-3.0.9/venv/lib/python3.10/site-packages/elf_inspector/dwarf.py", line 41, in get_dwarf_paths
      for ptype, path in get_dwarf_cu_and_die_paths(location):
    File "/tmp/foo/tmp/jna-3.0.9/venv/lib/python3.10/site-packages/elf_inspector/dwarf.py", line 74, in get_dwarf_cu_and_die_paths
      dwarfinfo = elffile.get_dwarf_info()
    File "/tmp/foo/tmp/jna-3.0.9/venv/lib/python3.10/site-packages/elftools/elf/elffile.py", line 275, in get_dwarf_info
      dwarf_section = self._read_dwarf_section(
    File "/tmp/foo/tmp/jna-3.0.9/venv/lib/python3.10/site-packages/elftools/elf/elffile.py", line 801, in _read_dwarf_section
      reloc_handler.apply_section_relocations(
    File "/tmp/foo/tmp/jna-3.0.9/venv/lib/python3.10/site-packages/elftools/elf/relocation.py", line 238, in apply_section_relocations
      self._do_apply_relocation(stream, reloc, symtab)
    File "/tmp/foo/tmp/jna-3.0.9/venv/lib/python3.10/site-packages/elftools/elf/relocation.py", line 293, in _do_apply_relocation
      raise ELFRelocationError(
  elftools.common.exceptions.ELFRelocationError: Unsupported relocation type: 22

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions