angr 9.2.102__py3-none-manylinux2014_x86_64.whl → 9.2.104__py3-none-manylinux2014_x86_64.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 +1 -1
- angr/analyses/analysis.py +7 -6
- angr/analyses/calling_convention.py +33 -35
- angr/analyses/cdg.py +2 -4
- angr/analyses/cfg/cfb.py +4 -3
- angr/analyses/cfg/cfg_base.py +14 -14
- angr/analyses/cfg/cfg_emulated.py +3 -4
- angr/analyses/cfg/cfg_fast.py +46 -46
- angr/analyses/cfg/cfg_fast_soot.py +1 -2
- angr/analyses/cfg/cfg_job_base.py +2 -2
- angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +14 -13
- angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py +5 -5
- angr/analyses/cfg_slice_to_sink/cfg_slice_to_sink.py +3 -3
- angr/analyses/complete_calling_conventions.py +13 -12
- angr/analyses/data_dep/data_dependency_analysis.py +24 -24
- angr/analyses/data_dep/dep_nodes.py +3 -3
- angr/analyses/ddg.py +1 -2
- angr/analyses/decompiler/ail_simplifier.py +35 -34
- angr/analyses/decompiler/block_io_finder.py +20 -20
- angr/analyses/decompiler/block_similarity.py +4 -6
- angr/analyses/decompiler/block_simplifier.py +17 -16
- angr/analyses/decompiler/callsite_maker.py +25 -10
- angr/analyses/decompiler/ccall_rewriters/amd64_ccalls.py +1 -3
- angr/analyses/decompiler/ccall_rewriters/rewriter_base.py +2 -4
- angr/analyses/decompiler/clinic.py +250 -45
- angr/analyses/decompiler/condition_processor.py +15 -8
- angr/analyses/decompiler/decompilation_cache.py +7 -7
- angr/analyses/decompiler/decompilation_options.py +4 -4
- angr/analyses/decompiler/decompiler.py +19 -15
- angr/analyses/decompiler/expression_counters.py +10 -9
- angr/analyses/decompiler/goto_manager.py +2 -4
- angr/analyses/decompiler/graph_region.py +9 -9
- angr/analyses/decompiler/jump_target_collector.py +1 -2
- angr/analyses/decompiler/optimization_passes/__init__.py +4 -3
- angr/analyses/decompiler/optimization_passes/code_motion.py +5 -6
- angr/analyses/decompiler/optimization_passes/const_derefs.py +4 -4
- angr/analyses/decompiler/optimization_passes/deadblock_remover.py +73 -0
- angr/analyses/decompiler/optimization_passes/engine_base.py +25 -3
- angr/analyses/decompiler/optimization_passes/expr_op_swapper.py +6 -5
- angr/analyses/decompiler/optimization_passes/flip_boolean_cmp.py +2 -2
- angr/analyses/decompiler/optimization_passes/inlined_string_transformation_simplifier.py +3 -0
- angr/analyses/decompiler/optimization_passes/ite_expr_converter.py +2 -2
- angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py +17 -17
- angr/analyses/decompiler/optimization_passes/optimization_pass.py +12 -13
- angr/analyses/decompiler/optimization_passes/register_save_area_simplifier.py +25 -21
- angr/analyses/decompiler/optimization_passes/ret_addr_save_simplifier.py +3 -3
- angr/analyses/decompiler/optimization_passes/ret_deduplicator.py +1 -2
- angr/analyses/decompiler/optimization_passes/return_duplicator_base.py +7 -7
- angr/analyses/decompiler/optimization_passes/spilled_register_finder.py +18 -0
- angr/analyses/decompiler/optimization_passes/stack_canary_simplifier.py +2 -3
- angr/analyses/decompiler/optimization_passes/win_stack_canary_simplifier.py +1 -2
- angr/analyses/decompiler/optimization_passes/x86_gcc_getpc_simplifier.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/__init__.py +4 -3
- angr/analyses/decompiler/peephole_optimizations/base.py +13 -15
- angr/analyses/decompiler/peephole_optimizations/bswap.py +1 -3
- angr/analyses/decompiler/peephole_optimizations/cmpord_rewriter.py +72 -0
- angr/analyses/decompiler/peephole_optimizations/const_mull_a_shift.py +1 -2
- angr/analyses/decompiler/peephole_optimizations/eager_eval.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/inlined_strcpy.py +5 -10
- angr/analyses/decompiler/peephole_optimizations/inlined_strcpy_consolidation.py +3 -4
- angr/analyses/decompiler/peephole_optimizations/inlined_wstrcpy.py +7 -10
- angr/analyses/decompiler/peephole_optimizations/rewrite_bit_extractions.py +2 -3
- angr/analyses/decompiler/peephole_optimizations/sar_to_signed_div.py +1 -2
- angr/analyses/decompiler/peephole_optimizations/tidy_stack_addr.py +4 -4
- angr/analyses/decompiler/redundant_label_remover.py +4 -5
- angr/analyses/decompiler/region_identifier.py +4 -5
- angr/analyses/decompiler/region_simplifiers/cascading_cond_transformer.py +1 -2
- angr/analyses/decompiler/region_simplifiers/expr_folding.py +19 -20
- angr/analyses/decompiler/region_simplifiers/goto.py +2 -3
- angr/analyses/decompiler/region_simplifiers/loop.py +1 -2
- angr/analyses/decompiler/region_simplifiers/node_address_finder.py +1 -2
- angr/analyses/decompiler/region_simplifiers/region_simplifier.py +1 -3
- angr/analyses/decompiler/region_simplifiers/switch_cluster_simplifier.py +19 -19
- angr/analyses/decompiler/return_maker.py +1 -2
- angr/analyses/decompiler/structured_codegen/base.py +5 -6
- angr/analyses/decompiler/structured_codegen/c.py +39 -38
- angr/analyses/decompiler/structuring/__init__.py +1 -1
- angr/analyses/decompiler/structuring/dream.py +17 -16
- angr/analyses/decompiler/structuring/phoenix.py +45 -46
- angr/analyses/decompiler/structuring/recursive_structurer.py +4 -4
- angr/analyses/decompiler/structuring/structurer_base.py +16 -15
- angr/analyses/decompiler/structuring/structurer_nodes.py +10 -9
- angr/analyses/decompiler/utils.py +17 -16
- angr/analyses/disassembly.py +7 -6
- angr/analyses/flirt.py +9 -9
- angr/analyses/forward_analysis/forward_analysis.py +15 -14
- angr/analyses/forward_analysis/visitors/function_graph.py +1 -2
- angr/analyses/forward_analysis/visitors/graph.py +16 -15
- angr/analyses/propagator/engine_ail.py +30 -26
- angr/analyses/propagator/outdated_definition_walker.py +8 -7
- angr/analyses/propagator/propagator.py +11 -13
- angr/analyses/proximity_graph.py +21 -21
- angr/analyses/reaching_definitions/__init__.py +3 -3
- angr/analyses/reaching_definitions/call_trace.py +3 -6
- angr/analyses/reaching_definitions/dep_graph.py +41 -48
- angr/analyses/reaching_definitions/engine_ail.py +11 -5
- angr/analyses/reaching_definitions/engine_vex.py +9 -8
- angr/analyses/reaching_definitions/function_handler.py +51 -34
- angr/analyses/reaching_definitions/heap_allocator.py +3 -4
- angr/analyses/reaching_definitions/rd_initializer.py +8 -8
- angr/analyses/reaching_definitions/rd_state.py +57 -58
- angr/analyses/reaching_definitions/reaching_definitions.py +18 -17
- angr/analyses/reaching_definitions/subject.py +2 -3
- angr/analyses/stack_pointer_tracker.py +15 -6
- angr/analyses/typehoon/dfa.py +4 -4
- angr/analyses/typehoon/simple_solver.py +48 -52
- angr/analyses/typehoon/translator.py +3 -6
- angr/analyses/typehoon/typeconsts.py +13 -14
- angr/analyses/typehoon/typehoon.py +9 -9
- angr/analyses/typehoon/typevars.py +18 -17
- angr/analyses/variable_recovery/engine_ail.py +5 -5
- angr/analyses/variable_recovery/engine_base.py +25 -21
- angr/analyses/variable_recovery/irsb_scanner.py +8 -9
- angr/analyses/variable_recovery/variable_recovery.py +1 -2
- angr/analyses/variable_recovery/variable_recovery_base.py +14 -13
- angr/analyses/variable_recovery/variable_recovery_fast.py +8 -8
- angr/analyses/veritesting.py +1 -2
- angr/analyses/vfg.py +57 -56
- angr/analyses/xrefs.py +1 -2
- angr/angrdb/db.py +7 -7
- angr/angrdb/serializers/kb.py +16 -13
- angr/angrdb/serializers/loader.py +1 -2
- angr/angrdb/serializers/structured_code.py +2 -2
- angr/annocfg.py +1 -2
- angr/block.py +16 -6
- angr/calling_conventions.py +28 -27
- angr/code_location.py +8 -8
- angr/codenode.py +1 -2
- angr/concretization_strategies/max.py +1 -3
- angr/distributed/server.py +1 -3
- angr/distributed/worker.py +1 -2
- angr/engines/engine.py +2 -3
- angr/engines/light/engine.py +4 -4
- angr/engines/pcode/behavior.py +20 -2
- angr/engines/pcode/emulate.py +1 -1
- angr/engines/pcode/engine.py +7 -7
- angr/engines/pcode/lifter.py +78 -77
- angr/engines/vex/claripy/ccall.py +1 -2
- angr/engines/vex/claripy/datalayer.py +1 -2
- angr/engines/vex/light/light.py +1 -2
- angr/exploration_techniques/tracer.py +4 -4
- angr/factory.py +12 -15
- angr/flirt/__init__.py +8 -8
- angr/flirt/build_sig.py +2 -3
- angr/keyed_region.py +2 -2
- angr/knowledge_base/knowledge_base.py +3 -3
- angr/knowledge_plugins/callsite_prototypes.py +4 -6
- angr/knowledge_plugins/cfg/cfg_manager.py +19 -6
- angr/knowledge_plugins/cfg/cfg_model.py +26 -27
- angr/knowledge_plugins/cfg/cfg_node.py +2 -2
- angr/knowledge_plugins/cfg/indirect_jump.py +6 -8
- angr/knowledge_plugins/cfg/memory_data.py +8 -9
- angr/knowledge_plugins/custom_strings.py +1 -3
- angr/knowledge_plugins/debug_variables.py +2 -2
- angr/knowledge_plugins/functions/function.py +21 -22
- angr/knowledge_plugins/functions/function_manager.py +5 -5
- angr/knowledge_plugins/indirect_jumps.py +1 -3
- angr/knowledge_plugins/key_definitions/atoms.py +7 -7
- angr/knowledge_plugins/key_definitions/definition.py +14 -14
- angr/knowledge_plugins/key_definitions/environment.py +5 -7
- angr/knowledge_plugins/key_definitions/heap_address.py +1 -3
- angr/knowledge_plugins/key_definitions/key_definition_manager.py +3 -2
- angr/knowledge_plugins/key_definitions/live_definitions.py +60 -59
- angr/knowledge_plugins/key_definitions/liveness.py +16 -16
- angr/knowledge_plugins/key_definitions/rd_model.py +15 -15
- angr/knowledge_plugins/key_definitions/uses.py +11 -11
- angr/knowledge_plugins/patches.py +4 -8
- angr/knowledge_plugins/propagations/prop_value.py +10 -9
- angr/knowledge_plugins/propagations/propagation_manager.py +3 -5
- angr/knowledge_plugins/propagations/propagation_model.py +9 -9
- angr/knowledge_plugins/propagations/states.py +52 -22
- angr/knowledge_plugins/structured_code/manager.py +2 -2
- angr/knowledge_plugins/sync/sync_controller.py +3 -3
- angr/knowledge_plugins/variables/variable_access.py +4 -4
- angr/knowledge_plugins/variables/variable_manager.py +39 -39
- angr/knowledge_plugins/xrefs/xref.py +9 -11
- angr/knowledge_plugins/xrefs/xref_manager.py +3 -4
- angr/misc/ansi.py +1 -2
- angr/misc/autoimport.py +3 -3
- angr/misc/plugins.py +9 -9
- angr/procedures/definitions/__init__.py +16 -16
- angr/procedures/definitions/linux_kernel.py +1 -1
- angr/procedures/definitions/parse_win32json.py +1 -1
- angr/procedures/java_jni/__init__.py +1 -1
- angr/procedures/java_jni/array_operations.py +1 -2
- angr/procedures/java_jni/method_calls.py +1 -2
- angr/procedures/posix/inet_ntoa.py +1 -2
- angr/procedures/stubs/format_parser.py +3 -3
- angr/project.py +13 -11
- angr/sim_manager.py +12 -12
- angr/sim_procedure.py +7 -3
- angr/sim_state.py +2 -2
- angr/sim_type.py +60 -45
- angr/sim_variable.py +5 -5
- angr/simos/simos.py +1 -2
- angr/simos/userland.py +1 -2
- angr/state_plugins/callstack.py +3 -2
- angr/state_plugins/history.py +1 -2
- angr/state_plugins/solver.py +34 -34
- angr/storage/memory_mixins/__init__.py +4 -3
- angr/storage/memory_mixins/actions_mixin.py +1 -3
- angr/storage/memory_mixins/address_concretization_mixin.py +1 -3
- angr/storage/memory_mixins/convenient_mappings_mixin.py +3 -4
- angr/storage/memory_mixins/default_filler_mixin.py +1 -1
- angr/storage/memory_mixins/label_merger_mixin.py +2 -2
- angr/storage/memory_mixins/multi_value_merger_mixin.py +4 -3
- angr/storage/memory_mixins/paged_memory/page_backer_mixins.py +9 -8
- angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +12 -11
- angr/storage/memory_mixins/paged_memory/pages/cooperation.py +8 -8
- angr/storage/memory_mixins/paged_memory/pages/history_tracking_mixin.py +2 -3
- angr/storage/memory_mixins/paged_memory/pages/list_page.py +10 -11
- angr/storage/memory_mixins/paged_memory/pages/multi_values.py +11 -10
- angr/storage/memory_mixins/paged_memory/pages/mv_list_page.py +18 -17
- angr/storage/memory_mixins/paged_memory/pages/ultra_page.py +12 -11
- angr/storage/memory_mixins/regioned_memory/abstract_address_descriptor.py +3 -3
- angr/storage/memory_mixins/regioned_memory/abstract_merger_mixin.py +3 -2
- angr/storage/memory_mixins/regioned_memory/region_data.py +1 -2
- angr/storage/memory_mixins/regioned_memory/region_meta_mixin.py +2 -2
- angr/storage/memory_mixins/regioned_memory/regioned_address_concretization_mixin.py +3 -3
- angr/storage/memory_mixins/regioned_memory/regioned_memory_mixin.py +18 -21
- angr/storage/memory_mixins/size_resolution_mixin.py +1 -2
- angr/storage/memory_mixins/symbolic_merger_mixin.py +3 -2
- angr/storage/memory_mixins/top_merger_mixin.py +3 -2
- angr/storage/memory_object.py +2 -4
- angr/utils/algo.py +3 -2
- angr/utils/dynamic_dictlist.py +5 -5
- angr/utils/formatting.py +4 -4
- angr/utils/funcid.py +1 -2
- angr/utils/graph.py +5 -6
- angr/utils/library.py +5 -5
- angr/utils/mp.py +5 -4
- angr/utils/segment_list.py +3 -4
- angr/utils/typing.py +3 -2
- {angr-9.2.102.dist-info → angr-9.2.104.dist-info}/METADATA +9 -11
- {angr-9.2.102.dist-info → angr-9.2.104.dist-info}/RECORD +239 -236
- {angr-9.2.102.dist-info → angr-9.2.104.dist-info}/LICENSE +0 -0
- {angr-9.2.102.dist-info → angr-9.2.104.dist-info}/WHEEL +0 -0
- {angr-9.2.102.dist-info → angr-9.2.104.dist-info}/entry_points.txt +0 -0
- {angr-9.2.102.dist-info → angr-9.2.104.dist-info}/top_level.txt +0 -0
angr/calling_conventions.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pylint:disable=line-too-long,missing-class-docstring,no-self-use
|
|
2
2
|
import logging
|
|
3
|
-
from typing import Optional,
|
|
3
|
+
from typing import Optional, Union
|
|
4
4
|
from collections import defaultdict
|
|
5
5
|
|
|
6
6
|
import claripy
|
|
@@ -116,7 +116,7 @@ class AllocHelper:
|
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
def refine_locs_with_struct_type(
|
|
119
|
-
arch: archinfo.Arch, locs:
|
|
119
|
+
arch: archinfo.Arch, locs: list, arg_type: SimType, offset: int = 0, treat_bot_as_int=True
|
|
120
120
|
):
|
|
121
121
|
# CONTRACT FOR USING THIS METHOD: locs must be a list of locs which are all wordsize
|
|
122
122
|
# ADDITIONAL NUANCE: this will not respect the need for big-endian integers to be stored at the end of words.
|
|
@@ -265,7 +265,7 @@ class SimFunctionArgument:
|
|
|
265
265
|
def refine(self, size, arch=None, offset=None, is_fp=None):
|
|
266
266
|
raise NotImplementedError
|
|
267
267
|
|
|
268
|
-
def get_footprint(self) ->
|
|
268
|
+
def get_footprint(self) -> list[Union["SimRegArg", "SimStackArg"]]:
|
|
269
269
|
"""
|
|
270
270
|
Return a list of SimRegArg and SimStackArgs that are the base components used for this location
|
|
271
271
|
"""
|
|
@@ -424,7 +424,7 @@ class SimStructArg(SimFunctionArgument):
|
|
|
424
424
|
:ivar locs: The storage locations to use
|
|
425
425
|
"""
|
|
426
426
|
|
|
427
|
-
def __init__(self, struct: SimStruct, locs:
|
|
427
|
+
def __init__(self, struct: SimStruct, locs: dict[str, SimFunctionArgument]):
|
|
428
428
|
super().__init__(sum(loc.size for loc in locs.values()))
|
|
429
429
|
self.struct = struct
|
|
430
430
|
self.locs = locs
|
|
@@ -557,18 +557,18 @@ class SimCC:
|
|
|
557
557
|
# Here are all the things a subclass needs to specify!
|
|
558
558
|
#
|
|
559
559
|
|
|
560
|
-
ARG_REGS:
|
|
561
|
-
FP_ARG_REGS:
|
|
560
|
+
ARG_REGS: list[str] = [] # A list of all the registers used for integral args, in order (names or offsets)
|
|
561
|
+
FP_ARG_REGS: list[str] = [] # A list of all the registers used for floating point args, in order
|
|
562
562
|
STACKARG_SP_BUFF = 0 # The amount of stack space reserved between the saved return address
|
|
563
563
|
# (if applicable) and the arguments. Probably zero.
|
|
564
564
|
STACKARG_SP_DIFF = 0 # The amount of stack space reserved for the return address
|
|
565
|
-
CALLER_SAVED_REGS:
|
|
565
|
+
CALLER_SAVED_REGS: list[str] = [] # Caller-saved registers
|
|
566
566
|
RETURN_ADDR: SimFunctionArgument = None # The location where the return address is stored, as a SimFunctionArgument
|
|
567
567
|
RETURN_VAL: SimFunctionArgument = None # The location where the return value is stored, as a SimFunctionArgument
|
|
568
|
-
OVERFLOW_RETURN_VAL:
|
|
568
|
+
OVERFLOW_RETURN_VAL: SimFunctionArgument | None = (
|
|
569
569
|
None # The second half of the location where a double-length return value is stored
|
|
570
570
|
)
|
|
571
|
-
FP_RETURN_VAL:
|
|
571
|
+
FP_RETURN_VAL: SimFunctionArgument | None = (
|
|
572
572
|
None # The location where floating-point argument return values are stored
|
|
573
573
|
)
|
|
574
574
|
ARCH = None # The archinfo.Arch class that this CC must be used for, if relevant
|
|
@@ -629,7 +629,7 @@ class SimCC:
|
|
|
629
629
|
|
|
630
630
|
ArgSession = ArgSession # import this from global scope so SimCC subclasses can subclass it if they like
|
|
631
631
|
|
|
632
|
-
def arg_session(self, ret_ty:
|
|
632
|
+
def arg_session(self, ret_ty: SimType | None):
|
|
633
633
|
"""
|
|
634
634
|
Return an arg session.
|
|
635
635
|
|
|
@@ -785,7 +785,7 @@ class SimCC:
|
|
|
785
785
|
|
|
786
786
|
return result
|
|
787
787
|
|
|
788
|
-
def arg_locs(self, prototype) ->
|
|
788
|
+
def arg_locs(self, prototype) -> list[SimFunctionArgument]:
|
|
789
789
|
if prototype._arch is None:
|
|
790
790
|
prototype = prototype.with_arch(self.arch)
|
|
791
791
|
session = self.arg_session(prototype.returnty)
|
|
@@ -1073,7 +1073,7 @@ class SimCC:
|
|
|
1073
1073
|
return isinstance(other, self.__class__)
|
|
1074
1074
|
|
|
1075
1075
|
@classmethod
|
|
1076
|
-
def _match(cls, arch, args:
|
|
1076
|
+
def _match(cls, arch, args: list, sp_delta):
|
|
1077
1077
|
if cls.ARCH is not None and not isinstance(
|
|
1078
1078
|
arch, cls.ARCH
|
|
1079
1079
|
): # pylint:disable=isinstance-second-argument-not-valid-type
|
|
@@ -1103,7 +1103,7 @@ class SimCC:
|
|
|
1103
1103
|
|
|
1104
1104
|
@staticmethod
|
|
1105
1105
|
def find_cc(
|
|
1106
|
-
arch: "archinfo.Arch", args:
|
|
1106
|
+
arch: "archinfo.Arch", args: list[SimFunctionArgument], sp_delta: int, platform: str = "Linux"
|
|
1107
1107
|
) -> Optional["SimCC"]:
|
|
1108
1108
|
"""
|
|
1109
1109
|
Pinpoint the best-fit calling convention and return the corresponding SimCC instance, or None if no fit is
|
|
@@ -1472,7 +1472,7 @@ class SimCCSystemVAMD64(SimCC):
|
|
|
1472
1472
|
|
|
1473
1473
|
return refine_locs_with_struct_type(self.arch, mapped_classes, arg_type)
|
|
1474
1474
|
|
|
1475
|
-
def return_val(self, ty:
|
|
1475
|
+
def return_val(self, ty: SimType | None, perspective_returned=False):
|
|
1476
1476
|
if ty is None:
|
|
1477
1477
|
return None
|
|
1478
1478
|
if ty._arch is None:
|
|
@@ -1552,8 +1552,8 @@ class SimCCSystemVAMD64(SimCC):
|
|
|
1552
1552
|
else:
|
|
1553
1553
|
raise NotImplementedError("Ummmmm... not sure what goes here. report bug to @rhelmot")
|
|
1554
1554
|
|
|
1555
|
-
def _flatten(self, ty) ->
|
|
1556
|
-
result:
|
|
1555
|
+
def _flatten(self, ty) -> dict[int, list[SimType]] | None:
|
|
1556
|
+
result: dict[int, list[SimType]] = defaultdict(list)
|
|
1557
1557
|
if isinstance(ty, SimStruct):
|
|
1558
1558
|
if ty.packed:
|
|
1559
1559
|
return None
|
|
@@ -1733,8 +1733,8 @@ class SimCCARM(SimCC):
|
|
|
1733
1733
|
return "INTEGER"
|
|
1734
1734
|
return "SSE"
|
|
1735
1735
|
|
|
1736
|
-
def _flatten(self, ty) ->
|
|
1737
|
-
result:
|
|
1736
|
+
def _flatten(self, ty) -> dict[int, list[SimType]] | None:
|
|
1737
|
+
result: dict[int, list[SimType]] = defaultdict(list)
|
|
1738
1738
|
if isinstance(ty, SimStruct):
|
|
1739
1739
|
if ty.packed:
|
|
1740
1740
|
return None
|
|
@@ -1957,8 +1957,8 @@ class SimCCO32(SimCC):
|
|
|
1957
1957
|
return "INTEGER"
|
|
1958
1958
|
return "SSE"
|
|
1959
1959
|
|
|
1960
|
-
def _flatten(self, ty) ->
|
|
1961
|
-
result:
|
|
1960
|
+
def _flatten(self, ty) -> dict[int, list[SimType]] | None:
|
|
1961
|
+
result: dict[int, list[SimType]] = defaultdict(list)
|
|
1962
1962
|
if isinstance(ty, SimStruct):
|
|
1963
1963
|
if ty.packed:
|
|
1964
1964
|
return None
|
|
@@ -2049,6 +2049,7 @@ class SimCCPowerPC(SimCC):
|
|
|
2049
2049
|
STACKARG_SP_BUFF = 8
|
|
2050
2050
|
RETURN_ADDR = SimRegArg("lr", 4)
|
|
2051
2051
|
RETURN_VAL = SimRegArg("r3", 4)
|
|
2052
|
+
OVERFLOW_RETURN_VAL = SimRegArg("r4", 4)
|
|
2052
2053
|
ARCH = archinfo.ArchPPC32
|
|
2053
2054
|
|
|
2054
2055
|
|
|
@@ -2156,7 +2157,7 @@ class SimCCS390XLinuxSyscall(SimCCSyscall):
|
|
|
2156
2157
|
return state.regs.r1
|
|
2157
2158
|
|
|
2158
2159
|
|
|
2159
|
-
CC:
|
|
2160
|
+
CC: dict[str, dict[str, list[type[SimCC]]]] = {
|
|
2160
2161
|
"AMD64": {
|
|
2161
2162
|
"default": [SimCCSystemVAMD64],
|
|
2162
2163
|
"Linux": [SimCCSystemVAMD64],
|
|
@@ -2207,7 +2208,7 @@ CC: Dict[str, Dict[str, List[Type[SimCC]]]] = {
|
|
|
2207
2208
|
}
|
|
2208
2209
|
|
|
2209
2210
|
|
|
2210
|
-
DEFAULT_CC:
|
|
2211
|
+
DEFAULT_CC: dict[str, dict[str, type[SimCC]]] = {
|
|
2211
2212
|
"AMD64": {"Linux": SimCCSystemVAMD64, "Win32": SimCCMicrosoftAMD64},
|
|
2212
2213
|
"X86": {"Linux": SimCCCdecl, "CGC": SimCCCdecl, "Win32": SimCCMicrosoftCdecl},
|
|
2213
2214
|
"ARMEL": {"Linux": SimCCARM},
|
|
@@ -2225,7 +2226,7 @@ DEFAULT_CC: Dict[str, Dict[str, Type[SimCC]]] = {
|
|
|
2225
2226
|
}
|
|
2226
2227
|
|
|
2227
2228
|
|
|
2228
|
-
def register_default_cc(arch: str, cc:
|
|
2229
|
+
def register_default_cc(arch: str, cc: type[SimCC], platform: str = "Linux"):
|
|
2229
2230
|
DEFAULT_CC[arch] = {platform: cc}
|
|
2230
2231
|
if arch not in CC:
|
|
2231
2232
|
CC[arch] = {}
|
|
@@ -2263,11 +2264,11 @@ for k, vs in ARCH_NAME_ALIASES.items():
|
|
|
2263
2264
|
|
|
2264
2265
|
def default_cc( # pylint:disable=unused-argument
|
|
2265
2266
|
arch: str,
|
|
2266
|
-
platform:
|
|
2267
|
-
language:
|
|
2267
|
+
platform: str | None = "Linux",
|
|
2268
|
+
language: str | None = None,
|
|
2268
2269
|
syscall: bool = False,
|
|
2269
2270
|
**kwargs,
|
|
2270
|
-
) ->
|
|
2271
|
+
) -> type[SimCC] | None:
|
|
2271
2272
|
"""
|
|
2272
2273
|
Return the default calling convention for a given architecture, platform, and language combination.
|
|
2273
2274
|
|
|
@@ -2318,7 +2319,7 @@ def unify_arch_name(arch: str) -> str:
|
|
|
2318
2319
|
return ALIAS_TO_ARCH_NAME.get(arch, arch)
|
|
2319
2320
|
|
|
2320
2321
|
|
|
2321
|
-
SYSCALL_CC:
|
|
2322
|
+
SYSCALL_CC: dict[str, dict[str, type[SimCCSyscall]]] = {
|
|
2322
2323
|
"X86": {
|
|
2323
2324
|
"default": SimCCX86LinuxSyscall,
|
|
2324
2325
|
"Linux": SimCCX86LinuxSyscall,
|
angr/code_location.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Any
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class CodeLocation:
|
|
@@ -21,9 +21,9 @@ class CodeLocation:
|
|
|
21
21
|
def __init__(
|
|
22
22
|
self,
|
|
23
23
|
block_addr: int,
|
|
24
|
-
stmt_idx:
|
|
24
|
+
stmt_idx: int | None,
|
|
25
25
|
sim_procedure=None,
|
|
26
|
-
ins_addr:
|
|
26
|
+
ins_addr: int | None = None,
|
|
27
27
|
context: Any = None,
|
|
28
28
|
block_idx: int = None,
|
|
29
29
|
**kwargs,
|
|
@@ -42,14 +42,14 @@ class CodeLocation:
|
|
|
42
42
|
"""
|
|
43
43
|
|
|
44
44
|
self.block_addr: int = block_addr
|
|
45
|
-
self.stmt_idx:
|
|
45
|
+
self.stmt_idx: int | None = stmt_idx
|
|
46
46
|
self.sim_procedure = sim_procedure
|
|
47
|
-
self.ins_addr:
|
|
48
|
-
self.context:
|
|
47
|
+
self.ins_addr: int | None = ins_addr
|
|
48
|
+
self.context: tuple[int] | None = context
|
|
49
49
|
self.block_idx = block_idx
|
|
50
50
|
self._hash = None
|
|
51
51
|
|
|
52
|
-
self.info:
|
|
52
|
+
self.info: dict | None = None
|
|
53
53
|
|
|
54
54
|
if kwargs:
|
|
55
55
|
self._store_kwargs(**kwargs)
|
|
@@ -152,7 +152,7 @@ class ExternalCodeLocation(CodeLocation):
|
|
|
152
152
|
|
|
153
153
|
__slots__ = ("call_string",)
|
|
154
154
|
|
|
155
|
-
def __init__(self, call_string:
|
|
155
|
+
def __init__(self, call_string: tuple[int, ...] | None = None):
|
|
156
156
|
super().__init__(0, None)
|
|
157
157
|
self.call_string = call_string if call_string is not None else ()
|
|
158
158
|
|
angr/codenode.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from typing import List
|
|
3
2
|
|
|
4
3
|
l = logging.getLogger(name=__name__)
|
|
5
4
|
|
|
@@ -46,7 +45,7 @@ class CodeNode:
|
|
|
46
45
|
self._hash = hash((self.addr, self.size))
|
|
47
46
|
return self._hash
|
|
48
47
|
|
|
49
|
-
def successors(self) ->
|
|
48
|
+
def successors(self) -> list["CodeNode"]:
|
|
50
49
|
if self._graph is None:
|
|
51
50
|
raise ValueError("Cannot calculate successors for graphless node")
|
|
52
51
|
return list(self._graph.successors(self))
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
|
|
3
1
|
from ..errors import SimSolverError
|
|
4
2
|
from . import SimConcretizationStrategy
|
|
5
3
|
|
|
@@ -9,7 +7,7 @@ class SimConcretizationStrategyMax(SimConcretizationStrategy):
|
|
|
9
7
|
Concretization strategy that returns the maximum address.
|
|
10
8
|
"""
|
|
11
9
|
|
|
12
|
-
def __init__(self, max_addr:
|
|
10
|
+
def __init__(self, max_addr: int | None = None):
|
|
13
11
|
super().__init__()
|
|
14
12
|
self._max_addr = max_addr
|
|
15
13
|
|
angr/distributed/server.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import Dict, Tuple
|
|
2
|
-
|
|
3
1
|
import logging
|
|
4
2
|
import time
|
|
5
3
|
import os
|
|
@@ -63,7 +61,7 @@ class Server:
|
|
|
63
61
|
self._recursion_limit = recursion_limit
|
|
64
62
|
|
|
65
63
|
self._worker_exit_args_lock = None
|
|
66
|
-
self._worker_exit_args:
|
|
64
|
+
self._worker_exit_args: dict[int, tuple] = None
|
|
67
65
|
|
|
68
66
|
# the following will not be pickled
|
|
69
67
|
self._worker_exit_callback = worker_exit_callback
|
angr/distributed/worker.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from typing import Dict
|
|
2
1
|
import time
|
|
3
2
|
import multiprocessing
|
|
4
3
|
import logging
|
|
@@ -42,7 +41,7 @@ class ExplorationStatusNotifier(ExplorationTechnique):
|
|
|
42
41
|
Force the exploration to stop if the server.stop is True.
|
|
43
42
|
"""
|
|
44
43
|
|
|
45
|
-
def __init__(self, server_state:
|
|
44
|
+
def __init__(self, server_state: dict):
|
|
46
45
|
super().__init__()
|
|
47
46
|
self.server_state = server_state
|
|
48
47
|
|
angr/engines/engine.py
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import abc
|
|
4
4
|
import logging
|
|
5
5
|
import threading
|
|
6
|
-
from typing import Optional
|
|
7
6
|
import angr
|
|
8
7
|
|
|
9
8
|
from archinfo.arch_soot import SootAddressDescriptor
|
|
@@ -20,7 +19,7 @@ class SimEngineBase:
|
|
|
20
19
|
def __init__(self, project=None, **kwargs):
|
|
21
20
|
if kwargs:
|
|
22
21
|
raise TypeError("Unused initializer args: " + ", ".join(kwargs.keys()))
|
|
23
|
-
self.project:
|
|
22
|
+
self.project: angr.Project | None = project
|
|
24
23
|
self.state = None
|
|
25
24
|
|
|
26
25
|
__tls = ("state",)
|
|
@@ -107,7 +106,7 @@ class SuccessorsMixin(SimEngine):
|
|
|
107
106
|
def __init__(self, *args, **kwargs):
|
|
108
107
|
super().__init__(*args, **kwargs)
|
|
109
108
|
|
|
110
|
-
self.successors:
|
|
109
|
+
self.successors: SimSuccessors | None = None
|
|
111
110
|
|
|
112
111
|
__tls = ("successors",)
|
|
113
112
|
|
angr/engines/light/engine.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# pylint:disable=no-self-use,isinstance-second-argument-not-valid-type,unused-argument
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Any
|
|
3
3
|
import struct
|
|
4
4
|
import re
|
|
5
5
|
import logging
|
|
@@ -23,7 +23,7 @@ class SimEngineLightMixin:
|
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
def __init__(self, *args, logger=None, **kwargs):
|
|
26
|
-
self.arch:
|
|
26
|
+
self.arch: archinfo.Arch | None = None
|
|
27
27
|
self.l = logger
|
|
28
28
|
super().__init__(*args, **kwargs)
|
|
29
29
|
|
|
@@ -53,7 +53,7 @@ class SimEngineLightMixin:
|
|
|
53
53
|
return base
|
|
54
54
|
|
|
55
55
|
@staticmethod
|
|
56
|
-
def extract_offset_to_sp(spoffset_expr: claripy.ast.Base) ->
|
|
56
|
+
def extract_offset_to_sp(spoffset_expr: claripy.ast.Base) -> int | None:
|
|
57
57
|
"""
|
|
58
58
|
Extract the offset to the original stack pointer.
|
|
59
59
|
|
|
@@ -485,7 +485,7 @@ class SimEngineLightVEXMixin(SimEngineLightMixin):
|
|
|
485
485
|
# Binary operation handlers
|
|
486
486
|
#
|
|
487
487
|
|
|
488
|
-
def _binop_get_args(self, expr) ->
|
|
488
|
+
def _binop_get_args(self, expr) -> tuple[Any, Any] | None | Any | None:
|
|
489
489
|
arg0, arg1 = expr.args
|
|
490
490
|
expr_0 = self._expr(arg0)
|
|
491
491
|
if expr_0 is None:
|
angr/engines/pcode/behavior.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import operator
|
|
2
|
-
from
|
|
2
|
+
from collections.abc import Callable, Iterable
|
|
3
3
|
|
|
4
4
|
import claripy
|
|
5
5
|
from claripy.ast.bv import BV
|
|
@@ -14,7 +14,7 @@ except ImportError:
|
|
|
14
14
|
# pylint:disable=abstract-method
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
def make_bv_sizes_equal(bv1: BV, bv2: BV) ->
|
|
17
|
+
def make_bv_sizes_equal(bv1: BV, bv2: BV) -> tuple[BV, BV]:
|
|
18
18
|
"""
|
|
19
19
|
Makes two BVs equal in length through sign extension.
|
|
20
20
|
"""
|
|
@@ -886,6 +886,23 @@ class OpBehaviorPopcount(OpBehavior):
|
|
|
886
886
|
return expr
|
|
887
887
|
|
|
888
888
|
|
|
889
|
+
class OpBehaviorLzcount(OpBehavior):
|
|
890
|
+
"""
|
|
891
|
+
Behavior for the LZCOUNT operation.
|
|
892
|
+
"""
|
|
893
|
+
|
|
894
|
+
def __init__(self):
|
|
895
|
+
super().__init__(OpCode.LZCOUNT, True)
|
|
896
|
+
|
|
897
|
+
def evaluate_unary(self, size_out: int, size_in: int, in1: BV) -> BV:
|
|
898
|
+
expr = claripy.BVV(len(in1), size_out * 8)
|
|
899
|
+
for pos in range(len(in1)):
|
|
900
|
+
expr = claripy.If(
|
|
901
|
+
claripy.Extract(pos, pos, in1) == claripy.BVV(1, 1), claripy.BVV(len(in1) - pos - 1, size_out * 8), expr
|
|
902
|
+
)
|
|
903
|
+
return expr
|
|
904
|
+
|
|
905
|
+
|
|
889
906
|
class BehaviorFactory:
|
|
890
907
|
"""
|
|
891
908
|
Returns the behavior object for a given opcode.
|
|
@@ -973,5 +990,6 @@ class BehaviorFactory:
|
|
|
973
990
|
OpCode.INSERT: OpBehavior(OpCode.INSERT, False, True),
|
|
974
991
|
OpCode.EXTRACT: OpBehavior(OpCode.EXTRACT, False, True),
|
|
975
992
|
OpCode.POPCOUNT: OpBehaviorPopcount(),
|
|
993
|
+
OpCode.LZCOUNT: OpBehaviorLzcount(),
|
|
976
994
|
}
|
|
977
995
|
)
|
angr/engines/pcode/emulate.py
CHANGED
|
@@ -27,7 +27,7 @@ class PcodeEmulatorMixin(SimEngineBase):
|
|
|
27
27
|
|
|
28
28
|
_current_op: Optional["PcodeOp"]
|
|
29
29
|
_current_op_idx: int
|
|
30
|
-
_current_behavior:
|
|
30
|
+
_current_behavior: OpBehavior | None
|
|
31
31
|
|
|
32
32
|
def __init__(self, *args, **kwargs):
|
|
33
33
|
super().__init__(*args, **kwargs)
|
angr/engines/pcode/engine.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from
|
|
1
|
+
from collections.abc import Iterable
|
|
2
2
|
|
|
3
3
|
import claripy
|
|
4
4
|
import logging
|
|
@@ -50,13 +50,13 @@ class HeavyPcodeMixin(
|
|
|
50
50
|
def process_successors(
|
|
51
51
|
self,
|
|
52
52
|
successors: SimSuccessors,
|
|
53
|
-
irsb:
|
|
54
|
-
insn_text:
|
|
55
|
-
insn_bytes:
|
|
53
|
+
irsb: IRSB | None = None,
|
|
54
|
+
insn_text: str | None = None,
|
|
55
|
+
insn_bytes: bytes | None = None,
|
|
56
56
|
thumb: bool = False,
|
|
57
|
-
size:
|
|
58
|
-
num_inst:
|
|
59
|
-
extra_stop_points:
|
|
57
|
+
size: int | None = None,
|
|
58
|
+
num_inst: int | None = None,
|
|
59
|
+
extra_stop_points: Iterable[int] | None = None,
|
|
60
60
|
**kwargs,
|
|
61
61
|
) -> None:
|
|
62
62
|
# pylint:disable=arguments-differ
|