angr 9.2.131__py3-none-manylinux2014_aarch64.whl → 9.2.133__py3-none-manylinux2014_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of angr might be problematic. Click here for more details.
- angr/__init__.py +128 -128
- angr/analyses/__init__.py +38 -38
- angr/analyses/analysis.py +6 -2
- angr/analyses/backward_slice.py +3 -4
- angr/analyses/binary_optimizer.py +5 -12
- angr/analyses/bindiff.py +3 -6
- angr/analyses/calling_convention.py +3 -4
- angr/analyses/cfg/__init__.py +3 -3
- angr/analyses/cfg/cfg_base.py +1 -1
- angr/analyses/cfg/cfg_emulated.py +5 -5
- angr/analyses/cfg/cfg_fast.py +19 -17
- angr/analyses/cfg/indirect_jump_resolvers/__init__.py +5 -5
- angr/analyses/cfg/indirect_jump_resolvers/amd64_elf_got.py +1 -1
- angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +148 -101
- angr/analyses/cfg/indirect_jump_resolvers/x86_elf_pic_plt.py +1 -1
- angr/analyses/data_dep/__init__.py +4 -4
- angr/analyses/datagraph_meta.py +1 -1
- angr/analyses/ddg.py +16 -17
- angr/analyses/decompiler/__init__.py +12 -12
- angr/analyses/decompiler/ail_simplifier.py +24 -12
- angr/analyses/decompiler/block_similarity.py +2 -4
- angr/analyses/decompiler/block_simplifier.py +10 -21
- angr/analyses/decompiler/callsite_maker.py +1 -1
- angr/analyses/decompiler/ccall_rewriters/rewriter_base.py +1 -1
- angr/analyses/decompiler/clinic.py +122 -41
- angr/analyses/decompiler/condition_processor.py +57 -39
- angr/analyses/decompiler/counters/__init__.py +3 -3
- angr/analyses/decompiler/decompilation_cache.py +7 -7
- angr/analyses/decompiler/dephication/__init__.py +1 -1
- angr/analyses/decompiler/dephication/graph_rewriting.py +1 -1
- angr/analyses/decompiler/dephication/graph_vvar_mapping.py +11 -3
- angr/analyses/decompiler/dephication/rewriting_engine.py +169 -45
- angr/analyses/decompiler/dephication/seqnode_dephication.py +5 -4
- angr/analyses/decompiler/expression_narrower.py +1 -1
- angr/analyses/decompiler/graph_region.py +8 -8
- angr/analyses/decompiler/optimization_passes/__init__.py +20 -20
- angr/analyses/decompiler/optimization_passes/const_derefs.py +1 -0
- angr/analyses/decompiler/optimization_passes/deadblock_remover.py +1 -2
- angr/analyses/decompiler/optimization_passes/div_simplifier.py +41 -16
- angr/analyses/decompiler/optimization_passes/duplication_reverter/duplication_reverter.py +8 -7
- angr/analyses/decompiler/optimization_passes/duplication_reverter/utils.py +1 -3
- angr/analyses/decompiler/optimization_passes/engine_base.py +262 -84
- angr/analyses/decompiler/optimization_passes/inlined_string_transformation_simplifier.py +175 -39
- angr/analyses/decompiler/optimization_passes/ite_region_converter.py +2 -5
- angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py +5 -5
- angr/analyses/decompiler/optimization_passes/mod_simplifier.py +12 -3
- angr/analyses/decompiler/optimization_passes/optimization_pass.py +42 -19
- angr/analyses/decompiler/optimization_passes/stack_canary_simplifier.py +9 -5
- angr/analyses/decompiler/peephole_optimizations/__init__.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/base.py +6 -6
- angr/analyses/decompiler/peephole_optimizations/remove_noop_conversions.py +2 -0
- angr/analyses/decompiler/peephole_optimizations/rewrite_bit_extractions.py +1 -1
- angr/analyses/decompiler/presets/__init__.py +1 -1
- angr/analyses/decompiler/region_simplifiers/expr_folding.py +3 -3
- angr/analyses/decompiler/region_simplifiers/switch_cluster_simplifier.py +8 -12
- angr/analyses/decompiler/ssailification/rewriting.py +1 -2
- angr/analyses/decompiler/ssailification/rewriting_engine.py +139 -56
- angr/analyses/decompiler/ssailification/ssailification.py +2 -1
- angr/analyses/decompiler/ssailification/traversal.py +4 -6
- angr/analyses/decompiler/ssailification/traversal_engine.py +125 -42
- angr/analyses/decompiler/structured_codegen/__init__.py +5 -5
- angr/analyses/decompiler/structured_codegen/base.py +3 -3
- angr/analyses/decompiler/structured_codegen/c.py +39 -40
- angr/analyses/decompiler/structuring/__init__.py +3 -3
- angr/analyses/decompiler/structuring/phoenix.py +45 -29
- angr/analyses/decompiler/structuring/structurer_base.py +2 -2
- angr/analyses/decompiler/structuring/structurer_nodes.py +23 -14
- angr/analyses/deobfuscator/__init__.py +3 -3
- angr/analyses/deobfuscator/irsb_reg_collector.py +29 -60
- angr/analyses/deobfuscator/string_obf_finder.py +2 -2
- angr/analyses/deobfuscator/string_obf_opt_passes.py +1 -1
- angr/analyses/disassembly.py +4 -4
- angr/analyses/forward_analysis/__init__.py +1 -1
- angr/analyses/forward_analysis/visitors/graph.py +6 -6
- angr/analyses/init_finder.py +47 -22
- angr/analyses/loop_analysis.py +1 -1
- angr/analyses/loopfinder.py +1 -1
- angr/analyses/propagator/engine_base.py +21 -14
- angr/analyses/propagator/engine_vex.py +149 -179
- angr/analyses/propagator/outdated_definition_walker.py +12 -6
- angr/analyses/propagator/propagator.py +10 -28
- angr/analyses/propagator/top_checker_mixin.py +211 -5
- angr/analyses/propagator/vex_vars.py +4 -4
- angr/analyses/reaching_definitions/__init__.py +9 -9
- angr/analyses/reaching_definitions/call_trace.py +2 -2
- angr/analyses/reaching_definitions/dep_graph.py +1 -1
- angr/analyses/reaching_definitions/engine_ail.py +304 -329
- angr/analyses/reaching_definitions/engine_vex.py +243 -229
- angr/analyses/reaching_definitions/function_handler.py +3 -3
- angr/analyses/reaching_definitions/function_handler_library/__init__.py +1 -1
- angr/analyses/reaching_definitions/rd_state.py +47 -42
- angr/analyses/reassembler.py +26 -31
- angr/analyses/s_liveness.py +8 -0
- angr/analyses/s_propagator.py +18 -3
- angr/analyses/s_reaching_definitions/s_rda_view.py +2 -5
- angr/analyses/s_reaching_definitions/s_reaching_definitions.py +9 -5
- angr/analyses/stack_pointer_tracker.py +4 -4
- angr/analyses/typehoon/simple_solver.py +14 -14
- angr/analyses/typehoon/translator.py +10 -2
- angr/analyses/typehoon/typeconsts.py +11 -3
- angr/analyses/typehoon/typevars.py +26 -26
- angr/analyses/unpacker/__init__.py +1 -1
- angr/analyses/variable_recovery/engine_ail.py +299 -259
- angr/analyses/variable_recovery/engine_base.py +138 -121
- angr/analyses/variable_recovery/engine_vex.py +175 -185
- angr/analyses/variable_recovery/irsb_scanner.py +49 -38
- angr/analyses/variable_recovery/variable_recovery.py +28 -5
- angr/analyses/variable_recovery/variable_recovery_base.py +33 -34
- angr/analyses/variable_recovery/variable_recovery_fast.py +4 -8
- angr/analyses/veritesting.py +2 -2
- angr/analyses/vfg.py +5 -5
- angr/analyses/xrefs.py +46 -19
- angr/angrdb/serializers/__init__.py +1 -1
- angr/annocfg.py +20 -15
- angr/blade.py +2 -2
- angr/block.py +20 -25
- angr/calling_conventions.py +12 -14
- angr/code_location.py +6 -10
- angr/codenode.py +3 -3
- angr/engines/__init__.py +12 -14
- angr/engines/engine.py +24 -61
- angr/engines/light/__init__.py +13 -5
- angr/engines/light/data.py +1 -1
- angr/engines/light/engine.py +1003 -1185
- angr/engines/pcode/__init__.py +1 -1
- angr/engines/pcode/behavior.py +1 -1
- angr/engines/pcode/cc.py +2 -0
- angr/engines/pcode/lifter.py +13 -15
- angr/engines/soot/expressions/__init__.py +12 -12
- angr/engines/soot/statements/__init__.py +6 -6
- angr/engines/soot/values/__init__.py +6 -6
- angr/engines/soot/values/arrayref.py +2 -2
- angr/engines/soot/values/constants.py +1 -1
- angr/engines/soot/values/instancefieldref.py +1 -1
- angr/engines/soot/values/paramref.py +1 -1
- angr/engines/soot/values/staticfieldref.py +1 -1
- angr/engines/successors.py +15 -14
- angr/engines/vex/__init__.py +5 -5
- angr/engines/vex/claripy/ccall.py +2 -2
- angr/engines/vex/claripy/datalayer.py +1 -1
- angr/engines/vex/claripy/irop.py +19 -19
- angr/engines/vex/heavy/__init__.py +2 -2
- angr/engines/vex/heavy/actions.py +1 -3
- angr/engines/vex/heavy/heavy.py +4 -6
- angr/engines/vex/lifter.py +2 -4
- angr/engines/vex/light/light.py +0 -2
- angr/engines/vex/light/slicing.py +5 -5
- angr/exploration_techniques/__init__.py +19 -142
- angr/exploration_techniques/base.py +126 -0
- angr/exploration_techniques/bucketizer.py +1 -1
- angr/exploration_techniques/dfs.py +3 -1
- angr/exploration_techniques/director.py +2 -3
- angr/exploration_techniques/driller_core.py +1 -1
- angr/exploration_techniques/explorer.py +4 -2
- angr/exploration_techniques/lengthlimiter.py +2 -1
- angr/exploration_techniques/local_loop_seer.py +2 -1
- angr/exploration_techniques/loop_seer.py +5 -5
- angr/exploration_techniques/manual_mergepoint.py +2 -1
- angr/exploration_techniques/memory_watcher.py +3 -1
- angr/exploration_techniques/oppologist.py +4 -5
- angr/exploration_techniques/slicecutor.py +4 -2
- angr/exploration_techniques/spiller.py +1 -1
- angr/exploration_techniques/stochastic.py +2 -1
- angr/exploration_techniques/stub_stasher.py +2 -1
- angr/exploration_techniques/suggestions.py +3 -1
- angr/exploration_techniques/symbion.py +3 -1
- angr/exploration_techniques/tech_builder.py +2 -1
- angr/exploration_techniques/threading.py +2 -11
- angr/exploration_techniques/timeout.py +4 -2
- angr/exploration_techniques/tracer.py +4 -3
- angr/exploration_techniques/unique.py +3 -2
- angr/exploration_techniques/veritesting.py +1 -1
- angr/factory.py +36 -6
- angr/keyed_region.py +4 -4
- angr/knowledge_base.py +1 -1
- angr/knowledge_plugins/__init__.py +11 -11
- angr/knowledge_plugins/cfg/__init__.py +5 -5
- angr/knowledge_plugins/cfg/cfg_manager.py +2 -2
- angr/knowledge_plugins/cfg/cfg_model.py +8 -8
- angr/knowledge_plugins/cfg/cfg_node.py +19 -19
- angr/knowledge_plugins/cfg/indirect_jump.py +6 -6
- angr/knowledge_plugins/cfg/memory_data.py +5 -7
- angr/knowledge_plugins/functions/function.py +48 -52
- angr/knowledge_plugins/functions/function_parser.py +4 -4
- angr/knowledge_plugins/key_definitions/__init__.py +3 -3
- angr/knowledge_plugins/key_definitions/atoms.py +8 -8
- angr/knowledge_plugins/key_definitions/definition.py +1 -1
- angr/knowledge_plugins/key_definitions/live_definitions.py +30 -27
- angr/knowledge_plugins/labels.py +1 -1
- angr/knowledge_plugins/propagations/__init__.py +1 -1
- angr/knowledge_plugins/propagations/prop_value.py +2 -2
- angr/knowledge_plugins/propagations/propagation_model.py +7 -8
- angr/knowledge_plugins/propagations/states.py +44 -39
- angr/knowledge_plugins/variables/variable_access.py +2 -2
- angr/knowledge_plugins/variables/variable_manager.py +24 -10
- angr/knowledge_plugins/xrefs/xref.py +5 -8
- angr/misc/__init__.py +4 -4
- angr/misc/hookset.py +4 -5
- angr/misc/loggers.py +2 -2
- angr/misc/telemetry.py +1 -1
- angr/procedures/__init__.py +1 -1
- angr/procedures/cgc/fdwait.py +2 -2
- angr/procedures/definitions/__init__.py +2 -2
- angr/procedures/definitions/linux_kernel.py +0 -1
- angr/procedures/definitions/parse_syscalls_from_local_system.py +1 -1
- angr/procedures/definitions/parse_win32json.py +0 -1
- angr/procedures/ntdll/exceptions.py +1 -1
- angr/procedures/stubs/format_parser.py +3 -3
- angr/procedures/win32/dynamic_loading.py +1 -1
- angr/protos/__init__.py +3 -3
- angr/sim_manager.py +3 -5
- angr/sim_state.py +40 -42
- angr/sim_state_options.py +3 -3
- angr/sim_type.py +15 -14
- angr/sim_variable.py +42 -45
- angr/simos/__init__.py +4 -4
- angr/simos/cgc.py +1 -1
- angr/simos/simos.py +1 -1
- angr/simos/userland.py +1 -1
- angr/slicer.py +4 -7
- angr/state_plugins/__init__.py +34 -34
- angr/state_plugins/callstack.py +5 -12
- angr/state_plugins/heap/__init__.py +2 -2
- angr/state_plugins/heap/heap_brk.py +2 -4
- angr/state_plugins/heap/heap_ptmalloc.py +1 -1
- angr/state_plugins/jni_references.py +3 -2
- angr/state_plugins/scratch.py +1 -1
- angr/state_plugins/sim_action.py +1 -4
- angr/state_plugins/sim_event.py +1 -1
- angr/state_plugins/solver.py +7 -9
- angr/state_plugins/uc_manager.py +1 -1
- angr/state_plugins/view.py +2 -2
- angr/storage/__init__.py +1 -1
- angr/storage/file.py +10 -10
- angr/storage/memory_mixins/__init__.py +46 -46
- angr/storage/memory_mixins/default_filler_mixin.py +1 -3
- angr/storage/memory_mixins/javavm_memory_mixin.py +2 -2
- angr/storage/memory_mixins/name_resolution_mixin.py +2 -2
- angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +1 -3
- angr/storage/memory_mixins/paged_memory/pages/__init__.py +6 -6
- angr/storage/memory_mixins/paged_memory/pages/list_page.py +1 -1
- angr/storage/memory_mixins/paged_memory/pages/multi_values.py +1 -1
- angr/storage/memory_mixins/paged_memory/pages/mv_list_page.py +1 -1
- angr/storage/memory_mixins/paged_memory/pages/ultra_page.py +2 -4
- angr/storage/memory_mixins/regioned_memory/__init__.py +3 -3
- angr/storage/memory_mixins/regioned_memory/region_data.py +5 -5
- angr/storage/memory_mixins/regioned_memory/region_meta_mixin.py +7 -9
- angr/storage/memory_mixins/regioned_memory/regioned_memory_mixin.py +4 -4
- angr/storage/memory_object.py +4 -4
- angr/utils/__init__.py +3 -3
- angr/utils/bits.py +12 -0
- angr/utils/dynamic_dictlist.py +1 -1
- angr/utils/graph.py +1 -1
- angr/utils/orderedset.py +4 -1
- angr/utils/segment_list.py +2 -2
- angr/utils/ssa/__init__.py +33 -8
- {angr-9.2.131.dist-info → angr-9.2.133.dist-info}/METADATA +6 -6
- {angr-9.2.131.dist-info → angr-9.2.133.dist-info}/RECORD +262 -263
- angr/analyses/propagator/engine_ail.py +0 -1562
- angr/storage/memory_mixins/__init__.pyi +0 -48
- {angr-9.2.131.dist-info → angr-9.2.133.dist-info}/LICENSE +0 -0
- {angr-9.2.131.dist-info → angr-9.2.133.dist-info}/WHEEL +0 -0
- {angr-9.2.131.dist-info → angr-9.2.133.dist-info}/entry_points.txt +0 -0
- {angr-9.2.131.dist-info → angr-9.2.133.dist-info}/top_level.txt +0 -0
|
@@ -1,12 +1,218 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
+
from typing import Generic, TypeVar
|
|
3
|
+
from collections.abc import Callable
|
|
2
4
|
import claripy
|
|
5
|
+
from pyvex.expr import IRExpr, Unop, get_op_retty, Binop
|
|
6
|
+
from pyvex.const import get_type_size
|
|
3
7
|
|
|
4
|
-
from angr.
|
|
8
|
+
from angr.utils.bits import zeroextend_on_demand
|
|
9
|
+
from angr.block import Block
|
|
10
|
+
from angr.engines.engine import DataType_co
|
|
11
|
+
from angr.engines.light.engine import SimEngineLight, SimEngineLightVEX, StateType, BlockType, ResultType, StmtDataType
|
|
5
12
|
|
|
13
|
+
TOPS: dict[int, claripy.ast.BV] = {}
|
|
6
14
|
|
|
7
|
-
|
|
15
|
+
T = TypeVar("T")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ClaripyDataEngineMixin(
|
|
19
|
+
Generic[StateType, DataType_co, BlockType, ResultType],
|
|
20
|
+
SimEngineLight[StateType, DataType_co | claripy.ast.BV, BlockType, ResultType],
|
|
21
|
+
):
|
|
8
22
|
def _is_top(self, expr) -> bool:
|
|
9
|
-
return
|
|
23
|
+
return "TOP" in expr.variables
|
|
24
|
+
|
|
25
|
+
def _top(self, bits: int) -> DataType_co | claripy.ast.BV:
|
|
26
|
+
if bits in TOPS:
|
|
27
|
+
return TOPS[bits]
|
|
28
|
+
r = claripy.BVS("TOP", bits, explicit_name=True)
|
|
29
|
+
TOPS[bits] = r
|
|
30
|
+
return r
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _vex_make_comparison(
|
|
34
|
+
func: Callable[[claripy.ast.BV, claripy.ast.BV], claripy.ast.Bool]
|
|
35
|
+
) -> Callable[[ClaripyDataEngineMixin, Binop], claripy.ast.BV]:
|
|
36
|
+
@SimEngineLightVEX.binop_handler
|
|
37
|
+
def inner(self, expr):
|
|
38
|
+
a, b = self._expr(expr.args[0]), self._expr(expr.args[1])
|
|
39
|
+
if self._is_top(a) or self._is_top(b):
|
|
40
|
+
return self._top(1)
|
|
41
|
+
return claripy.If(func(a, b), claripy.BVV(1, 1), claripy.BVV(0, 1))
|
|
42
|
+
|
|
43
|
+
return inner
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _vex_make_vec_comparison(
|
|
47
|
+
func: Callable[[claripy.ast.BV, claripy.ast.BV], claripy.ast.Bool]
|
|
48
|
+
) -> Callable[[ClaripyDataEngineMixin, int, int, Binop], claripy.ast.BV]:
|
|
49
|
+
@SimEngineLightVEX.binopv_handler
|
|
50
|
+
def inner(self, size, count, expr):
|
|
51
|
+
_, _ = self._expr(expr.args[0]), self._expr(expr.args[1])
|
|
52
|
+
fullsize = get_type_size(get_op_retty(expr.op))
|
|
53
|
+
return self._top(fullsize)
|
|
54
|
+
|
|
55
|
+
return inner
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _vex_make_operation(
|
|
59
|
+
func: Callable[[claripy.ast.BV, claripy.ast.BV], claripy.ast.BV]
|
|
60
|
+
) -> Callable[[ClaripyDataEngineMixin, Binop], claripy.ast.BV]:
|
|
61
|
+
@SimEngineLightVEX.binop_handler
|
|
62
|
+
def inner(self, expr: Binop):
|
|
63
|
+
a, b = self._expr(expr.args[0]), self._expr(expr.args[1])
|
|
64
|
+
if self._is_top(a) or self._is_top(b):
|
|
65
|
+
fullsize = get_type_size(get_op_retty(expr.op))
|
|
66
|
+
return self._top(fullsize)
|
|
67
|
+
return func(a, b)
|
|
68
|
+
|
|
69
|
+
return inner
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _vex_make_unary_operation(
|
|
73
|
+
func: Callable[[claripy.ast.BV], claripy.ast.BV]
|
|
74
|
+
) -> Callable[[ClaripyDataEngineMixin, Unop], claripy.ast.BV]:
|
|
75
|
+
@SimEngineLightVEX.unop_handler
|
|
76
|
+
def inner(self, expr):
|
|
77
|
+
a = self._expr(expr.args[0])
|
|
78
|
+
if self._is_top(a):
|
|
79
|
+
fullsize = get_type_size(get_op_retty(expr.op))
|
|
80
|
+
return self._top(fullsize)
|
|
81
|
+
return func(a)
|
|
82
|
+
|
|
83
|
+
return inner
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _vex_make_shift_operation(
|
|
87
|
+
func: Callable[[claripy.ast.BV, claripy.ast.BV], claripy.ast.BV]
|
|
88
|
+
) -> Callable[[ClaripyDataEngineMixin, Binop], claripy.ast.BV]:
|
|
89
|
+
@_vex_make_operation
|
|
90
|
+
def inner(a, b):
|
|
91
|
+
if b.size() < a.size():
|
|
92
|
+
b = claripy.ZeroExt(a.size() - b.size(), b)
|
|
93
|
+
elif b.size() > a.size():
|
|
94
|
+
b = claripy.Extract(a.size() - 1, 0, b)
|
|
95
|
+
|
|
96
|
+
return func(a, b)
|
|
97
|
+
|
|
98
|
+
return inner
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _vex_make_vec_operation(
|
|
102
|
+
func: Callable[[claripy.ast.BV, claripy.ast.BV], claripy.ast.BV]
|
|
103
|
+
) -> Callable[[ClaripyDataEngineMixin, int, int, Binop], claripy.ast.BV]:
|
|
104
|
+
@SimEngineLightVEX.binopv_handler
|
|
105
|
+
def inner(self, size, count, expr):
|
|
106
|
+
_, _ = self._expr(expr.args[0]), self._expr(expr.args[1])
|
|
107
|
+
fullsize = get_type_size(get_op_retty(expr.op))
|
|
108
|
+
return self._top(fullsize)
|
|
109
|
+
|
|
110
|
+
return inner
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class ClaripyDataVEXEngineMixin(
|
|
114
|
+
Generic[StateType, DataType_co, ResultType, StmtDataType],
|
|
115
|
+
ClaripyDataEngineMixin[StateType, DataType_co, Block, ResultType],
|
|
116
|
+
SimEngineLightVEX[StateType, DataType_co | claripy.ast.BV, ResultType, StmtDataType],
|
|
117
|
+
):
|
|
118
|
+
def _expr_bv(self, expr: IRExpr) -> claripy.ast.BV:
|
|
119
|
+
result = self._expr(expr)
|
|
120
|
+
assert isinstance(result, claripy.ast.BV)
|
|
121
|
+
return result
|
|
122
|
+
|
|
123
|
+
def _expr_fp(self, expr: IRExpr) -> claripy.ast.FP:
|
|
124
|
+
result = self._expr(expr)
|
|
125
|
+
assert isinstance(result, claripy.ast.FP)
|
|
126
|
+
return result
|
|
127
|
+
|
|
128
|
+
_handle_binop_CmpEQ = _vex_make_comparison(lambda a, b: a == b)
|
|
129
|
+
_handle_binop_CmpNE = _vex_make_comparison(lambda a, b: a != b)
|
|
130
|
+
_handle_binop_CmpLT = _vex_make_comparison(lambda a, b: a < b)
|
|
131
|
+
_handle_binop_CmpGT = _vex_make_comparison(lambda a, b: a > b)
|
|
132
|
+
_handle_binop_CmpLE = _vex_make_comparison(lambda a, b: a <= b)
|
|
133
|
+
_handle_binop_CmpGE = _vex_make_comparison(lambda a, b: a >= b)
|
|
134
|
+
|
|
135
|
+
_handle_binopv_CmpEQ = _vex_make_vec_comparison(lambda a, b: a == b)
|
|
136
|
+
_handle_binopv_CmpNE = _vex_make_vec_comparison(lambda a, b: a != b)
|
|
137
|
+
_handle_binopv_CmpLT = _vex_make_vec_comparison(lambda a, b: a < b)
|
|
138
|
+
_handle_binopv_CmpGT = _vex_make_vec_comparison(lambda a, b: a > b)
|
|
139
|
+
_handle_binopv_CmpLE = _vex_make_vec_comparison(lambda a, b: a <= b)
|
|
140
|
+
_handle_binopv_CmpGE = _vex_make_vec_comparison(lambda a, b: a >= b)
|
|
141
|
+
|
|
142
|
+
_handle_unop_Neg = _vex_make_unary_operation(lambda a: -a)
|
|
143
|
+
_handle_unop_Not = _vex_make_unary_operation(lambda a: ~a)
|
|
144
|
+
|
|
145
|
+
_handle_binop_Add = _vex_make_operation(lambda a, b: a + b)
|
|
146
|
+
_handle_binop_Sub = _vex_make_operation(lambda a, b: a - b)
|
|
147
|
+
_handle_binop_Mul = _vex_make_operation(lambda a, b: a * b)
|
|
148
|
+
_handle_binop_MullS = _vex_make_operation(lambda a, b: a.sign_extend(a.size()) * b.sign_extend(b.size()))
|
|
149
|
+
_handle_binop_MullU = _vex_make_operation(lambda a, b: a.zero_extend(a.size()) * b.zero_extend(b.size()))
|
|
150
|
+
_handle_binop_And = _vex_make_operation(lambda a, b: a & b)
|
|
151
|
+
_handle_binop_Or = _vex_make_operation(lambda a, b: a | b)
|
|
152
|
+
_handle_binop_Xor = _vex_make_operation(lambda a, b: a ^ b)
|
|
153
|
+
_handle_binop_Shl = _vex_make_shift_operation(lambda a, b: a << zeroextend_on_demand(a, b))
|
|
154
|
+
_handle_binop_Sar = _vex_make_shift_operation(lambda a, b: a >> zeroextend_on_demand(a, b))
|
|
155
|
+
_handle_binop_Shr = _vex_make_shift_operation(lambda a, b: claripy.LShR(a, zeroextend_on_demand(a, b)))
|
|
156
|
+
|
|
157
|
+
@SimEngineLightVEX.binop_handler
|
|
158
|
+
def _handle_binop_Div(self, expr):
|
|
159
|
+
a, b = self._expr_bv(expr.args[0]), self._expr_bv(expr.args[1])
|
|
160
|
+
if self._is_top(a) or self._is_top(b) or (b == 0).is_true():
|
|
161
|
+
fullsize = get_type_size(get_op_retty(expr.op))
|
|
162
|
+
return self._top(fullsize)
|
|
163
|
+
return a // b
|
|
164
|
+
|
|
165
|
+
@SimEngineLightVEX.binop_handler
|
|
166
|
+
def _handle_binop_Mod(self, expr):
|
|
167
|
+
a, b = self._expr_bv(expr.args[0]), self._expr_bv(expr.args[1])
|
|
168
|
+
if self._is_top(a) or self._is_top(b) or (b == 0).is_true():
|
|
169
|
+
fullsize = get_type_size(get_op_retty(expr.op))
|
|
170
|
+
return self._top(fullsize)
|
|
171
|
+
return a % b
|
|
172
|
+
|
|
173
|
+
@SimEngineLightVEX.binop_handler
|
|
174
|
+
def _handle_binop_DivMod(self, expr):
|
|
175
|
+
a, b = self._expr_bv(expr.args[0]), self._expr_bv(expr.args[1])
|
|
176
|
+
if self._is_top(a) or self._is_top(b) or (b == 0).is_true():
|
|
177
|
+
fullsize = get_type_size(get_op_retty(expr.op))
|
|
178
|
+
return self._top(fullsize)
|
|
179
|
+
|
|
180
|
+
signed = "U" in expr.op # Iop_DivModU64to32 vs Iop_DivMod
|
|
181
|
+
from_size = a.size()
|
|
182
|
+
to_size = b.size()
|
|
183
|
+
if signed:
|
|
184
|
+
quotient = a.SDiv(claripy.SignExt(from_size - to_size, b))
|
|
185
|
+
remainder = a.SMod(claripy.SignExt(from_size - to_size, b))
|
|
186
|
+
quotient_size = to_size
|
|
187
|
+
remainder_size = to_size
|
|
188
|
+
return claripy.Concat(
|
|
189
|
+
claripy.Extract(remainder_size - 1, 0, remainder), claripy.Extract(quotient_size - 1, 0, quotient)
|
|
190
|
+
)
|
|
191
|
+
quotient = a // claripy.ZeroExt(from_size - to_size, b)
|
|
192
|
+
remainder = a % claripy.ZeroExt(from_size - to_size, b)
|
|
193
|
+
quotient_size = to_size
|
|
194
|
+
remainder_size = to_size
|
|
195
|
+
return claripy.Concat(
|
|
196
|
+
claripy.Extract(remainder_size - 1, 0, remainder), claripy.Extract(quotient_size - 1, 0, quotient)
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
_handle_binop_64HLto128 = _vex_make_operation(claripy.Concat)
|
|
200
|
+
_handle_binop_32HLto64 = _vex_make_operation(claripy.Concat)
|
|
201
|
+
_handle_binop_16HLto32 = _vex_make_operation(claripy.Concat)
|
|
202
|
+
_handle_binop_8HLto16 = _vex_make_operation(claripy.Concat)
|
|
203
|
+
|
|
204
|
+
def _handle_conversion(self, from_size, to_size, signed, operand):
|
|
205
|
+
expr_ = self._expr_bv(operand)
|
|
206
|
+
assert from_size == operand.result_size(self.tyenv)
|
|
207
|
+
if self._is_top(expr_):
|
|
208
|
+
return self._top(to_size).annotate(*expr_.annotations)
|
|
10
209
|
|
|
11
|
-
|
|
12
|
-
|
|
210
|
+
if expr_.size() > to_size:
|
|
211
|
+
# truncation
|
|
212
|
+
return expr_[to_size - 1 : 0]
|
|
213
|
+
if expr_.size() < to_size:
|
|
214
|
+
# extension
|
|
215
|
+
if signed:
|
|
216
|
+
return claripy.SignExt(to_size - expr_.size(), expr_)
|
|
217
|
+
return claripy.ZeroExt(to_size - expr_.size(), expr_)
|
|
218
|
+
return expr_
|
|
@@ -18,7 +18,7 @@ class VEXMemVar:
|
|
|
18
18
|
"size",
|
|
19
19
|
)
|
|
20
20
|
|
|
21
|
-
def __init__(self, addr, size):
|
|
21
|
+
def __init__(self, addr: int, size: int):
|
|
22
22
|
self.addr = addr
|
|
23
23
|
self.size = size
|
|
24
24
|
|
|
@@ -29,7 +29,7 @@ class VEXMemVar:
|
|
|
29
29
|
return type(other) is VEXMemVar and other.addr == self.addr and other.size == self.size
|
|
30
30
|
|
|
31
31
|
def __repr__(self):
|
|
32
|
-
return "<mem
|
|
32
|
+
return f"<mem {self.addr:#x}[{self.size} bytes]>"
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
class VEXReg(VEXVariable):
|
|
@@ -49,7 +49,7 @@ class VEXReg(VEXVariable):
|
|
|
49
49
|
return type(other) is VEXReg and other.offset == self.offset and other.size == self.size
|
|
50
50
|
|
|
51
51
|
def __repr__(self):
|
|
52
|
-
return "<reg
|
|
52
|
+
return f"<reg {self.offset}[{self.size}]>"
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
class VEXTmp(VEXVariable):
|
|
@@ -65,4 +65,4 @@ class VEXTmp(VEXVariable):
|
|
|
65
65
|
return type(other) is VEXTmp and other.tmp == self.tmp
|
|
66
66
|
|
|
67
67
|
def __repr__(self):
|
|
68
|
-
return "<tmp
|
|
68
|
+
return f"<tmp {self.tmp}>"
|
|
@@ -24,21 +24,21 @@ if TYPE_CHECKING:
|
|
|
24
24
|
from angr.storage.memory_mixins.paged_memory.pages import MVListPage
|
|
25
25
|
|
|
26
26
|
__all__ = (
|
|
27
|
-
"LiveDefinitions",
|
|
28
|
-
"ObservationPointType",
|
|
29
|
-
"AtomKind",
|
|
30
27
|
"Atom",
|
|
31
|
-
"
|
|
32
|
-
"MemoryLocation",
|
|
33
|
-
"Tmp",
|
|
34
|
-
"GuardUse",
|
|
28
|
+
"AtomKind",
|
|
35
29
|
"ConstantSrc",
|
|
36
30
|
"Definition",
|
|
31
|
+
"FunctionCallData",
|
|
32
|
+
"FunctionHandler",
|
|
33
|
+
"GuardUse",
|
|
34
|
+
"LiveDefinitions",
|
|
35
|
+
"MemoryLocation",
|
|
36
|
+
"ObservationPointType",
|
|
37
37
|
"ReachingDefinitionsAnalysis",
|
|
38
38
|
"ReachingDefinitionsModel",
|
|
39
39
|
"ReachingDefinitionsState",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
40
|
+
"Register",
|
|
41
|
+
"Tmp",
|
|
42
42
|
"get_all_definitions",
|
|
43
43
|
)
|
|
44
44
|
|
|
@@ -7,9 +7,9 @@ class CallSite:
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
__slots__ = (
|
|
10
|
-
"caller_func_addr",
|
|
11
10
|
"block_addr",
|
|
12
11
|
"callee_func_addr",
|
|
12
|
+
"caller_func_addr",
|
|
13
13
|
)
|
|
14
14
|
|
|
15
15
|
def __init__(self, caller_func_addr: int, block_addr: int | None, callee_func_addr: int):
|
|
@@ -48,7 +48,7 @@ class CallTrace:
|
|
|
48
48
|
self.callsites: list[CallSite] = []
|
|
49
49
|
|
|
50
50
|
def __repr__(self):
|
|
51
|
-
return "<Trace with
|
|
51
|
+
return f"<Trace with {len(self.callsites)} callsites>"
|
|
52
52
|
|
|
53
53
|
def current_function_address(self) -> int:
|
|
54
54
|
if not self.callsites:
|
|
@@ -150,7 +150,7 @@ class DepGraph:
|
|
|
150
150
|
return any(definition.atom == atom for definition in self.nodes())
|
|
151
151
|
|
|
152
152
|
def add_dependencies_for_concrete_pointers_of(
|
|
153
|
-
self, values: Iterable[claripy.ast.Base | int], definition: Definition, cfg: CFGModel, loader: Loader
|
|
153
|
+
self, values: Iterable[claripy.ast.Base | int], definition: Definition, cfg: CFGModel | None, loader: Loader
|
|
154
154
|
):
|
|
155
155
|
"""
|
|
156
156
|
When a given definition holds concrete pointers, make sure the <MemoryLocation>s they point to are present in
|