Skip to content

AttributeError: graph #4

@chunlin007

Description

@chunlin007

To use libmatch in my local enviroment (ubuntu-22.04). I got an error when I try to execute:
./utils/unblob -U --scoring -L ./objects/arm-none-eabi.lmdb -Y ./bins/Nucleo_i2c_master.elf ./bins/Nucleo_i2c_master_addrs.yml. Full error info. are as follow:

      Traceback (most recent call last):
    File "/libmatch/bdsig/lmdb.py", line 103, in match
      self.lm = LibMatch(lmd, self)
    File "/libmatch/bdsig/libmatch.py", line 22, in __init__
      self._compute()
    File "/libmatch/bdsig/libmatch.py", line 410, in _compute
      self._compute_second_order_matches(lib)
    File "/libmatch/bdsig/libmatch.py", line 98, in _compute_second_order_matches
      fd = self._second_order_heuristic(self.binary_lmd, lmd, maddr, faddr)
    File "/libmatch/bdsig/libmatch.py", line 75, in _second_order_heuristic
      return FunctionDiff(binary_lmd, lib_lmd, bin_func, lib_func)
    File "/libmatch/bdsig/functiondiff.py", line 256, in __init__
      self.attributes_b = self._compute_block_attributes(self.function_b)
    File "/libmatch/bdsig/functiondiff.py", line 455, in _compute_block_attributes
      distances_from_start = FunctionDiff._distances_from_function_start(function)
    File "/libmatch/bdsig/functiondiff.py", line 479, in _distances_from_function_start
      return networkx.single_source_shortest_path_length(function.graph,
    File "/libmatch/bdsig/lmd.py", line 156, in __getattr__
      raise AttributeError(a)
  AttributeError: graph
  Traceback (most recent call last):
    File "/libmatch/./utils/unblob", line 175, in <module>
      do_normal(opts)
    File "/libmatch/./utils/unblob", line 144, in do_normal
      symbol_map = lmdb.match(lmd, score=opts.scoring)
    File "/libmatch/bdsig/lmdb.py", line 103, in match
      self.lm = LibMatch(lmd, self)
    File "/libmatch/bdsig/libmatch.py", line 22, in __init__
      self._compute()
    File "/libmatch/bdsig/libmatch.py", line 410, in _compute
      self._compute_second_order_matches(lib)
    File "/libmatch/bdsig/libmatch.py", line 98, in _compute_second_order_matches
      fd = self._second_order_heuristic(self.binary_lmd, lmd, maddr, faddr)
    File "/libmatch/bdsig/libmatch.py", line 75, in _second_order_heuristic
      return FunctionDiff(binary_lmd, lib_lmd, bin_func, lib_func)
    File "/libmatch/bdsig/functiondiff.py", line 256, in __init__
      self.attributes_b = self._compute_block_attributes(self.function_b)
    File "/libmatch/bdsig/functiondiff.py", line 455, in _compute_block_attributes
      distances_from_start = FunctionDiff._distances_from_function_start(function)
    File "/libmatch/bdsig/functiondiff.py", line 479, in _distances_from_function_start
      return networkx.single_source_shortest_path_length(function.graph,
    File "/libmatch/bdsig/lmd.py", line 156, in __getattr__
      raise AttributeError(a)
  AttributeError: graph

I found that in my pc, I can create arm-none-eabi.lmdb by executing:
./utils/unblob -B ./objects/arm-none-eabi ./objects/arm-none-eabi.lmdb
However, when we execute ./utils/unblob -U --scoring -L ./objects/arm-none-eabi.lmdb -Y ./bins/Nucleo_i2c_master.elf ./bins/Nucleo_i2c_master_addrs.yml unblob can load arm-none-eabi.lmdb with pickle.load, but without graph element in lmdb.lib_lmds[addr].normalization_functions.

How to solve this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions