Ledger-Donjon / rainbow

Makes Unicorn traces. Generic Side-Channel and Fault Injection simulator
GNU Lesser General Public License v3.0
172 stars 34 forks source link

Rainbow tests segmentation fault with Unicorn 2 stable #39

Closed aiooss-ledger closed 9 months ago

aiooss-ledger commented 2 years ago

How to reproduce:

===================================================================================== test session starts =====================================================================================
platform linux -- Python 3.8.10, pytest-7.1.2, pluggy-1.0.0
rootdir: /path/to/rainbow
collected 74 items                                                                                                                                                                            

tests/test_devices.py .Fatal Python error: Segmentation fault

Current thread 0x00007f283c7ad740 (most recent call first):
  File "/path/to/venv/lib/python3.8/site-packages/unicorn/unicorn.py", line 934 in mem_regions
  File "/path/to/rainbow/rainbow/rainbow.py", line 95 in __del__
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 752 in create_module
  File "<frozen importlib._bootstrap>", line 556 in module_from_spec
  File "<frozen importlib._bootstrap>", line 657 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "/usr/lib/python3.8/pickle.py", line 43 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 848 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "/path/to/rainbow/rainbow/rainbow.py", line 456 in load_other_regs_from_pickle
  File "/path/to/rainbow/rainbow/devices/stm32.py", line 81 in setup_step
  File "/path/to/rainbow/rainbow/devices/stm32.py", line 75 in __init__
  File "/path/to/rainbow/tests/test_devices.py", line 19 in test_init_del
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/python.py", line 192 in pytest_pyfunc_call
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/python.py", line 1761 in runtest
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/runner.py", line 166 in pytest_runtest_call
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/runner.py", line 259 in <lambda>
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/runner.py", line 338 in from_call
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/runner.py", line 258 in call_runtest_hook
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/runner.py", line 219 in call_and_report
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/runner.py", line 130 in runtestprotocol
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/runner.py", line 111 in pytest_runtest_protocol
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/main.py", line 347 in pytest_runtestloop
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/main.py", line 322 in _main
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/main.py", line 268 in wrap_session
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/main.py", line 315 in pytest_cmdline_main
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/path/to/venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 164 in main
  File "/path/to/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 187 in console_main
  File "/path/to/venv/bin/pytest", line 8 in <module>
[1]    5561 segmentation fault (core dumped)  pytest
aiooss-ledger commented 2 years ago

Work:

aiooss-ledger commented 2 years ago

Segfault in test_devices.py seems to be caused by https://github.com/unicorn-engine/unicorn/issues/1641

aiooss-ledger commented 2 years ago

test_fault_models.py fail is due to https://github.com/unicorn-engine/unicorn/issues/1650

erdnaxe commented 12 months ago

Seem to be fixed by https://github.com/Ledger-Donjon/rainbow/pull/45, can be closed