usc-isi-bass / math_to_symbexpr_map_generation Goto Github PK
View Code? Open in Web Editor NEWWe generate mappings between random mathematical expressions their corresponding symbolic expressions.
License: MIT License
We generate mappings between random mathematical expressions their corresponding symbolic expressions.
License: MIT License
The AngrObjectFactory no longer supports the cc_from_arg_kinds
method.
A function with multiple paths will result in multiple dead ended states after symbolic execution.
Each of these will have its own return value.
At the moment, we combine these into a claripy.Or
operation (here) and take this as the symbolic return expression of the function.
In retrospect, I don't think this makes sense.
One possible alternative approach is that we create multiple ExtractedSymExpr
objects (one per return state) and return all of these for SymbolicExpressionExtractor.extract
.
However, since SymbolicExpressionExtractor.extract
is a pretty central part to the project, we may want to think what the best way forward is.
In order to perform symbolic execution on functions included from math.h
, we need to load these functions into the binary we are analyzing. One way to do this is to set auto_load_libs=True
in the Project
constructor of angr.
However, this appears to trigger a KeyError
exception when performing calling convention analysis.
I attached a minimal working example to reproduce the error:
files.zip
(runs about 3 minutes)
The stacktrace follows below:
Traceback (most recent call last):
File "analyze.py", line 8, in <module>
main()
File "analyze.py", line 5, in main
proj.analyses.CompleteCallingConventions(analyze_callsites=True)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/analysis.py", line 115, in __call__
oself.__init__(*args, **kwargs)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/complete_calling_conventions.py", line 22, in __init__
self._analyze()
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/complete_calling_conventions.py", line 52, in _analyze
analyze_callsites=self._analyze_callsites)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/analysis.py", line 115, in __call__
oself.__init__(*args, **kwargs)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/calling_convention.py", line 60, in __init__
self._analyze()
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/calling_convention.py", line 79, in _analyze
callsite_facts = self._analyze_callsites()
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/calling_convention.py", line 185, in _analyze_callsites
rda_model: Optional[ReachingDefinitionsModel] = self.kb.defs.get_model(caller.addr)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/knowledge_plugins/key_definitions/key_definition_manager.py", line 67, in get_model
observe_callback=observer.rda_observe_callback)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/analysis.py", line 115, in __call__
oself.__init__(*args, **kwargs)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/reaching_definitions/reaching_definitions.py", line 138, in __init__
self._analyze()
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/forward_analysis/forward_analysis.py", line 221, in _analyze
self._analysis_core_graph()
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/forward_analysis/forward_analysis.py", line 240, in _analysis_core_graph
changed, output_state = self._run_on_node(n, job_state)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/reaching_definitions/reaching_definitions.py", line 339, in _run_on_node
dep_graph=self._dep_graph,
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/reaching_definitions/engine_vex.py", line 56, in process
block=kwargs.pop('block', None),
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/engines/light/engine.py", line 87, in _process
self._process_Stmt(whitelist=whitelist)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/engines/light/engine.py", line 108, in _process_Stmt
self._handle_Stmt(stmt)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/reaching_definitions/engine_vex.py", line 96, in _handle_Stmt
super(SimEngineRDVEX, self)._handle_Stmt(stmt)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/engines/light/engine.py", line 136, in _handle_Stmt
getattr(self, handler)(stmt)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/reaching_definitions/engine_vex.py", line 102, in _handle_WrTmp
super()._handle_WrTmp(stmt)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/engines/light/engine.py", line 142, in _handle_WrTmp
data = self._expr(stmt.data)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/reaching_definitions/engine_vex.py", line 257, in _expr
data = super()._expr(expr)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/engines/light/engine.py", line 174, in _expr
return getattr(self, handler)(expr)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/engines/light/engine.py", line 228, in _handle_Unop
return getattr(self, handler)(expr)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/reaching_definitions/engine_vex.py", line 382, in _handle_Conversion
arg_0 = self._expr(expr.args[0])
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/reaching_definitions/engine_vex.py", line 257, in _expr
data = super()._expr(expr)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/engines/light/engine.py", line 174, in _expr
return getattr(self, handler)(expr)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/reaching_definitions/engine_vex.py", line 266, in _handle_RdTmp
self.state.add_use(Tmp(tmp, expr.result_size(self.tyenv) // self.arch.byte_width), self._codeloc())
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/reaching_definitions/rd_state.py", line 291, in add_use
self.codeloc_uses.update(self.get_definitions(atom))
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/analyses/reaching_definitions/rd_state.py", line 302, in get_definitions
return self.live_definitions.get_definitions(atom)
File "/home/user/.virtualenvs/angr/lib/python3.6/site-packages/angr/knowledge_plugins/key_definitions/live_definitions.py", line 201, in get_definitions
return self.tmp_definitions[atom.tmp_idx]
KeyError: 10
Some operators/functions are type-specified.
For example, the mod operator (%) takes only integer.
So x % fabs(y)
will fail to be compiled. As demo in test_c_code_generation.test_generate_code_mod_func
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.