radareorg / radare2

UNIX-like reverse engineering framework and command-line toolset
https://www.radare.org/
GNU Lesser General Public License v3.0
20.69k stars 3.01k forks source link

Thread lock exception in my attempted core plugin #13181

Open bannsec opened 5 years ago

bannsec commented 5 years ago

Work environment

Questions Answers
OS/arch/bits (mandatory) Ubuntu x86 64
File format of the file you reverse (mandatory) ELF
Architecture/bits of the file (mandatory) x86/64
r2 -v full output, not truncated (mandatory) radare2 3.3.0 1 @ linux-x86-64 git.3.3.0 commit: f7e1d66bf835d72be695b786e7a52224fa56833e build: 2019-02-23__02:55:31

Expected behavior

proj = angr.Project('/bin/true') should hopefully be able to complete.

Actual behavior

Some thread exception seems to happen when run from the r2 shell line. However, if I #!python and do it from there it works fine.

Steps to reproduce the behavior

Example base:

import r2lang
import sys
import angr, claripy
from time import sleep

class R2Symbion(object):
    def _call(self, s):
        s = s.lower()

        # Not for us
        if not s.startswith('symb'):
            return

        print('doing it')
        p = angr.Project(r2.cmdj('ij')['core']['file'])

    def plugin(self, a):
        return {
            "name": "R2Symbion",
            "licence": "GPLv3",
            "desc": "Integration plugin for angr Symbion.",
            "call": self._call,
        }

r2symb = R2Symbion()
success = r2lang.plugin("core", r2symb.plugin)

This gives an exception:

Exception ignored in: <module 'threading' from '/usr/lib/python3.6/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 1289, in _shutdown
    assert tlock.locked()
SystemError: <built-in method locked of _thread.lock object at 0x7fa0a989bd78> returned a result with an error set

However, this works

Additional Logs, screenshots, source-code, configuration dump, ...

radare commented 4 years ago

can you please try again