You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the problem? (Here is where you provide a complete Traceback.) ComplexBlock.get_mode() has an unintuitive side-effect, namely, that it unpacks the complex block:
...
await self.resource.unpack()
bb_modes = {bb.mode for bb in await self.get_basic_blocks()}
This can have a cascading effect of things being unpacked (or attempted to be unpacked). For example, if you run resource.auto_run(all_analyzers=True) on a ComplexBlock, the ComplexBlockSymbolAnalyzer will run, which tries to get the mode, causing the ComplexBlock to be unpacked.
It is generally desirable to have workflows that do not rely on a ComplexBlock always being unpacked into basic blocks. For example, PatchFromSourceModifier only needs to know the mode and size of the complex block; forcing this modifier to unpack all complex blocks is prohibitively expensive.
Please provide some information about your environment.
Any OFRAK environment.
If you've discovered it, what is the root cause of the problem?
See above.
How often does the issue happen?
What are the steps to reproduce the issue?
With logging.INFO, run complex_block.resource.auto_run(all_analyzers=True) on any complex block to see this:
We tell OFRAK to only run Analyzers -- because of ComplexBlock.get_mode side effects, we end up running 5 components, only 2 of which are analyzers:
ComplexBlockSymbolAnalyzer
DecompilationAnalyzer
DecompilationAnalysisIdentifier
LinkableSymbolIdentifier
ComplexBlockUnpacker
How would you implement this fix?
ComplexBlock.get_mode() currently unpacks, then checks every BasicBlock for the mode (and raises an error if they do not match). It seems that a simpler implementation of ComplexBlock.get_mode() could simply be one where CodeRegionUnpacker populates the mode of the entrypoint as it gets the ComplexBlock's size. This would likely work for most use cases when the mode of the complex block is needed.
More generally, it is worth reflecting on what, if any, side effects ResourceView methods can/should have.
Are there any (reasonable) alternative approaches?
Probably.
Are you interested in implementing it yourself?
Perhaps.
The text was updated successfully, but these errors were encountered:
What is the problem? (Here is where you provide a complete Traceback.)
ComplexBlock.get_mode()
has an unintuitive side-effect, namely, that it unpacks the complex block:This can have a cascading effect of things being unpacked (or attempted to be unpacked). For example, if you run
resource.auto_run(all_analyzers=True)
on aComplexBlock
, the ComplexBlockSymbolAnalyzer will run, which tries to get the mode, causing theComplexBlock
to be unpacked.It is generally desirable to have workflows that do not rely on a
ComplexBlock
always being unpacked into basic blocks. For example,PatchFromSourceModifier
only needs to know the mode and size of the complex block; forcing this modifier to unpack all complex blocks is prohibitively expensive.Please provide some information about your environment.
Any OFRAK environment.
If you've discovered it, what is the root cause of the problem?
See above.
How often does the issue happen?
What are the steps to reproduce the issue?
With
logging.INFO
, runcomplex_block.resource.auto_run(all_analyzers=True)
on any complex block to see this:We tell OFRAK to only run Analyzers -- because of
ComplexBlock.get_mode
side effects, we end up running 5 components, only 2 of which are analyzers:ComplexBlockSymbolAnalyzer
DecompilationAnalyzer
DecompilationAnalysisIdentifier
LinkableSymbolIdentifier
ComplexBlockUnpacker
How would you implement this fix?
ComplexBlock.get_mode()
currently unpacks, then checks everyBasicBlock
for the mode (and raises an error if they do not match). It seems that a simpler implementation ofComplexBlock.get_mode()
could simply be one whereCodeRegionUnpacker
populates the mode of the entrypoint as it gets the ComplexBlock's size. This would likely work for most use cases when the mode of the complex block is needed.More generally, it is worth reflecting on what, if any, side effects
ResourceView
methods can/should have.Are there any (reasonable) alternative approaches?
Probably.
Are you interested in implementing it yourself?
Perhaps.
The text was updated successfully, but these errors were encountered: