-
Notifications
You must be signed in to change notification settings - Fork 272
Open
Description
Version and Platform (required):
- Binary Ninja Version: 5.3.8844-dev Ultimate, 29d8484
- OS: macos
- OS Version: 26.2.0
- CPU Architecture: arm64
Bug Description:
If you open more than one file simultaneously from a project and are using a custom workflow plugin, even if you scope the logs to the session id retrieved from the binary view, the logs end up in the wrong session.
Steps To Reproduce:
- Paste the workflow plugin below into a python file.
- Set this workflow in a project.
- Open two or more raw files. I suggest four or maybe five because this bug is non-deterministic. The logs may just all land in the right place, but the more files you open simultaneously, the higher the probability that you will be able to observe the bug on the first try.
- Look at the logs in all the files. You will see some where two or more sets of logs from another session are marked with the file you're looking at's session id, and if you look at other files, their logs for this workflow plugin are not there.
Expected Behavior:
Scoped logs landing in correct places.
Screenshots:
Here is one file where there are two separate logs coming from this workflow plugin. Note that the session ID appears correct according to other activity from other analysis components, it's just assigning that session ID to logs from another binaryview session (or something like that).
Here are the logs for the file that one of the two in the above screenshot belongs to:
Additional Information:
import json
from binaryninja.log import Logger
from binaryninja.workflow import Workflow, Activity
log = Logger(0, 'reprobug')
def do_action(ctx):
bv = ctx.view
log.session_id = bv.file.session_id
tagged = 0
for f in bv.functions:
f.add_tag('Needs Analysis', 'BUGBUG')
log.log_debug(f'Tagged fuction at: {f.start}')
tagged += 1
log.log_info(f'Tagged functions: {tagged}')
wf = Workflow('core.module.metaAnalysis').clone('plugin.module.ReproBug')
activity_name = 'analysis.reprobug'
wf.register_activity(Activity(
configuration=json.dumps({
'name': 'analysis.reprobug',
'title': 'Repro Bug',
'description': 'Repro Bug.',
'eligibility': {
'runOnce': True
},
'dependencies': {
'downstream': ['core.module.update']
}
}),
action=do_action
))
wf.insert('core.module.finishUpdate', ['analysis.reprobug'])
wf.register()Metadata
Metadata
Assignees
Labels
No labels