panda-re / panda

Platform for Architecture-Neutral Dynamic Analysis
https://panda.re
Other
2.45k stars 475 forks source link

Missing protobuf dependency in container #1482

Closed AndrewFasano closed 4 months ago

AndrewFasano commented 4 months ago

1467 dropped the python3-protobuf package from PANDA's runtime dependencies, but PANDA depends on it.

After that change this dlopen call fails to load libpanda-[arch].so because libprotobuf.so is missing: https://github.com/panda-re/panda/blob/86e4ed127538b5be98623bd13787b609c24d59ca/panda/python/core/pandare/panda.py#L174

docker run --rm -it pandare/panda:latest
...
Digest: sha256:bcc2854513090455f61dd05954a02e56bd3c595bebd16cacd98cd27d74814028
Status: Downloaded newer image for pandare/panda:latest
root@a96da541b8b2:/# 
root@a96da541b8b2:/# ldd /usr/local/bin/libpanda-arm.so  | grep 'not'
        libprotobuf.so.17 => not found
coolkingcole commented 4 months ago

An example of trying to run a default run.py

# python run.py 
Traceback (most recent call last):
  File "run.py", line 100, in <module>
    panda = Panda(config['arch'], mem=mem, extra_args=args, qcow=image)
  File "/usr/local/lib/python3.8/dist-packages/pandare/panda.py", line 174, in __init__
    self.libpanda = self.ffi.dlopen(self.libpanda_path)
OSError: cannot load library '/usr/local/bin/libpanda-arm.so': libprotobuf.so.17: cannot open shared object file: No such file or directory

Not sure if related, but if protobuf is installed from apt I got this error repeating

Exception ignored from cffi callback <function Panda._generated_callback.<locals>.decorator.<locals>._run_and_catch at 0x7ffff5c52d30>, trying to convert the result back to C:
TypeError: an integer is required
Exception ignored from cffi callback <function Panda._generated_callback.<locals>.decorator.<locals>._run_and_catch at 0x7ffff5c52d30>, trying to convert the result back to C:
TypeError: an integer is required
Exception ignored from cffi callback <function Panda._generated_callback.<locals>.decorator.<locals>._run_and_catch at 0x7ffff5c52d30>, trying to convert the result back to C:
...
AndrewFasano commented 4 months ago

Fixed in 1980d43899a817b8bb523fcfa795892683847817 (accidentally pushed straight to dev so no PR)