angr 9.2.117__py3-none-win_amd64.whl → 9.2.118__py3-none-win_amd64.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 +2 -1
- angr/__main__.py +21 -1
- angr/analyses/__init__.py +4 -0
- angr/analyses/analysis.py +45 -45
- angr/analyses/backward_slice.py +15 -18
- angr/analyses/binary_optimizer.py +29 -34
- angr/analyses/bindiff.py +35 -44
- angr/analyses/boyscout.py +1 -0
- angr/analyses/callee_cleanup_finder.py +3 -4
- angr/analyses/calling_convention.py +98 -98
- angr/analyses/cdg.py +5 -12
- angr/analyses/cfg/__init__.py +1 -0
- angr/analyses/cfg/cfb.py +14 -20
- angr/analyses/cfg/cfg.py +2 -1
- angr/analyses/cfg/cfg_arch_options.py +4 -1
- angr/analyses/cfg/cfg_base.py +122 -165
- angr/analyses/cfg/cfg_emulated.py +60 -92
- angr/analyses/cfg/cfg_fast.py +273 -314
- angr/analyses/cfg/cfg_fast_soot.py +10 -17
- angr/analyses/cfg/cfg_job_base.py +6 -7
- angr/analyses/cfg/indirect_jump_resolvers/__init__.py +1 -0
- angr/analyses/cfg/indirect_jump_resolvers/amd64_elf_got.py +2 -3
- angr/analyses/cfg/indirect_jump_resolvers/amd64_pe_iat.py +2 -3
- angr/analyses/cfg/indirect_jump_resolvers/arm_elf_fast.py +6 -8
- angr/analyses/cfg/indirect_jump_resolvers/const_resolver.py +3 -5
- angr/analyses/cfg/indirect_jump_resolvers/default_resolvers.py +1 -0
- angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +97 -112
- angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py +26 -32
- angr/analyses/cfg/indirect_jump_resolvers/propagator_utils.py +1 -0
- angr/analyses/cfg/indirect_jump_resolvers/resolver.py +7 -7
- angr/analyses/cfg/indirect_jump_resolvers/x86_elf_pic_plt.py +3 -8
- angr/analyses/cfg/indirect_jump_resolvers/x86_pe_iat.py +2 -3
- angr/analyses/cfg_slice_to_sink/__init__.py +1 -0
- angr/analyses/cfg_slice_to_sink/cfg_slice_to_sink.py +4 -4
- angr/analyses/cfg_slice_to_sink/graph.py +4 -1
- angr/analyses/cfg_slice_to_sink/transitions.py +4 -2
- angr/analyses/class_identifier.py +1 -0
- angr/analyses/code_tagging.py +9 -9
- angr/analyses/complete_calling_conventions.py +28 -36
- angr/analyses/congruency_check.py +6 -11
- angr/analyses/data_dep/__init__.py +1 -0
- angr/analyses/data_dep/data_dependency_analysis.py +38 -48
- angr/analyses/data_dep/dep_nodes.py +13 -12
- angr/analyses/data_dep/sim_act_location.py +3 -0
- angr/analyses/datagraph_meta.py +7 -7
- angr/analyses/ddg.py +48 -69
- angr/analyses/decompiler/__init__.py +3 -0
- angr/analyses/decompiler/ail_simplifier.py +929 -400
- angr/analyses/decompiler/ailgraph_walker.py +1 -0
- angr/analyses/decompiler/block_io_finder.py +13 -4
- angr/analyses/decompiler/block_similarity.py +28 -18
- angr/analyses/decompiler/block_simplifier.py +40 -104
- angr/analyses/decompiler/callsite_maker.py +124 -82
- angr/analyses/decompiler/ccall_rewriters/__init__.py +1 -0
- angr/analyses/decompiler/ccall_rewriters/amd64_ccalls.py +115 -105
- angr/analyses/decompiler/ccall_rewriters/rewriter_base.py +2 -1
- angr/analyses/decompiler/clinic.py +348 -172
- angr/analyses/decompiler/condition_processor.py +86 -100
- angr/analyses/decompiler/counters/__init__.py +5 -0
- angr/analyses/decompiler/counters/boolean_counter.py +27 -0
- angr/analyses/decompiler/{call_counter.py → counters/call_counter.py} +5 -4
- angr/analyses/decompiler/{expression_counters.py → counters/expression_counters.py} +5 -4
- angr/analyses/decompiler/counters/seq_cf_structure_counter.py +63 -0
- angr/analyses/decompiler/decompilation_cache.py +2 -1
- angr/analyses/decompiler/decompilation_options.py +1 -0
- angr/analyses/decompiler/decompiler.py +47 -27
- angr/analyses/decompiler/dephication/__init__.py +6 -0
- angr/analyses/decompiler/dephication/dephication_base.py +87 -0
- angr/analyses/decompiler/dephication/graph_dephication.py +63 -0
- angr/analyses/decompiler/dephication/graph_rewriting.py +116 -0
- angr/analyses/decompiler/dephication/graph_vvar_mapping.py +313 -0
- angr/analyses/decompiler/dephication/rewriting_engine.py +247 -0
- angr/analyses/decompiler/dephication/seqnode_dephication.py +106 -0
- angr/analyses/decompiler/empty_node_remover.py +1 -0
- angr/analyses/decompiler/expression_narrower.py +12 -17
- angr/analyses/decompiler/goto_manager.py +43 -4
- angr/analyses/decompiler/graph_region.py +19 -31
- angr/analyses/decompiler/jump_target_collector.py +1 -0
- angr/analyses/decompiler/jumptable_entry_condition_rewriter.py +1 -0
- angr/analyses/decompiler/optimization_passes/__init__.py +7 -3
- angr/analyses/decompiler/optimization_passes/base_ptr_save_simplifier.py +23 -18
- angr/analyses/decompiler/optimization_passes/call_stmt_rewriter.py +46 -0
- angr/analyses/decompiler/optimization_passes/code_motion.py +4 -2
- angr/analyses/decompiler/optimization_passes/const_derefs.py +36 -36
- angr/analyses/decompiler/optimization_passes/const_prop_reverter.py +6 -9
- angr/analyses/decompiler/optimization_passes/cross_jump_reverter.py +4 -3
- angr/analyses/decompiler/optimization_passes/deadblock_remover.py +1 -0
- angr/analyses/decompiler/optimization_passes/div_simplifier.py +78 -72
- angr/analyses/decompiler/optimization_passes/duplication_reverter/__init__.py +2 -0
- angr/analyses/decompiler/optimization_passes/duplication_reverter/ail_merge_graph.py +500 -0
- angr/analyses/decompiler/optimization_passes/duplication_reverter/duplication_reverter.py +1211 -0
- angr/analyses/decompiler/optimization_passes/duplication_reverter/errors.py +16 -0
- angr/analyses/decompiler/optimization_passes/duplication_reverter/similarity.py +126 -0
- angr/analyses/decompiler/optimization_passes/duplication_reverter/utils.py +169 -0
- angr/analyses/decompiler/optimization_passes/engine_base.py +60 -63
- angr/analyses/decompiler/optimization_passes/expr_op_swapper.py +6 -7
- angr/analyses/decompiler/optimization_passes/flip_boolean_cmp.py +1 -0
- angr/analyses/decompiler/optimization_passes/inlined_string_transformation_simplifier.py +88 -23
- angr/analyses/decompiler/optimization_passes/ite_expr_converter.py +8 -10
- angr/analyses/decompiler/optimization_passes/ite_region_converter.py +128 -18
- angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py +142 -145
- angr/analyses/decompiler/optimization_passes/mod_simplifier.py +27 -23
- angr/analyses/decompiler/optimization_passes/multi_simplifier.py +30 -34
- angr/analyses/decompiler/optimization_passes/optimization_pass.py +108 -47
- angr/analyses/decompiler/optimization_passes/register_save_area_simplifier.py +10 -3
- angr/analyses/decompiler/optimization_passes/ret_addr_save_simplifier.py +5 -6
- angr/analyses/decompiler/optimization_passes/ret_deduplicator.py +3 -2
- angr/analyses/decompiler/optimization_passes/return_duplicator_base.py +125 -13
- angr/analyses/decompiler/optimization_passes/return_duplicator_high.py +1 -0
- angr/analyses/decompiler/optimization_passes/return_duplicator_low.py +3 -2
- angr/analyses/decompiler/optimization_passes/stack_canary_simplifier.py +52 -21
- angr/analyses/decompiler/optimization_passes/switch_default_case_duplicator.py +3 -2
- angr/analyses/decompiler/optimization_passes/win_stack_canary_simplifier.py +47 -36
- angr/analyses/decompiler/optimization_passes/x86_gcc_getpc_simplifier.py +2 -1
- angr/analyses/decompiler/peephole_optimizations/__init__.py +2 -0
- angr/analyses/decompiler/peephole_optimizations/a_div_const_add_a_mul_n_div_const.py +26 -22
- angr/analyses/decompiler/peephole_optimizations/a_mul_const_div_shr_const.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/a_shl_const_sub_a.py +1 -0
- angr/analyses/decompiler/peephole_optimizations/a_sub_a_div.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/a_sub_a_div_const_mul_const.py +1 -0
- angr/analyses/decompiler/peephole_optimizations/a_sub_a_sub_n.py +8 -4
- angr/analyses/decompiler/peephole_optimizations/arm_cmpf.py +28 -27
- angr/analyses/decompiler/peephole_optimizations/base.py +17 -20
- angr/analyses/decompiler/peephole_optimizations/basepointeroffset_add_n.py +1 -0
- angr/analyses/decompiler/peephole_optimizations/basepointeroffset_and_mask.py +1 -0
- angr/analyses/decompiler/peephole_optimizations/bitwise_or_to_logical_or.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/bool_expr_xor_1.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/bswap.py +29 -22
- angr/analyses/decompiler/peephole_optimizations/cmpord_rewriter.py +3 -4
- angr/analyses/decompiler/peephole_optimizations/coalesce_adjacent_shrs.py +39 -0
- angr/analyses/decompiler/peephole_optimizations/coalesce_same_cascading_ifs.py +2 -1
- angr/analyses/decompiler/peephole_optimizations/const_mull_a_shift.py +94 -29
- angr/analyses/decompiler/peephole_optimizations/constant_derefs.py +1 -0
- angr/analyses/decompiler/peephole_optimizations/conv_a_sub0_shr_and.py +48 -49
- angr/analyses/decompiler/peephole_optimizations/conv_shl_shr.py +1 -0
- angr/analyses/decompiler/peephole_optimizations/eager_eval.py +41 -34
- angr/analyses/decompiler/peephole_optimizations/extended_byte_and_mask.py +2 -1
- angr/analyses/decompiler/peephole_optimizations/inlined_strcpy.py +28 -18
- angr/analyses/decompiler/peephole_optimizations/inlined_strcpy_consolidation.py +8 -4
- angr/analyses/decompiler/peephole_optimizations/inlined_wstrcpy.py +28 -18
- angr/analyses/decompiler/peephole_optimizations/invert_negated_logical_conjuction_disjunction.py +32 -32
- angr/analyses/decompiler/peephole_optimizations/one_sub_bool.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/remove_cascading_conversions.py +23 -3
- angr/analyses/decompiler/peephole_optimizations/remove_empty_if_body.py +2 -1
- angr/analyses/decompiler/peephole_optimizations/remove_noop_conversions.py +4 -0
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_bitmasks.py +1 -0
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_conversions.py +4 -6
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_ite_branch.py +14 -13
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_ite_comparisons.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_nots.py +1 -0
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_reinterprets.py +3 -2
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_shifts.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_shifts_around_comparators.py +20 -16
- angr/analyses/decompiler/peephole_optimizations/rewrite_bit_extractions.py +3 -3
- angr/analyses/decompiler/peephole_optimizations/rewrite_mips_gp_loads.py +4 -2
- angr/analyses/decompiler/peephole_optimizations/rol_ror.py +66 -40
- angr/analyses/decompiler/peephole_optimizations/sar_to_signed_div.py +64 -57
- angr/analyses/decompiler/peephole_optimizations/simplify_pc_relative_loads.py +14 -14
- angr/analyses/decompiler/peephole_optimizations/single_bit_cond_to_boolexpr.py +1 -0
- angr/analyses/decompiler/peephole_optimizations/single_bit_xor.py +8 -5
- angr/analyses/decompiler/peephole_optimizations/tidy_stack_addr.py +4 -6
- angr/analyses/decompiler/redundant_label_remover.py +20 -19
- angr/analyses/decompiler/region_identifier.py +64 -77
- angr/analyses/decompiler/region_simplifiers/__init__.py +1 -0
- angr/analyses/decompiler/region_simplifiers/cascading_cond_transformer.py +2 -1
- angr/analyses/decompiler/region_simplifiers/cascading_ifs.py +1 -0
- angr/analyses/decompiler/region_simplifiers/expr_folding.py +43 -29
- angr/analyses/decompiler/region_simplifiers/goto.py +1 -0
- angr/analyses/decompiler/region_simplifiers/if_.py +29 -36
- angr/analyses/decompiler/region_simplifiers/ifelse.py +1 -0
- angr/analyses/decompiler/region_simplifiers/loop.py +27 -13
- angr/analyses/decompiler/region_simplifiers/node_address_finder.py +1 -0
- angr/analyses/decompiler/region_simplifiers/region_simplifier.py +1 -0
- angr/analyses/decompiler/region_simplifiers/switch_cluster_simplifier.py +12 -16
- angr/analyses/decompiler/region_simplifiers/switch_expr_simplifier.py +36 -32
- angr/analyses/decompiler/region_walker.py +1 -0
- angr/analyses/decompiler/return_maker.py +1 -0
- angr/analyses/decompiler/seq_to_blocks.py +1 -0
- angr/analyses/decompiler/sequence_walker.py +5 -10
- angr/analyses/decompiler/ssailification/__init__.py +4 -0
- angr/analyses/decompiler/ssailification/rewriting.py +325 -0
- angr/analyses/decompiler/ssailification/rewriting_engine.py +601 -0
- angr/analyses/decompiler/ssailification/rewriting_state.py +60 -0
- angr/analyses/decompiler/ssailification/ssailification.py +213 -0
- angr/analyses/decompiler/ssailification/traversal.py +97 -0
- angr/analyses/decompiler/ssailification/traversal_engine.py +131 -0
- angr/analyses/decompiler/ssailification/traversal_state.py +42 -0
- angr/analyses/decompiler/structured_codegen/__init__.py +1 -0
- angr/analyses/decompiler/structured_codegen/base.py +2 -2
- angr/analyses/decompiler/structured_codegen/c.py +163 -158
- angr/analyses/decompiler/structured_codegen/dummy.py +1 -0
- angr/analyses/decompiler/structured_codegen/dwarf_import.py +1 -0
- angr/analyses/decompiler/structuring/__init__.py +1 -0
- angr/analyses/decompiler/structuring/dream.py +19 -36
- angr/analyses/decompiler/structuring/phoenix.py +199 -199
- angr/analyses/decompiler/structuring/recursive_structurer.py +4 -3
- angr/analyses/decompiler/structuring/sailr.py +5 -4
- angr/analyses/decompiler/structuring/structurer_base.py +26 -23
- angr/analyses/decompiler/structuring/structurer_nodes.py +14 -24
- angr/analyses/decompiler/utils.py +112 -52
- angr/analyses/disassembly.py +75 -77
- angr/analyses/disassembly_utils.py +10 -13
- angr/analyses/dominance_frontier.py +25 -7
- angr/analyses/find_objects_static.py +3 -2
- angr/analyses/flirt.py +7 -10
- angr/analyses/forward_analysis/__init__.py +1 -0
- angr/analyses/forward_analysis/forward_analysis.py +9 -6
- angr/analyses/forward_analysis/job_info.py +3 -3
- angr/analyses/forward_analysis/visitors/__init__.py +1 -0
- angr/analyses/forward_analysis/visitors/call_graph.py +1 -0
- angr/analyses/forward_analysis/visitors/function_graph.py +3 -2
- angr/analyses/forward_analysis/visitors/graph.py +9 -9
- angr/analyses/forward_analysis/visitors/loop.py +1 -0
- angr/analyses/forward_analysis/visitors/single_node_graph.py +2 -2
- angr/analyses/identifier/__init__.py +1 -0
- angr/analyses/identifier/custom_callable.py +2 -2
- angr/analyses/identifier/errors.py +1 -0
- angr/analyses/identifier/func.py +6 -3
- angr/analyses/identifier/functions/__init__.py +2 -1
- angr/analyses/identifier/functions/atoi.py +2 -4
- angr/analyses/identifier/functions/based_atoi.py +3 -6
- angr/analyses/identifier/functions/fdprintf.py +1 -0
- angr/analyses/identifier/functions/free.py +3 -5
- angr/analyses/identifier/functions/int2str.py +11 -26
- angr/analyses/identifier/functions/malloc.py +4 -6
- angr/analyses/identifier/functions/memcmp.py +2 -4
- angr/analyses/identifier/functions/memcpy.py +2 -2
- angr/analyses/identifier/functions/memset.py +2 -2
- angr/analyses/identifier/functions/printf.py +1 -0
- angr/analyses/identifier/functions/recv_until.py +3 -6
- angr/analyses/identifier/functions/skip_calloc.py +2 -1
- angr/analyses/identifier/functions/skip_realloc.py +4 -6
- angr/analyses/identifier/functions/skip_recv_n.py +4 -6
- angr/analyses/identifier/functions/snprintf.py +2 -4
- angr/analyses/identifier/functions/sprintf.py +1 -0
- angr/analyses/identifier/functions/strcasecmp.py +1 -0
- angr/analyses/identifier/functions/strcmp.py +2 -1
- angr/analyses/identifier/functions/strcpy.py +2 -2
- angr/analyses/identifier/functions/strlen.py +1 -0
- angr/analyses/identifier/functions/strncmp.py +2 -1
- angr/analyses/identifier/functions/strncpy.py +2 -2
- angr/analyses/identifier/functions/strtol.py +2 -4
- angr/analyses/identifier/identify.py +35 -54
- angr/analyses/identifier/runner.py +6 -5
- angr/analyses/init_finder.py +17 -17
- angr/analyses/loop_analysis.py +10 -14
- angr/analyses/loopfinder.py +9 -13
- angr/analyses/propagator/__init__.py +1 -0
- angr/analyses/propagator/engine_ail.py +159 -165
- angr/analyses/propagator/engine_base.py +3 -2
- angr/analyses/propagator/engine_vex.py +47 -48
- angr/analyses/propagator/outdated_definition_walker.py +18 -23
- angr/analyses/propagator/propagator.py +8 -12
- angr/analyses/propagator/tmpvar_finder.py +1 -0
- angr/analyses/propagator/top_checker_mixin.py +2 -4
- angr/analyses/propagator/values.py +1 -0
- angr/analyses/propagator/vex_vars.py +3 -2
- angr/analyses/proximity_graph.py +12 -20
- angr/analyses/reaching_definitions/__init__.py +5 -4
- angr/analyses/reaching_definitions/call_trace.py +7 -6
- angr/analyses/reaching_definitions/dep_graph.py +18 -23
- angr/analyses/reaching_definitions/engine_ail.py +89 -121
- angr/analyses/reaching_definitions/engine_vex.py +20 -32
- angr/analyses/reaching_definitions/function_handler.py +32 -33
- angr/analyses/reaching_definitions/function_handler_library/__init__.py +1 -0
- angr/analyses/reaching_definitions/function_handler_library/stdio.py +4 -6
- angr/analyses/reaching_definitions/function_handler_library/stdlib.py +1 -2
- angr/analyses/reaching_definitions/function_handler_library/string.py +2 -4
- angr/analyses/reaching_definitions/function_handler_library/unistd.py +1 -0
- angr/analyses/reaching_definitions/heap_allocator.py +7 -6
- angr/analyses/reaching_definitions/rd_initializer.py +27 -25
- angr/analyses/reaching_definitions/rd_state.py +14 -16
- angr/analyses/reaching_definitions/reaching_definitions.py +27 -36
- angr/analyses/reaching_definitions/subject.py +3 -2
- angr/analyses/reassembler.py +189 -253
- angr/analyses/s_liveness/__init__.py +2 -0
- angr/analyses/s_liveness/s_liveness.py +153 -0
- angr/analyses/s_propagator/__init__.py +2 -0
- angr/analyses/s_propagator/s_propagator.py +250 -0
- angr/analyses/s_reaching_definitions/__init__.py +2 -0
- angr/analyses/s_reaching_definitions/s_rda.py +479 -0
- angr/analyses/soot_class_hierarchy.py +15 -24
- angr/analyses/stack_pointer_tracker.py +83 -93
- angr/analyses/static_hooker.py +3 -2
- angr/analyses/typehoon/__init__.py +1 -0
- angr/analyses/typehoon/dfa.py +5 -5
- angr/analyses/typehoon/lifter.py +5 -4
- angr/analyses/typehoon/simple_solver.py +80 -64
- angr/analyses/typehoon/translator.py +7 -14
- angr/analyses/typehoon/typeconsts.py +14 -12
- angr/analyses/typehoon/typehoon.py +8 -10
- angr/analyses/typehoon/typevars.py +37 -49
- angr/analyses/typehoon/variance.py +1 -0
- angr/analyses/variable_recovery/__init__.py +1 -0
- angr/analyses/variable_recovery/annotations.py +1 -0
- angr/analyses/variable_recovery/engine_ail.py +78 -32
- angr/analyses/variable_recovery/engine_base.py +233 -59
- angr/analyses/variable_recovery/engine_vex.py +10 -11
- angr/analyses/variable_recovery/irsb_scanner.py +1 -0
- angr/analyses/variable_recovery/variable_recovery.py +14 -16
- angr/analyses/variable_recovery/variable_recovery_base.py +12 -14
- angr/analyses/variable_recovery/variable_recovery_fast.py +67 -47
- angr/analyses/veritesting.py +10 -16
- angr/analyses/vfg.py +102 -148
- angr/analyses/vsa_ddg.py +3 -5
- angr/analyses/vtable.py +6 -6
- angr/analyses/xrefs.py +9 -13
- angr/angrdb/__init__.py +4 -2
- angr/angrdb/db.py +51 -53
- angr/angrdb/models.py +1 -0
- angr/angrdb/serializers/__init__.py +1 -0
- angr/angrdb/serializers/cfg_model.py +2 -2
- angr/angrdb/serializers/comments.py +1 -0
- angr/angrdb/serializers/funcs.py +4 -3
- angr/angrdb/serializers/kb.py +3 -2
- angr/angrdb/serializers/labels.py +1 -0
- angr/angrdb/serializers/structured_code.py +5 -10
- angr/angrdb/serializers/variables.py +6 -6
- angr/angrdb/serializers/xrefs.py +2 -2
- angr/annocfg.py +17 -25
- angr/blade.py +19 -23
- angr/block.py +11 -13
- angr/callable.py +4 -3
- angr/calling_conventions.py +79 -124
- angr/code_location.py +12 -13
- angr/codenode.py +2 -1
- angr/concretization_strategies/__init__.py +6 -6
- angr/concretization_strategies/any.py +5 -4
- angr/concretization_strategies/any_named.py +1 -0
- angr/concretization_strategies/controlled_data.py +1 -0
- angr/concretization_strategies/eval.py +2 -2
- angr/concretization_strategies/logging.py +1 -0
- angr/concretization_strategies/max.py +6 -6
- angr/concretization_strategies/nonzero.py +1 -0
- angr/concretization_strategies/nonzero_range.py +4 -3
- angr/concretization_strategies/norepeats.py +2 -1
- angr/concretization_strategies/norepeats_range.py +1 -0
- angr/concretization_strategies/range.py +1 -0
- angr/concretization_strategies/signed_add.py +13 -9
- angr/concretization_strategies/single.py +2 -0
- angr/concretization_strategies/solutions.py +1 -0
- angr/concretization_strategies/unlimited_range.py +1 -0
- angr/distributed/__init__.py +1 -0
- angr/distributed/server.py +2 -2
- angr/distributed/worker.py +3 -3
- angr/engines/__init__.py +1 -0
- angr/engines/concrete.py +1 -0
- angr/engines/engine.py +4 -6
- angr/engines/failure.py +2 -1
- angr/engines/hook.py +1 -0
- angr/engines/light/__init__.py +1 -0
- angr/engines/light/data.py +221 -255
- angr/engines/light/engine.py +66 -74
- angr/engines/pcode/__init__.py +1 -0
- angr/engines/pcode/behavior.py +3 -3
- angr/engines/pcode/cc.py +1 -0
- angr/engines/pcode/emulate.py +13 -16
- angr/engines/pcode/engine.py +5 -3
- angr/engines/pcode/lifter.py +62 -79
- angr/engines/procedure.py +1 -0
- angr/engines/soot/__init__.py +1 -0
- angr/engines/soot/engine.py +41 -47
- angr/engines/soot/exceptions.py +3 -0
- angr/engines/soot/expressions/__init__.py +1 -0
- angr/engines/soot/expressions/arrayref.py +1 -0
- angr/engines/soot/expressions/base.py +4 -5
- angr/engines/soot/expressions/binop.py +1 -0
- angr/engines/soot/expressions/cast.py +1 -0
- angr/engines/soot/expressions/condition.py +1 -0
- angr/engines/soot/expressions/constants.py +1 -0
- angr/engines/soot/expressions/instanceOf.py +1 -0
- angr/engines/soot/expressions/instancefieldref.py +1 -0
- angr/engines/soot/expressions/invoke.py +7 -9
- angr/engines/soot/expressions/length.py +1 -0
- angr/engines/soot/expressions/local.py +1 -0
- angr/engines/soot/expressions/new.py +1 -0
- angr/engines/soot/expressions/newArray.py +1 -0
- angr/engines/soot/expressions/newMultiArray.py +3 -3
- angr/engines/soot/expressions/paramref.py +1 -0
- angr/engines/soot/expressions/phi.py +1 -0
- angr/engines/soot/expressions/staticfieldref.py +1 -0
- angr/engines/soot/expressions/thisref.py +1 -0
- angr/engines/soot/expressions/unsupported.py +1 -0
- angr/engines/soot/field_dispatcher.py +5 -8
- angr/engines/soot/method_dispatcher.py +4 -7
- angr/engines/soot/statements/__init__.py +4 -4
- angr/engines/soot/statements/assign.py +1 -0
- angr/engines/soot/statements/base.py +6 -7
- angr/engines/soot/statements/goto.py +1 -0
- angr/engines/soot/statements/identity.py +1 -0
- angr/engines/soot/statements/if_.py +1 -0
- angr/engines/soot/statements/invoke.py +1 -0
- angr/engines/soot/statements/return_.py +1 -0
- angr/engines/soot/statements/switch.py +1 -0
- angr/engines/soot/statements/throw.py +1 -0
- angr/engines/soot/values/__init__.py +4 -2
- angr/engines/soot/values/arrayref.py +8 -10
- angr/engines/soot/values/base.py +4 -1
- angr/engines/soot/values/constants.py +1 -0
- angr/engines/soot/values/instancefieldref.py +1 -0
- angr/engines/soot/values/local.py +1 -0
- angr/engines/soot/values/paramref.py +1 -0
- angr/engines/soot/values/staticfieldref.py +1 -0
- angr/engines/soot/values/strref.py +3 -2
- angr/engines/soot/values/thisref.py +1 -0
- angr/engines/successors.py +20 -23
- angr/engines/syscall.py +9 -9
- angr/engines/unicorn.py +12 -7
- angr/engines/vex/__init__.py +1 -0
- angr/engines/vex/claripy/__init__.py +1 -0
- angr/engines/vex/claripy/ccall.py +86 -112
- angr/engines/vex/claripy/datalayer.py +12 -16
- angr/engines/vex/claripy/irop.py +85 -104
- angr/engines/vex/heavy/__init__.py +1 -0
- angr/engines/vex/heavy/actions.py +1 -0
- angr/engines/vex/heavy/concretizers.py +8 -9
- angr/engines/vex/heavy/dirty.py +6 -5
- angr/engines/vex/heavy/heavy.py +13 -12
- angr/engines/vex/heavy/inspect.py +1 -0
- angr/engines/vex/heavy/resilience.py +2 -2
- angr/engines/vex/heavy/super_fastpath.py +2 -2
- angr/engines/vex/lifter.py +28 -35
- angr/engines/vex/light/__init__.py +1 -0
- angr/engines/vex/light/light.py +2 -4
- angr/engines/vex/light/resilience.py +1 -0
- angr/engines/vex/light/slicing.py +1 -0
- angr/errors.py +2 -1
- angr/exploration_techniques/__init__.py +3 -2
- angr/exploration_techniques/bucketizer.py +2 -3
- angr/exploration_techniques/common.py +3 -3
- angr/exploration_techniques/dfs.py +1 -0
- angr/exploration_techniques/director.py +17 -19
- angr/exploration_techniques/driller_core.py +2 -5
- angr/exploration_techniques/explorer.py +7 -3
- angr/exploration_techniques/lengthlimiter.py +1 -0
- angr/exploration_techniques/local_loop_seer.py +2 -2
- angr/exploration_techniques/loop_seer.py +11 -14
- angr/exploration_techniques/manual_mergepoint.py +3 -2
- angr/exploration_techniques/memory_watcher.py +1 -0
- angr/exploration_techniques/oppologist.py +4 -4
- angr/exploration_techniques/slicecutor.py +1 -0
- angr/exploration_techniques/spiller.py +8 -8
- angr/exploration_techniques/spiller_db.py +1 -0
- angr/exploration_techniques/stochastic.py +3 -4
- angr/exploration_techniques/stub_stasher.py +1 -0
- angr/exploration_techniques/suggestions.py +3 -2
- angr/exploration_techniques/symbion.py +1 -0
- angr/exploration_techniques/tech_builder.py +1 -0
- angr/exploration_techniques/threading.py +1 -0
- angr/exploration_techniques/timeout.py +1 -0
- angr/exploration_techniques/tracer.py +34 -39
- angr/exploration_techniques/unique.py +1 -0
- angr/exploration_techniques/veritesting.py +1 -0
- angr/factory.py +9 -9
- angr/flirt/__init__.py +1 -0
- angr/flirt/build_sig.py +8 -12
- angr/keyed_region.py +10 -17
- angr/knowledge_base/__init__.py +1 -0
- angr/knowledge_base/knowledge_base.py +17 -17
- angr/knowledge_plugins/__init__.py +1 -0
- angr/knowledge_plugins/callsite_prototypes.py +1 -0
- angr/knowledge_plugins/cfg/__init__.py +2 -0
- angr/knowledge_plugins/cfg/cfg_manager.py +2 -1
- angr/knowledge_plugins/cfg/cfg_model.py +25 -42
- angr/knowledge_plugins/cfg/cfg_node.py +8 -19
- angr/knowledge_plugins/cfg/indirect_jump.py +3 -5
- angr/knowledge_plugins/cfg/memory_data.py +3 -3
- angr/knowledge_plugins/comments.py +1 -0
- angr/knowledge_plugins/custom_strings.py +1 -0
- angr/knowledge_plugins/data.py +1 -0
- angr/knowledge_plugins/debug_variables.py +18 -23
- angr/knowledge_plugins/functions/__init__.py +1 -0
- angr/knowledge_plugins/functions/function.py +49 -53
- angr/knowledge_plugins/functions/function_manager.py +14 -14
- angr/knowledge_plugins/functions/function_parser.py +38 -42
- angr/knowledge_plugins/functions/soot_function.py +5 -6
- angr/knowledge_plugins/indirect_jumps.py +1 -0
- angr/knowledge_plugins/key_definitions/__init__.py +1 -0
- angr/knowledge_plugins/key_definitions/atoms.py +65 -17
- angr/knowledge_plugins/key_definitions/constants.py +6 -0
- angr/knowledge_plugins/key_definitions/definition.py +22 -25
- angr/knowledge_plugins/key_definitions/environment.py +18 -14
- angr/knowledge_plugins/key_definitions/heap_address.py +4 -3
- angr/knowledge_plugins/key_definitions/key_definition_manager.py +5 -4
- angr/knowledge_plugins/key_definitions/live_definitions.py +36 -45
- angr/knowledge_plugins/key_definitions/liveness.py +18 -23
- angr/knowledge_plugins/key_definitions/rd_model.py +29 -34
- angr/knowledge_plugins/key_definitions/tag.py +7 -6
- angr/knowledge_plugins/key_definitions/undefined.py +3 -0
- angr/knowledge_plugins/key_definitions/unknown_size.py +3 -0
- angr/knowledge_plugins/key_definitions/uses.py +21 -23
- angr/knowledge_plugins/labels.py +3 -2
- angr/knowledge_plugins/patches.py +2 -1
- angr/knowledge_plugins/plugin.py +2 -1
- angr/knowledge_plugins/propagations/__init__.py +1 -0
- angr/knowledge_plugins/propagations/prop_value.py +25 -27
- angr/knowledge_plugins/propagations/propagation_manager.py +2 -2
- angr/knowledge_plugins/propagations/propagation_model.py +5 -4
- angr/knowledge_plugins/propagations/states.py +71 -81
- angr/knowledge_plugins/structured_code/__init__.py +1 -0
- angr/knowledge_plugins/structured_code/manager.py +5 -4
- angr/knowledge_plugins/sync/__init__.py +1 -0
- angr/knowledge_plugins/sync/sync_controller.py +10 -15
- angr/knowledge_plugins/types.py +1 -0
- angr/knowledge_plugins/variables/__init__.py +1 -0
- angr/knowledge_plugins/variables/variable_access.py +9 -10
- angr/knowledge_plugins/variables/variable_manager.py +84 -55
- angr/knowledge_plugins/xrefs/__init__.py +1 -0
- angr/knowledge_plugins/xrefs/xref.py +7 -11
- angr/knowledge_plugins/xrefs/xref_manager.py +1 -0
- angr/knowledge_plugins/xrefs/xref_types.py +3 -0
- angr/lib/angr_native.dll +0 -0
- angr/misc/__init__.py +1 -0
- angr/misc/ansi.py +1 -0
- angr/misc/autoimport.py +3 -2
- angr/misc/bug_report.py +6 -5
- angr/misc/hookset.py +3 -2
- angr/misc/loggers.py +2 -2
- angr/misc/picklable_lock.py +1 -0
- angr/misc/plugins.py +11 -13
- angr/misc/range.py +3 -0
- angr/misc/testing.py +2 -1
- angr/misc/ux.py +5 -5
- angr/misc/weakpatch.py +1 -0
- angr/procedures/__init__.py +1 -0
- angr/procedures/cgc/_terminate.py +1 -0
- angr/procedures/cgc/allocate.py +1 -0
- angr/procedures/cgc/deallocate.py +1 -0
- angr/procedures/cgc/fdwait.py +1 -0
- angr/procedures/cgc/random.py +1 -0
- angr/procedures/cgc/receive.py +26 -26
- angr/procedures/cgc/transmit.py +1 -0
- angr/procedures/definitions/__init__.py +9 -10
- angr/procedures/definitions/cgc.py +1 -0
- angr/procedures/definitions/glibc.py +1 -0
- angr/procedures/definitions/gnulib.py +1 -0
- angr/procedures/definitions/libstdcpp.py +1 -0
- angr/procedures/definitions/linux_kernel.py +1 -0
- angr/procedures/definitions/linux_loader.py +1 -0
- angr/procedures/definitions/msvcr.py +1 -0
- angr/procedures/definitions/parse_syscalls_from_local_system.py +2 -1
- angr/procedures/definitions/parse_win32json.py +27 -30
- angr/procedures/definitions/types_win32.py +1 -0
- angr/procedures/definitions/wdk_api-ms-win-dx-d3dkmt-l1-1-4.py +1 -0
- angr/procedures/definitions/wdk_api-ms-win-dx-d3dkmt-l1-1-6.py +1 -0
- angr/procedures/definitions/wdk_clfs.py +1 -0
- angr/procedures/definitions/wdk_fltmgr.py +1 -0
- angr/procedures/definitions/wdk_fwpkclnt.py +1 -0
- angr/procedures/definitions/wdk_fwpuclnt.py +1 -0
- angr/procedures/definitions/wdk_gdi32.py +1 -0
- angr/procedures/definitions/wdk_hal.py +1 -0
- angr/procedures/definitions/wdk_ksecdd.py +1 -0
- angr/procedures/definitions/wdk_ndis.py +1 -0
- angr/procedures/definitions/wdk_ntoskrnl.py +1 -0
- angr/procedures/definitions/wdk_offreg.py +1 -0
- angr/procedures/definitions/wdk_pshed.py +1 -0
- angr/procedures/definitions/wdk_secur32.py +1 -0
- angr/procedures/definitions/wdk_vhfum.py +1 -0
- angr/procedures/definitions/win32_aclui.py +1 -0
- angr/procedures/definitions/win32_activeds.py +1 -0
- angr/procedures/definitions/win32_advapi32.py +1 -0
- angr/procedures/definitions/win32_advpack.py +1 -0
- angr/procedures/definitions/win32_amsi.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-appmodel-runtime-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-appmodel-runtime-l1-1-3.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-appmodel-runtime-l1-1-6.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-apiquery-l2-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-backgroundtask-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-comm-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-comm-l1-1-2.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-enclave-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-errorhandling-l1-1-3.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-featurestaging-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-featurestaging-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-file-fromapp-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-handle-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-ioring-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-marshal-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-memory-l1-1-3.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-memory-l1-1-4.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-memory-l1-1-5.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-memory-l1-1-6.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-memory-l1-1-7.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-memory-l1-1-8.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-path-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-psm-appnotify-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-psm-appnotify-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-realtime-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-realtime-l1-1-2.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-slapi-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-state-helpers-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-synch-l1-2-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-sysinfo-l1-2-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-sysinfo-l1-2-3.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-sysinfo-l1-2-4.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-sysinfo-l1-2-6.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-util-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-winrt-error-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-winrt-error-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-winrt-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-winrt-registration-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-winrt-robuffer-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-winrt-roparameterizediid-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-winrt-string-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-winrt-string-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-core-wow64-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-devices-query-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-devices-query-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-dx-d3dkmt-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-gaming-deviceinformation-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-gaming-expandedresources-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-gaming-tcui-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-gaming-tcui-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-gaming-tcui-l1-1-2.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-gaming-tcui-l1-1-3.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-gaming-tcui-l1-1-4.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-mm-misc-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-net-isolation-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-security-base-l1-2-2.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-security-isolatedcontainer-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-security-isolatedcontainer-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-service-core-l1-1-3.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-service-core-l1-1-4.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-service-core-l1-1-5.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-shcore-scaling-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-shcore-scaling-l1-1-1.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-shcore-scaling-l1-1-2.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-shcore-stream-winrt-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_api-ms-win-wsl-api-l1-1-0.py +1 -0
- angr/procedures/definitions/win32_apphelp.py +1 -0
- angr/procedures/definitions/win32_authz.py +1 -0
- angr/procedures/definitions/win32_avicap32.py +1 -0
- angr/procedures/definitions/win32_avifil32.py +1 -0
- angr/procedures/definitions/win32_avrt.py +1 -0
- angr/procedures/definitions/win32_bcp47mrm.py +1 -0
- angr/procedures/definitions/win32_bcrypt.py +1 -0
- angr/procedures/definitions/win32_bcryptprimitives.py +1 -0
- angr/procedures/definitions/win32_bluetoothapis.py +1 -0
- angr/procedures/definitions/win32_bthprops.py +1 -0
- angr/procedures/definitions/win32_bthprops_cpl.py +1 -0
- angr/procedures/definitions/win32_cabinet.py +1 -0
- angr/procedures/definitions/win32_certadm.py +1 -0
- angr/procedures/definitions/win32_certpoleng.py +1 -0
- angr/procedures/definitions/win32_cfgmgr32.py +1 -0
- angr/procedures/definitions/win32_chakra.py +1 -0
- angr/procedures/definitions/win32_cldapi.py +1 -0
- angr/procedures/definitions/win32_clfsw32.py +1 -0
- angr/procedures/definitions/win32_clusapi.py +1 -0
- angr/procedures/definitions/win32_comctl32.py +1 -0
- angr/procedures/definitions/win32_comdlg32.py +1 -0
- angr/procedures/definitions/win32_compstui.py +1 -0
- angr/procedures/definitions/win32_computecore.py +1 -0
- angr/procedures/definitions/win32_computenetwork.py +1 -0
- angr/procedures/definitions/win32_computestorage.py +1 -0
- angr/procedures/definitions/win32_comsvcs.py +1 -0
- angr/procedures/definitions/win32_coremessaging.py +1 -0
- angr/procedures/definitions/win32_credui.py +1 -0
- angr/procedures/definitions/win32_crypt32.py +1 -0
- angr/procedures/definitions/win32_cryptnet.py +1 -0
- angr/procedures/definitions/win32_cryptui.py +1 -0
- angr/procedures/definitions/win32_cryptxml.py +1 -0
- angr/procedures/definitions/win32_cscapi.py +1 -0
- angr/procedures/definitions/win32_d2d1.py +1 -0
- angr/procedures/definitions/win32_d3d10.py +1 -0
- angr/procedures/definitions/win32_d3d10_1.py +1 -0
- angr/procedures/definitions/win32_d3d11.py +1 -0
- angr/procedures/definitions/win32_d3d12.py +1 -0
- angr/procedures/definitions/win32_d3d9.py +1 -0
- angr/procedures/definitions/win32_d3dcompiler_47.py +1 -0
- angr/procedures/definitions/win32_d3dcsx.py +1 -0
- angr/procedures/definitions/win32_davclnt.py +1 -0
- angr/procedures/definitions/win32_dbgeng.py +1 -0
- angr/procedures/definitions/win32_dbghelp.py +1 -0
- angr/procedures/definitions/win32_dbgmodel.py +1 -0
- angr/procedures/definitions/win32_dciman32.py +1 -0
- angr/procedures/definitions/win32_dcomp.py +1 -0
- angr/procedures/definitions/win32_ddraw.py +1 -0
- angr/procedures/definitions/win32_deviceaccess.py +1 -0
- angr/procedures/definitions/win32_dflayout.py +1 -0
- angr/procedures/definitions/win32_dhcpcsvc.py +1 -0
- angr/procedures/definitions/win32_dhcpcsvc6.py +1 -0
- angr/procedures/definitions/win32_dhcpsapi.py +1 -0
- angr/procedures/definitions/win32_diagnosticdataquery.py +1 -0
- angr/procedures/definitions/win32_dinput8.py +1 -0
- angr/procedures/definitions/win32_directml.py +1 -0
- angr/procedures/definitions/win32_dmprocessxmlfiltered.py +1 -0
- angr/procedures/definitions/win32_dnsapi.py +1 -0
- angr/procedures/definitions/win32_drt.py +1 -0
- angr/procedures/definitions/win32_drtprov.py +1 -0
- angr/procedures/definitions/win32_drttransport.py +1 -0
- angr/procedures/definitions/win32_dsound.py +1 -0
- angr/procedures/definitions/win32_dsparse.py +1 -0
- angr/procedures/definitions/win32_dsprop.py +1 -0
- angr/procedures/definitions/win32_dssec.py +1 -0
- angr/procedures/definitions/win32_dsuiext.py +1 -0
- angr/procedures/definitions/win32_dwmapi.py +1 -0
- angr/procedures/definitions/win32_dwrite.py +1 -0
- angr/procedures/definitions/win32_dxcompiler.py +1 -0
- angr/procedures/definitions/win32_dxcore.py +1 -0
- angr/procedures/definitions/win32_dxgi.py +1 -0
- angr/procedures/definitions/win32_dxva2.py +1 -0
- angr/procedures/definitions/win32_eappcfg.py +1 -0
- angr/procedures/definitions/win32_eappprxy.py +1 -0
- angr/procedures/definitions/win32_efswrt.py +1 -0
- angr/procedures/definitions/win32_elscore.py +1 -0
- angr/procedures/definitions/win32_esent.py +1 -0
- angr/procedures/definitions/win32_evr.py +1 -0
- angr/procedures/definitions/win32_faultrep.py +1 -0
- angr/procedures/definitions/win32_fhsvcctl.py +1 -0
- angr/procedures/definitions/win32_firewallapi.py +1 -0
- angr/procedures/definitions/win32_fltlib.py +1 -0
- angr/procedures/definitions/win32_fontsub.py +1 -0
- angr/procedures/definitions/win32_forceinline.py +1 -0
- angr/procedures/definitions/win32_fwpuclnt.py +1 -0
- angr/procedures/definitions/win32_fxsutility.py +1 -0
- angr/procedures/definitions/win32_gdi32.py +1 -0
- angr/procedures/definitions/win32_gdiplus.py +1 -0
- angr/procedures/definitions/win32_glu32.py +1 -0
- angr/procedures/definitions/win32_gpedit.py +1 -0
- angr/procedures/definitions/win32_hhctrl_ocx.py +1 -0
- angr/procedures/definitions/win32_hid.py +1 -0
- angr/procedures/definitions/win32_hlink.py +1 -0
- angr/procedures/definitions/win32_hrtfapo.py +1 -0
- angr/procedures/definitions/win32_httpapi.py +1 -0
- angr/procedures/definitions/win32_icm32.py +1 -0
- angr/procedures/definitions/win32_icmui.py +1 -0
- angr/procedures/definitions/win32_icu.py +1 -0
- angr/procedures/definitions/win32_ieframe.py +1 -0
- angr/procedures/definitions/win32_imagehlp.py +1 -0
- angr/procedures/definitions/win32_imgutil.py +1 -0
- angr/procedures/definitions/win32_imm32.py +1 -0
- angr/procedures/definitions/win32_infocardapi.py +1 -0
- angr/procedures/definitions/win32_inkobjcore.py +1 -0
- angr/procedures/definitions/win32_iphlpapi.py +1 -0
- angr/procedures/definitions/win32_iscsidsc.py +1 -0
- angr/procedures/definitions/win32_isolatedwindowsenvironmentutils.py +1 -0
- angr/procedures/definitions/win32_kernel32.py +1 -0
- angr/procedures/definitions/win32_kernelbase.py +1 -0
- angr/procedures/definitions/win32_keycredmgr.py +1 -0
- angr/procedures/definitions/win32_ksproxy_ax.py +1 -0
- angr/procedures/definitions/win32_ksuser.py +1 -0
- angr/procedures/definitions/win32_ktmw32.py +1 -0
- angr/procedures/definitions/win32_licenseprotection.py +1 -0
- angr/procedures/definitions/win32_loadperf.py +1 -0
- angr/procedures/definitions/win32_magnification.py +1 -0
- angr/procedures/definitions/win32_mapi32.py +1 -0
- angr/procedures/definitions/win32_mdmlocalmanagement.py +1 -0
- angr/procedures/definitions/win32_mdmregistration.py +1 -0
- angr/procedures/definitions/win32_mf.py +1 -0
- angr/procedures/definitions/win32_mfcore.py +1 -0
- angr/procedures/definitions/win32_mfplat.py +1 -0
- angr/procedures/definitions/win32_mfplay.py +1 -0
- angr/procedures/definitions/win32_mfreadwrite.py +1 -0
- angr/procedures/definitions/win32_mfsensorgroup.py +1 -0
- angr/procedures/definitions/win32_mfsrcsnk.py +1 -0
- angr/procedures/definitions/win32_mgmtapi.py +1 -0
- angr/procedures/definitions/win32_mi.py +1 -0
- angr/procedures/definitions/win32_mmdevapi.py +1 -0
- angr/procedures/definitions/win32_mpr.py +1 -0
- angr/procedures/definitions/win32_mprapi.py +1 -0
- angr/procedures/definitions/win32_mqrt.py +1 -0
- angr/procedures/definitions/win32_mrmsupport.py +1 -0
- angr/procedures/definitions/win32_msacm32.py +1 -0
- angr/procedures/definitions/win32_msajapi.py +1 -0
- angr/procedures/definitions/win32_mscms.py +1 -0
- angr/procedures/definitions/win32_mscoree.py +1 -0
- angr/procedures/definitions/win32_msctfmonitor.py +1 -0
- angr/procedures/definitions/win32_msdelta.py +1 -0
- angr/procedures/definitions/win32_msdmo.py +1 -0
- angr/procedures/definitions/win32_msdrm.py +1 -0
- angr/procedures/definitions/win32_msi.py +1 -0
- angr/procedures/definitions/win32_msimg32.py +1 -0
- angr/procedures/definitions/win32_mspatcha.py +1 -0
- angr/procedures/definitions/win32_mspatchc.py +1 -0
- angr/procedures/definitions/win32_msports.py +1 -0
- angr/procedures/definitions/win32_msrating.py +1 -0
- angr/procedures/definitions/win32_mssign32.py +1 -0
- angr/procedures/definitions/win32_mstask.py +1 -0
- angr/procedures/definitions/win32_msvfw32.py +1 -0
- angr/procedures/definitions/win32_mswsock.py +1 -0
- angr/procedures/definitions/win32_mtxdm.py +1 -0
- angr/procedures/definitions/win32_ncrypt.py +1 -0
- angr/procedures/definitions/win32_ndfapi.py +1 -0
- angr/procedures/definitions/win32_netapi32.py +1 -0
- angr/procedures/definitions/win32_netsh.py +1 -0
- angr/procedures/definitions/win32_netshell.py +1 -0
- angr/procedures/definitions/win32_newdev.py +1 -0
- angr/procedures/definitions/win32_ninput.py +1 -0
- angr/procedures/definitions/win32_normaliz.py +1 -0
- angr/procedures/definitions/win32_ntdll.py +1 -0
- angr/procedures/definitions/win32_ntdllk.py +1 -0
- angr/procedures/definitions/win32_ntdsapi.py +1 -0
- angr/procedures/definitions/win32_ntlanman.py +1 -0
- angr/procedures/definitions/win32_odbc32.py +1 -0
- angr/procedures/definitions/win32_odbcbcp.py +1 -0
- angr/procedures/definitions/win32_ole32.py +1 -0
- angr/procedures/definitions/win32_oleacc.py +1 -0
- angr/procedures/definitions/win32_oleaut32.py +1 -0
- angr/procedures/definitions/win32_oledlg.py +1 -0
- angr/procedures/definitions/win32_ondemandconnroutehelper.py +1 -0
- angr/procedures/definitions/win32_opengl32.py +1 -0
- angr/procedures/definitions/win32_opmxbox.py +1 -0
- angr/procedures/definitions/win32_p2p.py +1 -0
- angr/procedures/definitions/win32_p2pgraph.py +1 -0
- angr/procedures/definitions/win32_pdh.py +1 -0
- angr/procedures/definitions/win32_peerdist.py +1 -0
- angr/procedures/definitions/win32_powrprof.py +1 -0
- angr/procedures/definitions/win32_prntvpt.py +1 -0
- angr/procedures/definitions/win32_projectedfslib.py +1 -0
- angr/procedures/definitions/win32_propsys.py +1 -0
- angr/procedures/definitions/win32_psapi.py +1 -0
- angr/procedures/definitions/win32_quartz.py +1 -0
- angr/procedures/definitions/win32_query.py +1 -0
- angr/procedures/definitions/win32_qwave.py +1 -0
- angr/procedures/definitions/win32_rasapi32.py +1 -0
- angr/procedures/definitions/win32_rasdlg.py +1 -0
- angr/procedures/definitions/win32_resutils.py +1 -0
- angr/procedures/definitions/win32_rometadata.py +1 -0
- angr/procedures/definitions/win32_rpcns4.py +1 -0
- angr/procedures/definitions/win32_rpcproxy.py +1 -0
- angr/procedures/definitions/win32_rpcrt4.py +1 -0
- angr/procedures/definitions/win32_rstrtmgr.py +1 -0
- angr/procedures/definitions/win32_rtm.py +1 -0
- angr/procedures/definitions/win32_rtutils.py +1 -0
- angr/procedures/definitions/win32_rtworkq.py +1 -0
- angr/procedures/definitions/win32_sas.py +1 -0
- angr/procedures/definitions/win32_scarddlg.py +1 -0
- angr/procedures/definitions/win32_schannel.py +1 -0
- angr/procedures/definitions/win32_sechost.py +1 -0
- angr/procedures/definitions/win32_secur32.py +1 -0
- angr/procedures/definitions/win32_sensapi.py +1 -0
- angr/procedures/definitions/win32_sensorsutilsv2.py +1 -0
- angr/procedures/definitions/win32_setupapi.py +1 -0
- angr/procedures/definitions/win32_sfc.py +1 -0
- angr/procedures/definitions/win32_shdocvw.py +1 -0
- angr/procedures/definitions/win32_shell32.py +1 -0
- angr/procedures/definitions/win32_shlwapi.py +1 -0
- angr/procedures/definitions/win32_slc.py +1 -0
- angr/procedures/definitions/win32_slcext.py +1 -0
- angr/procedures/definitions/win32_slwga.py +1 -0
- angr/procedures/definitions/win32_snmpapi.py +1 -0
- angr/procedures/definitions/win32_spoolss.py +1 -0
- angr/procedures/definitions/win32_srclient.py +1 -0
- angr/procedures/definitions/win32_srpapi.py +1 -0
- angr/procedures/definitions/win32_sspicli.py +1 -0
- angr/procedures/definitions/win32_sti.py +1 -0
- angr/procedures/definitions/win32_t2embed.py +1 -0
- angr/procedures/definitions/win32_tapi32.py +1 -0
- angr/procedures/definitions/win32_tbs.py +1 -0
- angr/procedures/definitions/win32_tdh.py +1 -0
- angr/procedures/definitions/win32_tokenbinding.py +1 -0
- angr/procedures/definitions/win32_traffic.py +1 -0
- angr/procedures/definitions/win32_txfw32.py +1 -0
- angr/procedures/definitions/win32_ualapi.py +1 -0
- angr/procedures/definitions/win32_uiautomationcore.py +1 -0
- angr/procedures/definitions/win32_urlmon.py +1 -0
- angr/procedures/definitions/win32_user32.py +1 -0
- angr/procedures/definitions/win32_userenv.py +1 -0
- angr/procedures/definitions/win32_usp10.py +1 -0
- angr/procedures/definitions/win32_uxtheme.py +1 -0
- angr/procedures/definitions/win32_verifier.py +1 -0
- angr/procedures/definitions/win32_version.py +1 -0
- angr/procedures/definitions/win32_vertdll.py +1 -0
- angr/procedures/definitions/win32_virtdisk.py +1 -0
- angr/procedures/definitions/win32_vmdevicehost.py +1 -0
- angr/procedures/definitions/win32_vmsavedstatedumpprovider.py +1 -0
- angr/procedures/definitions/win32_vssapi.py +1 -0
- angr/procedures/definitions/win32_wcmapi.py +1 -0
- angr/procedures/definitions/win32_wdsbp.py +1 -0
- angr/procedures/definitions/win32_wdsclientapi.py +1 -0
- angr/procedures/definitions/win32_wdsmc.py +1 -0
- angr/procedures/definitions/win32_wdspxe.py +1 -0
- angr/procedures/definitions/win32_wdstptc.py +1 -0
- angr/procedures/definitions/win32_webauthn.py +1 -0
- angr/procedures/definitions/win32_webservices.py +1 -0
- angr/procedures/definitions/win32_websocket.py +1 -0
- angr/procedures/definitions/win32_wecapi.py +1 -0
- angr/procedures/definitions/win32_wer.py +1 -0
- angr/procedures/definitions/win32_wevtapi.py +1 -0
- angr/procedures/definitions/win32_winbio.py +1 -0
- angr/procedures/definitions/win32_windows_ai_machinelearning.py +1 -0
- angr/procedures/definitions/win32_windows_data_pdf.py +1 -0
- angr/procedures/definitions/win32_windows_media_mediacontrol.py +1 -0
- angr/procedures/definitions/win32_windows_networking.py +1 -0
- angr/procedures/definitions/win32_windows_ui_xaml.py +1 -0
- angr/procedures/definitions/win32_windowscodecs.py +1 -0
- angr/procedures/definitions/win32_winfax.py +1 -0
- angr/procedures/definitions/win32_winhttp.py +1 -0
- angr/procedures/definitions/win32_winhvemulation.py +1 -0
- angr/procedures/definitions/win32_winhvplatform.py +1 -0
- angr/procedures/definitions/win32_wininet.py +1 -0
- angr/procedures/definitions/win32_winml.py +1 -0
- angr/procedures/definitions/win32_winmm.py +1 -0
- angr/procedures/definitions/win32_winscard.py +1 -0
- angr/procedures/definitions/win32_winspool.py +1 -0
- angr/procedures/definitions/win32_winspool_drv.py +1 -0
- angr/procedures/definitions/win32_wintrust.py +1 -0
- angr/procedures/definitions/win32_winusb.py +1 -0
- angr/procedures/definitions/win32_wlanapi.py +1 -0
- angr/procedures/definitions/win32_wlanui.py +1 -0
- angr/procedures/definitions/win32_wldap32.py +1 -0
- angr/procedures/definitions/win32_wldp.py +1 -0
- angr/procedures/definitions/win32_wmvcore.py +1 -0
- angr/procedures/definitions/win32_wnvapi.py +1 -0
- angr/procedures/definitions/win32_wofutil.py +1 -0
- angr/procedures/definitions/win32_ws2_32.py +1 -0
- angr/procedures/definitions/win32_wscapi.py +1 -0
- angr/procedures/definitions/win32_wsclient.py +1 -0
- angr/procedures/definitions/win32_wsdapi.py +1 -0
- angr/procedures/definitions/win32_wsmsvc.py +1 -0
- angr/procedures/definitions/win32_wsnmp32.py +1 -0
- angr/procedures/definitions/win32_wtsapi32.py +1 -0
- angr/procedures/definitions/win32_xaudio2_8.py +1 -0
- angr/procedures/definitions/win32_xinput1_4.py +1 -0
- angr/procedures/definitions/win32_xinputuap.py +1 -0
- angr/procedures/definitions/win32_xmllite.py +1 -0
- angr/procedures/definitions/win32_xolehlp.py +1 -0
- angr/procedures/definitions/win32_xpsprint.py +1 -0
- angr/procedures/glibc/__ctype_b_loc.py +2 -3
- angr/procedures/glibc/__ctype_tolower_loc.py +2 -3
- angr/procedures/glibc/__ctype_toupper_loc.py +2 -3
- angr/procedures/glibc/__errno_location.py +1 -0
- angr/procedures/glibc/__libc_init.py +1 -0
- angr/procedures/glibc/__libc_start_main.py +2 -3
- angr/procedures/glibc/dynamic_loading.py +1 -0
- angr/procedures/glibc/scanf.py +1 -0
- angr/procedures/glibc/sscanf.py +1 -0
- angr/procedures/gnulib/xalloc_die.py +1 -0
- angr/procedures/gnulib/xstrtol_fatal.py +1 -0
- angr/procedures/java/__init__.py +1 -0
- angr/procedures/java/unconstrained.py +3 -2
- angr/procedures/java_io/read.py +1 -0
- angr/procedures/java_io/write.py +1 -0
- angr/procedures/java_jni/__init__.py +4 -5
- angr/procedures/java_jni/array_operations.py +1 -0
- angr/procedures/java_jni/class_and_interface_operations.py +3 -3
- angr/procedures/java_jni/field_access.py +3 -6
- angr/procedures/java_jni/global_and_local_refs.py +1 -0
- angr/procedures/java_jni/method_calls.py +3 -2
- angr/procedures/java_jni/not_implemented.py +2 -1
- angr/procedures/java_jni/object_operations.py +3 -4
- angr/procedures/java_jni/string_operations.py +1 -0
- angr/procedures/java_jni/version_information.py +1 -0
- angr/procedures/java_lang/character.py +2 -3
- angr/procedures/java_lang/double.py +2 -2
- angr/procedures/java_lang/exit.py +1 -0
- angr/procedures/java_lang/getsimplename.py +2 -2
- angr/procedures/java_lang/integer.py +1 -0
- angr/procedures/java_lang/load_library.py +1 -0
- angr/procedures/java_lang/math.py +1 -0
- angr/procedures/java_lang/string.py +2 -2
- angr/procedures/java_lang/stringbuilder.py +1 -0
- angr/procedures/java_lang/system.py +1 -0
- angr/procedures/java_util/collection.py +1 -0
- angr/procedures/java_util/iterator.py +1 -0
- angr/procedures/java_util/list.py +1 -0
- angr/procedures/java_util/map.py +3 -4
- angr/procedures/java_util/random.py +1 -0
- angr/procedures/java_util/scanner_nextline.py +1 -0
- angr/procedures/libc/abort.py +1 -0
- angr/procedures/libc/access.py +1 -0
- angr/procedures/libc/atoi.py +2 -2
- angr/procedures/libc/atol.py +1 -0
- angr/procedures/libc/calloc.py +1 -0
- angr/procedures/libc/closelog.py +1 -0
- angr/procedures/libc/err.py +1 -0
- angr/procedures/libc/error.py +2 -3
- angr/procedures/libc/exit.py +1 -0
- angr/procedures/libc/fclose.py +2 -3
- angr/procedures/libc/feof.py +1 -0
- angr/procedures/libc/fflush.py +1 -0
- angr/procedures/libc/fgetc.py +1 -0
- angr/procedures/libc/fgets.py +19 -19
- angr/procedures/libc/fopen.py +6 -8
- angr/procedures/libc/fprintf.py +1 -0
- angr/procedures/libc/fputc.py +1 -0
- angr/procedures/libc/fputs.py +1 -0
- angr/procedures/libc/fread.py +1 -0
- angr/procedures/libc/free.py +1 -0
- angr/procedures/libc/fscanf.py +2 -2
- angr/procedures/libc/fseek.py +3 -2
- angr/procedures/libc/ftell.py +1 -0
- angr/procedures/libc/fwrite.py +1 -0
- angr/procedures/libc/getchar.py +2 -2
- angr/procedures/libc/getdelim.py +25 -25
- angr/procedures/libc/getegid.py +1 -0
- angr/procedures/libc/geteuid.py +1 -0
- angr/procedures/libc/getgid.py +1 -0
- angr/procedures/libc/gets.py +18 -18
- angr/procedures/libc/getuid.py +1 -0
- angr/procedures/libc/malloc.py +1 -0
- angr/procedures/libc/memcmp.py +3 -6
- angr/procedures/libc/memcpy.py +1 -0
- angr/procedures/libc/memset.py +1 -0
- angr/procedures/libc/openlog.py +1 -0
- angr/procedures/libc/perror.py +1 -0
- angr/procedures/libc/printf.py +1 -0
- angr/procedures/libc/putchar.py +1 -0
- angr/procedures/libc/puts.py +1 -0
- angr/procedures/libc/rand.py +1 -0
- angr/procedures/libc/realloc.py +1 -0
- angr/procedures/libc/rewind.py +2 -1
- angr/procedures/libc/scanf.py +2 -2
- angr/procedures/libc/setbuf.py +1 -0
- angr/procedures/libc/setvbuf.py +1 -0
- angr/procedures/libc/snprintf.py +1 -0
- angr/procedures/libc/sprintf.py +1 -0
- angr/procedures/libc/srand.py +1 -0
- angr/procedures/libc/sscanf.py +2 -2
- angr/procedures/libc/stpcpy.py +2 -2
- angr/procedures/libc/strcat.py +1 -0
- angr/procedures/libc/strchr.py +1 -0
- angr/procedures/libc/strcmp.py +1 -0
- angr/procedures/libc/strcpy.py +2 -2
- angr/procedures/libc/strlen.py +35 -31
- angr/procedures/libc/strncat.py +1 -0
- angr/procedures/libc/strncmp.py +9 -11
- angr/procedures/libc/strncpy.py +1 -0
- angr/procedures/libc/strnlen.py +2 -2
- angr/procedures/libc/strstr.py +8 -4
- angr/procedures/libc/strtol.py +9 -9
- angr/procedures/libc/strtoul.py +2 -2
- angr/procedures/libc/system.py +1 -0
- angr/procedures/libc/time.py +2 -2
- angr/procedures/libc/tmpnam.py +1 -0
- angr/procedures/libc/tolower.py +1 -0
- angr/procedures/libc/toupper.py +1 -0
- angr/procedures/libc/ungetc.py +1 -0
- angr/procedures/libc/vsnprintf.py +1 -0
- angr/procedures/libc/wchar.py +1 -0
- angr/procedures/libstdcpp/_unwind_resume.py +1 -0
- angr/procedures/libstdcpp/std____throw_bad_alloc.py +1 -0
- angr/procedures/libstdcpp/std____throw_bad_cast.py +1 -0
- angr/procedures/libstdcpp/std____throw_length_error.py +1 -0
- angr/procedures/libstdcpp/std____throw_logic_error.py +1 -0
- angr/procedures/libstdcpp/std__terminate.py +1 -0
- angr/procedures/linux_kernel/access.py +1 -0
- angr/procedures/linux_kernel/arch_prctl.py +1 -0
- angr/procedures/linux_kernel/arm_user_helpers.py +1 -0
- angr/procedures/linux_kernel/brk.py +1 -0
- angr/procedures/linux_kernel/cwd.py +1 -0
- angr/procedures/linux_kernel/fstat.py +2 -1
- angr/procedures/linux_kernel/fstat64.py +2 -1
- angr/procedures/linux_kernel/futex.py +3 -3
- angr/procedures/linux_kernel/getegid.py +1 -0
- angr/procedures/linux_kernel/geteuid.py +1 -0
- angr/procedures/linux_kernel/getgid.py +1 -0
- angr/procedures/linux_kernel/getpid.py +1 -0
- angr/procedures/linux_kernel/getrlimit.py +3 -3
- angr/procedures/linux_kernel/gettid.py +1 -0
- angr/procedures/linux_kernel/getuid.py +1 -0
- angr/procedures/linux_kernel/iovec.py +1 -0
- angr/procedures/linux_kernel/lseek.py +1 -0
- angr/procedures/linux_kernel/mmap.py +1 -0
- angr/procedures/linux_kernel/mprotect.py +7 -6
- angr/procedures/linux_kernel/munmap.py +1 -0
- angr/procedures/linux_kernel/openat.py +3 -5
- angr/procedures/linux_kernel/set_tid_address.py +1 -0
- angr/procedures/linux_kernel/sigaction.py +1 -0
- angr/procedures/linux_kernel/sigprocmask.py +1 -0
- angr/procedures/linux_kernel/stat.py +3 -2
- angr/procedures/linux_kernel/sysinfo.py +1 -0
- angr/procedures/linux_kernel/tgkill.py +1 -0
- angr/procedures/linux_kernel/time.py +2 -1
- angr/procedures/linux_kernel/uid.py +1 -0
- angr/procedures/linux_kernel/uname.py +1 -0
- angr/procedures/linux_kernel/unlink.py +2 -2
- angr/procedures/linux_kernel/vsyscall.py +1 -0
- angr/procedures/linux_loader/_dl_initial_error_catch_tsd.py +1 -0
- angr/procedures/linux_loader/_dl_rtld_lock.py +1 -0
- angr/procedures/linux_loader/sim_loader.py +1 -0
- angr/procedures/linux_loader/tls.py +2 -2
- angr/procedures/msvcr/__getmainargs.py +1 -0
- angr/procedures/msvcr/_initterm.py +1 -0
- angr/procedures/msvcr/fmode.py +1 -0
- angr/procedures/ntdll/exceptions.py +4 -3
- angr/procedures/posix/accept.py +2 -2
- angr/procedures/posix/bind.py +1 -0
- angr/procedures/posix/bzero.py +1 -0
- angr/procedures/posix/chroot.py +1 -0
- angr/procedures/posix/close.py +2 -2
- angr/procedures/posix/closedir.py +1 -0
- angr/procedures/posix/dup.py +4 -3
- angr/procedures/posix/fcntl.py +1 -0
- angr/procedures/posix/fdopen.py +16 -19
- angr/procedures/posix/fileno.py +1 -0
- angr/procedures/posix/fork.py +1 -0
- angr/procedures/posix/getenv.py +1 -0
- angr/procedures/posix/gethostbyname.py +1 -0
- angr/procedures/posix/getpass.py +1 -0
- angr/procedures/posix/getsockopt.py +1 -0
- angr/procedures/posix/htonl.py +2 -2
- angr/procedures/posix/htons.py +2 -2
- angr/procedures/posix/inet_ntoa.py +3 -5
- angr/procedures/posix/listen.py +1 -0
- angr/procedures/posix/mmap.py +2 -1
- angr/procedures/posix/open.py +1 -0
- angr/procedures/posix/opendir.py +1 -0
- angr/procedures/posix/poll.py +3 -3
- angr/procedures/posix/pread64.py +1 -0
- angr/procedures/posix/pthread.py +3 -3
- angr/procedures/posix/pwrite64.py +1 -0
- angr/procedures/posix/read.py +1 -0
- angr/procedures/posix/readdir.py +1 -1
- angr/procedures/posix/recv.py +1 -0
- angr/procedures/posix/recvfrom.py +1 -0
- angr/procedures/posix/select.py +7 -7
- angr/procedures/posix/send.py +2 -2
- angr/procedures/posix/setsockopt.py +1 -0
- angr/procedures/posix/sigaction.py +1 -0
- angr/procedures/posix/sim_time.py +1 -0
- angr/procedures/posix/sleep.py +1 -0
- angr/procedures/posix/socket.py +2 -2
- angr/procedures/posix/strcasecmp.py +1 -0
- angr/procedures/posix/strdup.py +1 -0
- angr/procedures/posix/strtok_r.py +32 -36
- angr/procedures/posix/syslog.py +1 -0
- angr/procedures/posix/tz.py +1 -0
- angr/procedures/posix/unlink.py +1 -0
- angr/procedures/posix/usleep.py +1 -0
- angr/procedures/posix/write.py +1 -0
- angr/procedures/procedure_dict.py +1 -0
- angr/procedures/stubs/CallReturn.py +1 -0
- angr/procedures/stubs/NoReturnUnconstrained.py +1 -0
- angr/procedures/stubs/Nop.py +1 -0
- angr/procedures/stubs/PathTerminator.py +1 -0
- angr/procedures/stubs/Redirect.py +2 -1
- angr/procedures/stubs/ReturnChar.py +1 -0
- angr/procedures/stubs/ReturnUnconstrained.py +2 -1
- angr/procedures/stubs/UnresolvableCallTarget.py +1 -0
- angr/procedures/stubs/UnresolvableJumpTarget.py +1 -0
- angr/procedures/stubs/UserHook.py +1 -0
- angr/procedures/stubs/b64_decode.py +1 -0
- angr/procedures/stubs/caller.py +1 -0
- angr/procedures/stubs/crazy_scanf.py +1 -0
- angr/procedures/stubs/format_parser.py +11 -15
- angr/procedures/stubs/syscall_stub.py +6 -7
- angr/procedures/testing/manyargs.py +1 -0
- angr/procedures/testing/retreg.py +2 -2
- angr/procedures/tracer/random.py +1 -0
- angr/procedures/tracer/receive.py +4 -4
- angr/procedures/tracer/transmit.py +4 -4
- angr/procedures/uclibc/__uClibc_main.py +1 -0
- angr/procedures/win32/EncodePointer.py +1 -0
- angr/procedures/win32/ExitProcess.py +1 -0
- angr/procedures/win32/GetCommandLine.py +1 -0
- angr/procedures/win32/GetCurrentProcessId.py +1 -0
- angr/procedures/win32/GetCurrentThreadId.py +1 -0
- angr/procedures/win32/GetLastInputInfo.py +1 -0
- angr/procedures/win32/GetModuleHandle.py +3 -4
- angr/procedures/win32/GetProcessAffinityMask.py +1 -0
- angr/procedures/win32/InterlockedExchange.py +2 -1
- angr/procedures/win32/IsProcessorFeaturePresent.py +1 -0
- angr/procedures/win32/VirtualAlloc.py +2 -1
- angr/procedures/win32/VirtualProtect.py +1 -0
- angr/procedures/win32/critical_section.py +1 -0
- angr/procedures/win32/dynamic_loading.py +2 -1
- angr/procedures/win32/file_handles.py +4 -4
- angr/procedures/win32/gethostbyname.py +2 -2
- angr/procedures/win32/heap.py +1 -0
- angr/procedures/win32/is_bad_ptr.py +1 -0
- angr/procedures/win32/local_storage.py +7 -6
- angr/procedures/win32/mutex.py +1 -0
- angr/procedures/win32/sim_time.py +7 -10
- angr/procedures/win32/system_paths.py +5 -4
- angr/procedures/win32_kernel/ExAllocatePool.py +1 -0
- angr/procedures/win32_kernel/ExFreePoolWithTag.py +1 -0
- angr/procedures/win_user32/chars.py +1 -0
- angr/procedures/win_user32/keyboard.py +1 -0
- angr/procedures/win_user32/messagebox.py +2 -4
- angr/project.py +15 -22
- angr/protos/__init__.py +1 -0
- angr/serializable.py +6 -3
- angr/sim_manager.py +18 -18
- angr/sim_options.py +5 -7
- angr/sim_procedure.py +11 -10
- angr/sim_state.py +40 -54
- angr/sim_state_options.py +9 -15
- angr/sim_type.py +93 -123
- angr/sim_variable.py +23 -38
- angr/simos/__init__.py +3 -1
- angr/simos/cgc.py +2 -1
- angr/simos/javavm.py +77 -83
- angr/simos/linux.py +53 -63
- angr/simos/simos.py +13 -22
- angr/simos/snimmuc_nxp.py +3 -6
- angr/simos/userland.py +6 -6
- angr/simos/windows.py +13 -10
- angr/slicer.py +13 -11
- angr/state_hierarchy.py +3 -3
- angr/state_plugins/__init__.py +1 -0
- angr/state_plugins/callstack.py +19 -18
- angr/state_plugins/cgc.py +5 -4
- angr/state_plugins/concrete.py +7 -8
- angr/state_plugins/debug_variables.py +15 -17
- angr/state_plugins/filesystem.py +13 -19
- angr/state_plugins/gdb.py +3 -2
- angr/state_plugins/globals.py +5 -1
- angr/state_plugins/heap/__init__.py +1 -0
- angr/state_plugins/heap/heap_base.py +1 -0
- angr/state_plugins/heap/heap_brk.py +9 -6
- angr/state_plugins/heap/heap_freelist.py +12 -9
- angr/state_plugins/heap/heap_libc.py +1 -0
- angr/state_plugins/heap/heap_ptmalloc.py +27 -36
- angr/state_plugins/heap/utils.py +1 -0
- angr/state_plugins/history.py +7 -10
- angr/state_plugins/inspect.py +1 -0
- angr/state_plugins/javavm_classloader.py +3 -2
- angr/state_plugins/jni_references.py +2 -1
- angr/state_plugins/libc.py +4 -4
- angr/state_plugins/light_registers.py +6 -8
- angr/state_plugins/log.py +1 -0
- angr/state_plugins/loop_data.py +1 -0
- angr/state_plugins/plugin.py +7 -8
- angr/state_plugins/posix.py +14 -22
- angr/state_plugins/preconstrainer.py +2 -1
- angr/state_plugins/scratch.py +5 -4
- angr/state_plugins/sim_action.py +15 -20
- angr/state_plugins/sim_action_object.py +205 -82
- angr/state_plugins/sim_event.py +1 -0
- angr/state_plugins/solver.py +64 -92
- angr/state_plugins/symbolizer.py +5 -6
- angr/state_plugins/trace_additions.py +24 -34
- angr/state_plugins/uc_manager.py +16 -9
- angr/state_plugins/unicorn_engine.py +21 -37
- angr/state_plugins/view.py +20 -19
- angr/storage/__init__.py +1 -0
- angr/storage/file.py +19 -21
- angr/storage/memory_mixins/__init__.py +12 -15
- angr/storage/memory_mixins/__init__.pyi +13 -14
- angr/storage/memory_mixins/actions_mixin.py +1 -0
- angr/storage/memory_mixins/address_concretization_mixin.py +11 -15
- angr/storage/memory_mixins/bvv_conversion_mixin.py +10 -11
- angr/storage/memory_mixins/clouseau_mixin.py +1 -0
- angr/storage/memory_mixins/conditional_store_mixin.py +1 -0
- angr/storage/memory_mixins/convenient_mappings_mixin.py +1 -0
- angr/storage/memory_mixins/default_filler_mixin.py +12 -14
- angr/storage/memory_mixins/dirty_addrs_mixin.py +1 -0
- angr/storage/memory_mixins/hex_dumper_mixin.py +6 -9
- angr/storage/memory_mixins/javavm_memory/__init__.py +1 -0
- angr/storage/memory_mixins/javavm_memory/javavm_memory_mixin.py +16 -23
- angr/storage/memory_mixins/keyvalue_memory/__init__.py +1 -0
- angr/storage/memory_mixins/keyvalue_memory/keyvalue_memory_mixin.py +2 -1
- angr/storage/memory_mixins/label_merger_mixin.py +2 -2
- angr/storage/memory_mixins/multi_value_merger_mixin.py +1 -0
- angr/storage/memory_mixins/name_resolution_mixin.py +12 -15
- angr/storage/memory_mixins/paged_memory/page_backer_mixins.py +6 -6
- angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +22 -36
- angr/storage/memory_mixins/paged_memory/paged_memory_multivalue_mixin.py +1 -0
- angr/storage/memory_mixins/paged_memory/pages/__init__.py +1 -2
- angr/storage/memory_mixins/paged_memory/pages/cooperation.py +4 -3
- angr/storage/memory_mixins/paged_memory/pages/history_tracking_mixin.py +4 -4
- angr/storage/memory_mixins/paged_memory/pages/ispo_mixin.py +1 -0
- angr/storage/memory_mixins/paged_memory/pages/list_page.py +12 -20
- angr/storage/memory_mixins/paged_memory/pages/multi_values.py +14 -19
- angr/storage/memory_mixins/paged_memory/pages/mv_list_page.py +26 -32
- angr/storage/memory_mixins/paged_memory/pages/permissions_mixin.py +1 -0
- angr/storage/memory_mixins/paged_memory/pages/refcount_mixin.py +2 -2
- angr/storage/memory_mixins/paged_memory/pages/ultra_page.py +37 -41
- angr/storage/memory_mixins/paged_memory/privileged_mixin.py +1 -0
- angr/storage/memory_mixins/paged_memory/stack_allocation_mixin.py +1 -0
- angr/storage/memory_mixins/regioned_memory/__init__.py +1 -0
- angr/storage/memory_mixins/regioned_memory/abstract_address_descriptor.py +5 -4
- angr/storage/memory_mixins/regioned_memory/abstract_merger_mixin.py +6 -21
- angr/storage/memory_mixins/regioned_memory/region_category_mixin.py +1 -0
- angr/storage/memory_mixins/regioned_memory/region_data.py +4 -5
- angr/storage/memory_mixins/regioned_memory/region_meta_mixin.py +129 -13
- angr/storage/memory_mixins/regioned_memory/regioned_address_concretization_mixin.py +2 -1
- angr/storage/memory_mixins/regioned_memory/regioned_memory_mixin.py +34 -44
- angr/storage/memory_mixins/regioned_memory/static_find_mixin.py +7 -9
- angr/storage/memory_mixins/simple_interface_mixin.py +8 -11
- angr/storage/memory_mixins/simplification_mixin.py +1 -0
- angr/storage/memory_mixins/size_resolution_mixin.py +4 -3
- angr/storage/memory_mixins/slotted_memory.py +3 -3
- angr/storage/memory_mixins/smart_find_mixin.py +1 -0
- angr/storage/memory_mixins/symbolic_merger_mixin.py +1 -0
- angr/storage/memory_mixins/top_merger_mixin.py +2 -2
- angr/storage/memory_mixins/underconstrained_mixin.py +12 -14
- angr/storage/memory_mixins/unwrapper_mixin.py +1 -0
- angr/storage/memory_object.py +30 -28
- angr/storage/pcap.py +3 -3
- angr/tablespecs.py +1 -0
- angr/utils/__init__.py +1 -0
- angr/utils/ail.py +30 -0
- angr/utils/algo.py +1 -0
- angr/utils/bits.py +12 -0
- angr/utils/constants.py +2 -0
- angr/utils/cowdict.py +3 -4
- angr/utils/dynamic_dictlist.py +4 -7
- angr/utils/endness.py +1 -0
- angr/utils/enums_conv.py +1 -0
- angr/utils/env.py +1 -0
- angr/utils/formatting.py +1 -0
- angr/utils/funcid.py +15 -14
- angr/utils/graph.py +52 -19
- angr/utils/lazy_import.py +1 -0
- angr/utils/library.py +10 -13
- angr/utils/loader.py +6 -6
- angr/utils/mp.py +4 -3
- angr/utils/orderedset.py +1 -0
- angr/utils/segment_list.py +7 -9
- angr/utils/ssa/__init__.py +198 -0
- angr/utils/ssa/tmp_uses_collector.py +23 -0
- angr/utils/ssa/vvar_uses_collector.py +37 -0
- angr/utils/timing.py +2 -2
- angr/utils/typing.py +1 -0
- angr/vaults.py +7 -8
- {angr-9.2.117.dist-info → angr-9.2.118.dist-info}/METADATA +7 -8
- angr-9.2.118.dist-info/RECORD +1344 -0
- {angr-9.2.117.dist-info → angr-9.2.118.dist-info}/WHEEL +1 -1
- angr/analyses/decompiler/optimization_passes/spilled_register_finder.py +0 -18
- angr/analyses/decompiler/seq_cf_structure_counter.py +0 -37
- angr/service.py +0 -35
- angr-9.2.117.dist-info/RECORD +0 -1310
- {angr-9.2.117.dist-info → angr-9.2.118.dist-info}/LICENSE +0 -0
- {angr-9.2.117.dist-info → angr-9.2.118.dist-info}/entry_points.txt +0 -0
- {angr-9.2.117.dist-info → angr-9.2.118.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
+
from typing import Any, NamedTuple, TYPE_CHECKING
|
|
2
3
|
import copy
|
|
3
|
-
from collections import defaultdict, namedtuple
|
|
4
4
|
import logging
|
|
5
5
|
import enum
|
|
6
|
-
from
|
|
7
|
-
from typing import Any, NamedTuple, TYPE_CHECKING
|
|
6
|
+
from collections import defaultdict, namedtuple
|
|
8
7
|
from collections.abc import Iterable
|
|
8
|
+
from dataclasses import dataclass
|
|
9
9
|
|
|
10
10
|
import networkx
|
|
11
11
|
import capstone
|
|
@@ -17,7 +17,7 @@ from ...knowledge_plugins.functions import Function
|
|
|
17
17
|
from ...knowledge_plugins.cfg.memory_data import MemoryDataSort
|
|
18
18
|
from ...codenode import BlockNode
|
|
19
19
|
from ...utils import timethis
|
|
20
|
-
from ...calling_conventions import SimRegArg, SimStackArg,
|
|
20
|
+
from ...calling_conventions import SimRegArg, SimStackArg, SimFunctionArgument
|
|
21
21
|
from ...sim_type import (
|
|
22
22
|
SimTypeChar,
|
|
23
23
|
SimTypeInt,
|
|
@@ -30,7 +30,6 @@ from ...sim_type import (
|
|
|
30
30
|
)
|
|
31
31
|
from ..stack_pointer_tracker import Register, OffsetVal
|
|
32
32
|
from ...sim_variable import SimVariable, SimStackVariable, SimRegisterVariable, SimMemoryVariable
|
|
33
|
-
from ...knowledge_plugins.key_definitions.constants import OP_BEFORE
|
|
34
33
|
from ...procedures.stubs.UnresolvableCallTarget import UnresolvableCallTarget
|
|
35
34
|
from ...procedures.stubs.UnresolvableJumpTarget import UnresolvableJumpTarget
|
|
36
35
|
from .. import Analysis, register_analysis
|
|
@@ -43,10 +42,10 @@ from .optimization_passes import (
|
|
|
43
42
|
OptimizationPassStage,
|
|
44
43
|
RegisterSaveAreaSimplifier,
|
|
45
44
|
StackCanarySimplifier,
|
|
46
|
-
SpilledRegisterFinder,
|
|
47
45
|
DUPLICATING_OPTS,
|
|
48
46
|
CONDENSING_OPTS,
|
|
49
47
|
)
|
|
48
|
+
from .utils import first_nonlabel_statement_id
|
|
50
49
|
|
|
51
50
|
if TYPE_CHECKING:
|
|
52
51
|
from angr.knowledge_plugins.cfg import CFGModel
|
|
@@ -110,6 +109,7 @@ class Clinic(Analysis):
|
|
|
110
109
|
inline_functions: set[Function] | None = frozenset(),
|
|
111
110
|
inlined_counts: dict[int, int] | None = None,
|
|
112
111
|
inlining_parents: set[int] | None = None,
|
|
112
|
+
vvar_id_start: int = 0,
|
|
113
113
|
):
|
|
114
114
|
if not func.normalized and mode == ClinicMode.DECOMPILE:
|
|
115
115
|
raise ValueError("Decompilation must work on normalized function graphs.")
|
|
@@ -120,6 +120,7 @@ class Clinic(Analysis):
|
|
|
120
120
|
self.cc_graph: networkx.DiGraph | None = None
|
|
121
121
|
self.unoptimized_graph: networkx.DiGraph | None = None
|
|
122
122
|
self.arg_list = None
|
|
123
|
+
self.arg_vvars: dict[int, tuple[ailment.Expr.VirtualVariable, SimRegArg]] | None = None
|
|
123
124
|
self.variable_kb = variable_kb
|
|
124
125
|
self.externs: set[SimMemoryVariable] = set()
|
|
125
126
|
self.data_refs: dict[int, int] = {} # data address to instruction address
|
|
@@ -127,6 +128,7 @@ class Clinic(Analysis):
|
|
|
127
128
|
self._func_graph: networkx.DiGraph | None = None
|
|
128
129
|
self._ail_manager = None
|
|
129
130
|
self._blocks_by_addr_and_size = {}
|
|
131
|
+
self._entry_node_addr: tuple[int, int | None] = self.function.addr, None
|
|
130
132
|
|
|
131
133
|
self._fold_callexprs_into_conditions = fold_callexprs_into_conditions
|
|
132
134
|
self._insert_labels = insert_labels
|
|
@@ -141,6 +143,8 @@ class Clinic(Analysis):
|
|
|
141
143
|
self.reaching_definitions: ReachingDefinitionsAnalysis | None = None
|
|
142
144
|
self._cache = cache
|
|
143
145
|
self._mode = mode
|
|
146
|
+
self.vvar_id_start = vvar_id_start
|
|
147
|
+
self.vvar_to_vvar: dict[int, int] | None = None
|
|
144
148
|
|
|
145
149
|
# inlining help
|
|
146
150
|
self._sp_shift = sp_shift
|
|
@@ -296,11 +300,13 @@ class Clinic(Analysis):
|
|
|
296
300
|
callee,
|
|
297
301
|
mode=ClinicMode.DECOMPILE,
|
|
298
302
|
inline_functions=self._inline_functions,
|
|
299
|
-
inlining_parents=self._inlining_parents
|
|
303
|
+
inlining_parents=(*self._inlining_parents, self.function.addr),
|
|
300
304
|
inlined_counts=self._inlined_counts,
|
|
301
|
-
optimization_passes=[StackCanarySimplifier
|
|
305
|
+
optimization_passes=[StackCanarySimplifier],
|
|
302
306
|
sp_shift=self._max_stack_depth,
|
|
307
|
+
vvar_id_start=self.vvar_id_start,
|
|
303
308
|
)
|
|
309
|
+
self.vvar_id_start = callee_clinic.vvar_id_start + 1
|
|
304
310
|
self._max_stack_depth = callee_clinic._max_stack_depth
|
|
305
311
|
callee_graph = callee_clinic.copy_graph()
|
|
306
312
|
|
|
@@ -318,34 +324,29 @@ class Clinic(Analysis):
|
|
|
318
324
|
ail_graph.remove_edge(caller_block, caller_successor)
|
|
319
325
|
|
|
320
326
|
# update all callee return nodes with caller successor
|
|
321
|
-
# and rewrite pseudoreg-tagged spills to actually use pseudoregs
|
|
322
327
|
ail_graph = networkx.union(ail_graph, callee_graph)
|
|
323
328
|
for blk in callee_graph.nodes():
|
|
324
329
|
for idx, stmt in enumerate(list(blk.statements)):
|
|
325
330
|
if isinstance(stmt, ailment.Stmt.Return):
|
|
326
|
-
|
|
327
|
-
None,
|
|
328
|
-
ailment.Expr.Const(None, None, caller_successor.addr, self.project.arch.bits),
|
|
329
|
-
caller_successor.idx,
|
|
330
|
-
**blk.statements[idx].tags,
|
|
331
|
-
)
|
|
331
|
+
# replace the return statement with an assignment to the return register
|
|
332
332
|
blk.statements.pop(idx)
|
|
333
|
+
|
|
334
|
+
if stmt.ret_exprs:
|
|
335
|
+
assign_to_retreg = ailment.Stmt.Assignment(
|
|
336
|
+
self._ail_manager.next_atom(),
|
|
337
|
+
ailment.Expr.Register(
|
|
338
|
+
self._ail_manager.next_atom(),
|
|
339
|
+
None,
|
|
340
|
+
self.project.arch.ret_offset,
|
|
341
|
+
self.project.arch.bits,
|
|
342
|
+
),
|
|
343
|
+
stmt.ret_exprs[0],
|
|
344
|
+
**stmt.tags,
|
|
345
|
+
)
|
|
346
|
+
blk.statements.insert(idx, assign_to_retreg)
|
|
347
|
+
idx += 1
|
|
333
348
|
ail_graph.add_edge(blk, caller_successor)
|
|
334
349
|
break
|
|
335
|
-
if "pseudoreg" in stmt.tags and isinstance(stmt, ailment.Stmt.Store):
|
|
336
|
-
new_stmt = ailment.Stmt.Assignment(
|
|
337
|
-
stmt.idx, ailment.Expr.Register(None, None, stmt.pseudoreg, stmt.size * 8), stmt.data
|
|
338
|
-
)
|
|
339
|
-
new_stmt.tags.update(stmt.tags)
|
|
340
|
-
new_stmt.tags.pop("pseudoreg")
|
|
341
|
-
blk.statements[idx] = new_stmt
|
|
342
|
-
if "pseudoreg" in stmt.tags and isinstance(stmt, ailment.Stmt.Assignment):
|
|
343
|
-
new_stmt = ailment.Stmt.Assignment(
|
|
344
|
-
stmt.idx, stmt.dst, ailment.Expr.Register(None, None, stmt.pseudoreg, stmt.src.size * 8)
|
|
345
|
-
)
|
|
346
|
-
new_stmt.tags.update(stmt.tags)
|
|
347
|
-
new_stmt.tags.pop("pseudoreg")
|
|
348
|
-
blk.statements[idx] = new_stmt
|
|
349
350
|
|
|
350
351
|
# update the call edge
|
|
351
352
|
caller_block.statements[call_idx] = ailment.Stmt.Jump(
|
|
@@ -372,6 +373,20 @@ class Clinic(Analysis):
|
|
|
372
373
|
and caller_block.statements[call_idx - 1].data.value == caller_successor.addr
|
|
373
374
|
):
|
|
374
375
|
caller_block.statements.pop(call_idx - 1) # s_10 =L 0x401225<64><8>
|
|
376
|
+
|
|
377
|
+
# update caller_block to setup parameters
|
|
378
|
+
if callee_clinic.arg_vvars:
|
|
379
|
+
for arg_idx in sorted(callee_clinic.arg_vvars.keys()):
|
|
380
|
+
param_vvar, reg_arg = callee_clinic.arg_vvars[arg_idx]
|
|
381
|
+
reg_offset = reg_arg.reg
|
|
382
|
+
stmt = ailment.Stmt.Assignment(
|
|
383
|
+
self._ail_manager.next_atom(),
|
|
384
|
+
param_vvar,
|
|
385
|
+
ailment.Expr.Register(self._ail_manager.next_atom(), None, reg_offset, reg_arg.bits),
|
|
386
|
+
ins_addr=caller_block.addr + caller_block.original_size,
|
|
387
|
+
)
|
|
388
|
+
caller_block.statements.append(stmt)
|
|
389
|
+
|
|
375
390
|
ail_graph.add_edge(caller_block, callee_start)
|
|
376
391
|
|
|
377
392
|
return ail_graph
|
|
@@ -398,8 +413,22 @@ class Clinic(Analysis):
|
|
|
398
413
|
if self.function.prototype is None or not isinstance(self.function.prototype.returnty, SimTypeBottom):
|
|
399
414
|
ail_graph = self._make_returns(ail_graph)
|
|
400
415
|
|
|
416
|
+
ail_graph = self._run_simplification_passes(
|
|
417
|
+
ail_graph, stage=OptimizationPassStage.BEFORE_SSA_LEVEL0_TRANSFORMATION
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
# Make function arguments
|
|
421
|
+
self._update_progress(33.0, text="Making argument list")
|
|
422
|
+
arg_list = self._make_argument_list()
|
|
423
|
+
arg_vvars = {}
|
|
424
|
+
ail_graph = self._create_argument_accessing_statements(arg_list, ail_graph, arg_vvars)
|
|
425
|
+
|
|
426
|
+
# Transform the graph into partial SSA form
|
|
427
|
+
self._update_progress(35.0, text="Transforming to partial-SSA form")
|
|
428
|
+
ail_graph = self._transform_to_ssa_level0(ail_graph)
|
|
429
|
+
|
|
401
430
|
# full-function constant-only propagation
|
|
402
|
-
self._update_progress(
|
|
431
|
+
self._update_progress(36.0, text="Constant propagation")
|
|
403
432
|
self._simplify_function(
|
|
404
433
|
ail_graph,
|
|
405
434
|
remove_dead_memdefs=False,
|
|
@@ -414,13 +443,13 @@ class Clinic(Analysis):
|
|
|
414
443
|
block_simplification_cache: dict[ailment.Block, NamedTuple] | None = {}
|
|
415
444
|
|
|
416
445
|
# Track stack pointers
|
|
417
|
-
self._update_progress(
|
|
446
|
+
self._update_progress(37.0, text="Tracking stack pointers")
|
|
418
447
|
spt = self._track_stack_pointers()
|
|
419
448
|
|
|
420
449
|
# Simplify blocks
|
|
421
450
|
# we never remove dead memory definitions before making callsites. otherwise stack arguments may go missing
|
|
422
451
|
# before they are recognized as stack arguments.
|
|
423
|
-
self._update_progress(
|
|
452
|
+
self._update_progress(38.0, text="Simplifying blocks 1")
|
|
424
453
|
ail_graph = self._simplify_blocks(
|
|
425
454
|
ail_graph, stack_pointer_tracker=spt, remove_dead_memdefs=False, cache=block_simplification_cache
|
|
426
455
|
)
|
|
@@ -440,6 +469,7 @@ class Clinic(Analysis):
|
|
|
440
469
|
unify_variables=False,
|
|
441
470
|
narrow_expressions=True,
|
|
442
471
|
fold_callexprs_into_conditions=self._fold_callexprs_into_conditions,
|
|
472
|
+
arg_vvars=arg_vvars,
|
|
443
473
|
)
|
|
444
474
|
|
|
445
475
|
# Run simplification passes again. there might be more chances for peephole optimizations after function-level
|
|
@@ -449,13 +479,16 @@ class Clinic(Analysis):
|
|
|
449
479
|
ail_graph, stack_pointer_tracker=spt, remove_dead_memdefs=False, cache=block_simplification_cache
|
|
450
480
|
)
|
|
451
481
|
|
|
482
|
+
# rewrite (qualified) stack variables into SSA form
|
|
483
|
+
ail_graph = self._transform_to_ssa_level1(ail_graph)
|
|
484
|
+
|
|
452
485
|
# clear _blocks_by_addr_and_size so no one can use it again
|
|
453
486
|
# TODO: Totally remove this dict
|
|
454
487
|
self._blocks_by_addr_and_size = None
|
|
455
488
|
|
|
456
489
|
# Make call-sites
|
|
457
490
|
self._update_progress(50.0, text="Making callsites")
|
|
458
|
-
_, stackarg_offsets = self._make_callsites(ail_graph, stack_pointer_tracker=spt)
|
|
491
|
+
_, stackarg_offsets, removed_vvar_ids = self._make_callsites(ail_graph, stack_pointer_tracker=spt)
|
|
459
492
|
|
|
460
493
|
# Run simplification passes
|
|
461
494
|
self._update_progress(53.0, text="Running simplifications 2")
|
|
@@ -470,6 +503,8 @@ class Clinic(Analysis):
|
|
|
470
503
|
unify_variables=True,
|
|
471
504
|
narrow_expressions=True,
|
|
472
505
|
fold_callexprs_into_conditions=self._fold_callexprs_into_conditions,
|
|
506
|
+
removed_vvar_ids=removed_vvar_ids,
|
|
507
|
+
arg_vvars=arg_vvars,
|
|
473
508
|
)
|
|
474
509
|
|
|
475
510
|
# After global optimization, there might be more chances for peephole optimizations.
|
|
@@ -495,9 +530,10 @@ class Clinic(Analysis):
|
|
|
495
530
|
unify_variables=True,
|
|
496
531
|
narrow_expressions=True,
|
|
497
532
|
fold_callexprs_into_conditions=self._fold_callexprs_into_conditions,
|
|
533
|
+
arg_vvars=arg_vvars,
|
|
498
534
|
)
|
|
499
535
|
|
|
500
|
-
self._update_progress(
|
|
536
|
+
self._update_progress(75.0, text="Simplifying blocks 4")
|
|
501
537
|
ail_graph = self._simplify_blocks(
|
|
502
538
|
ail_graph,
|
|
503
539
|
remove_dead_memdefs=self._remove_dead_memdefs,
|
|
@@ -505,31 +541,47 @@ class Clinic(Analysis):
|
|
|
505
541
|
cache=block_simplification_cache,
|
|
506
542
|
)
|
|
507
543
|
|
|
508
|
-
#
|
|
509
|
-
self._update_progress(
|
|
510
|
-
|
|
544
|
+
# Simplify the entire function for the fourth time
|
|
545
|
+
self._update_progress(78.0, text="Simplifying function 4")
|
|
546
|
+
self._simplify_function(
|
|
547
|
+
ail_graph,
|
|
548
|
+
remove_dead_memdefs=self._remove_dead_memdefs,
|
|
549
|
+
stack_arg_offsets=stackarg_offsets,
|
|
550
|
+
unify_variables=True,
|
|
551
|
+
narrow_expressions=True,
|
|
552
|
+
fold_callexprs_into_conditions=self._fold_callexprs_into_conditions,
|
|
553
|
+
arg_vvars=arg_vvars,
|
|
554
|
+
)
|
|
555
|
+
|
|
556
|
+
# update arg_list
|
|
557
|
+
arg_list = []
|
|
558
|
+
for idx in sorted(arg_vvars):
|
|
559
|
+
arg_list.append(arg_vvars[idx][1])
|
|
560
|
+
|
|
561
|
+
# Get virtual variable mapping that can de-phi the SSA representation
|
|
562
|
+
vvar2vvar = self._collect_dephi_vvar_mapping_and_rewrite_blocks(ail_graph)
|
|
511
563
|
|
|
512
564
|
# Recover variables on AIL blocks
|
|
513
565
|
self._update_progress(80.0, text="Recovering variables")
|
|
514
|
-
variable_kb = self._recover_and_link_variables(ail_graph, arg_list)
|
|
566
|
+
variable_kb = self._recover_and_link_variables(ail_graph, arg_list, arg_vvars, vvar2vvar)
|
|
567
|
+
|
|
568
|
+
# Run simplification passes
|
|
569
|
+
self._update_progress(85.0, text="Running simplifications 4")
|
|
570
|
+
ail_graph = self._run_simplification_passes(ail_graph, stage=OptimizationPassStage.AFTER_VARIABLE_RECOVERY)
|
|
515
571
|
|
|
516
572
|
# Make function prototype
|
|
517
573
|
self._update_progress(90.0, text="Making function prototype")
|
|
518
574
|
self._make_function_prototype(arg_list, variable_kb)
|
|
519
575
|
|
|
520
|
-
# Run simplification passes
|
|
521
|
-
self._update_progress(95.0, text="Running simplifications 4")
|
|
522
|
-
ail_graph = self._run_simplification_passes(
|
|
523
|
-
ail_graph, stage=OptimizationPassStage.AFTER_VARIABLE_RECOVERY, variable_kb=variable_kb
|
|
524
|
-
)
|
|
525
|
-
|
|
526
576
|
# remove empty nodes from the graph
|
|
527
577
|
ail_graph = self.remove_empty_nodes(ail_graph)
|
|
528
578
|
|
|
529
579
|
self.arg_list = arg_list
|
|
580
|
+
self.arg_vvars = arg_vvars
|
|
530
581
|
self.variable_kb = variable_kb
|
|
531
582
|
self.cc_graph = self.copy_graph(ail_graph)
|
|
532
583
|
self.externs = self._collect_externs(ail_graph, variable_kb)
|
|
584
|
+
self.vvar_to_vvar = vvar2vvar
|
|
533
585
|
return ail_graph
|
|
534
586
|
|
|
535
587
|
def _analyze_for_data_refs(self):
|
|
@@ -660,6 +712,14 @@ class Clinic(Analysis):
|
|
|
660
712
|
if self._func_graph.in_degree(node) == 0 and CFGBase._is_noop_block(
|
|
661
713
|
self.project.arch, self.project.factory.block(node.addr, node.size)
|
|
662
714
|
):
|
|
715
|
+
if (node.addr, None) == self._entry_node_addr:
|
|
716
|
+
# this is the entry node. after removing this node, the new entry node will be its successor
|
|
717
|
+
if self._func_graph.out_degree[node] == 1:
|
|
718
|
+
succ = next(iter(self._func_graph.successors(node)))
|
|
719
|
+
self._entry_node_addr = succ.addr, None
|
|
720
|
+
else:
|
|
721
|
+
# we just don't remove this node...
|
|
722
|
+
continue
|
|
663
723
|
self._func_graph.remove_node(node)
|
|
664
724
|
|
|
665
725
|
@timethis
|
|
@@ -756,17 +816,21 @@ class Clinic(Analysis):
|
|
|
756
816
|
)
|
|
757
817
|
if callsite_ail_block is not None and callsite_ail_block.statements:
|
|
758
818
|
last_stmt = callsite_ail_block.statements[-1]
|
|
759
|
-
if
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
819
|
+
if (
|
|
820
|
+
isinstance(last_stmt, ailment.Stmt.Call)
|
|
821
|
+
and last_stmt.ret_expr is None
|
|
822
|
+
and isinstance(cc.cc.RETURN_VAL, SimRegArg)
|
|
823
|
+
):
|
|
824
|
+
reg_offset, reg_size = self.project.arch.registers[cc.cc.RETURN_VAL.reg_name]
|
|
825
|
+
last_stmt.ret_expr = ailment.Expr.Register(
|
|
826
|
+
None,
|
|
827
|
+
None,
|
|
828
|
+
reg_offset,
|
|
829
|
+
reg_size * 8,
|
|
830
|
+
ins_addr=callsite_ins_addr,
|
|
831
|
+
reg_name=cc.cc.RETURN_VAL.reg_name,
|
|
832
|
+
)
|
|
833
|
+
last_stmt.bits = reg_size * 8
|
|
770
834
|
|
|
771
835
|
# finally, recover the calling convention of the current function
|
|
772
836
|
if self.function.prototype is None or self.function.calling_convention is None:
|
|
@@ -862,11 +926,9 @@ class Clinic(Analysis):
|
|
|
862
926
|
ins_addr=block_node.addr,
|
|
863
927
|
)
|
|
864
928
|
]
|
|
865
|
-
|
|
866
|
-
return ail_block
|
|
929
|
+
return ailment.Block(block_node.addr, block_node.size, statements=statements)
|
|
867
930
|
|
|
868
|
-
|
|
869
|
-
return ail_block
|
|
931
|
+
return ailment.IRSBConverter.convert(block.vex, self._ail_manager)
|
|
870
932
|
|
|
871
933
|
@timethis
|
|
872
934
|
def _replace_single_target_indirect_transitions(self, ail_graph: networkx.DiGraph) -> networkx.DiGraph:
|
|
@@ -965,8 +1027,7 @@ class Clinic(Analysis):
|
|
|
965
1027
|
|
|
966
1028
|
@timethis
|
|
967
1029
|
def _make_ailgraph(self) -> networkx.DiGraph:
|
|
968
|
-
|
|
969
|
-
return graph
|
|
1030
|
+
return self._function_graph_to_ail_graph(self._func_graph)
|
|
970
1031
|
|
|
971
1032
|
@timethis
|
|
972
1033
|
def _simplify_blocks(
|
|
@@ -1055,6 +1116,8 @@ class Clinic(Analysis):
|
|
|
1055
1116
|
only_consts=False,
|
|
1056
1117
|
fold_callexprs_into_conditions=False,
|
|
1057
1118
|
rewrite_ccalls=True,
|
|
1119
|
+
removed_vvar_ids: set[int] | None = None,
|
|
1120
|
+
arg_vvars: dict[int, tuple[ailment.Expr.VirtualVariable, SimVariable]] | None = None,
|
|
1058
1121
|
) -> None:
|
|
1059
1122
|
"""
|
|
1060
1123
|
Simplify the entire function until it reaches a fixed point.
|
|
@@ -1071,6 +1134,8 @@ class Clinic(Analysis):
|
|
|
1071
1134
|
only_consts=only_consts,
|
|
1072
1135
|
fold_callexprs_into_conditions=fold_callexprs_into_conditions,
|
|
1073
1136
|
rewrite_ccalls=rewrite_ccalls,
|
|
1137
|
+
removed_vvar_ids=removed_vvar_ids,
|
|
1138
|
+
arg_vvars=arg_vvars,
|
|
1074
1139
|
)
|
|
1075
1140
|
if not simplified:
|
|
1076
1141
|
break
|
|
@@ -1086,6 +1151,8 @@ class Clinic(Analysis):
|
|
|
1086
1151
|
only_consts=False,
|
|
1087
1152
|
fold_callexprs_into_conditions=False,
|
|
1088
1153
|
rewrite_ccalls=True,
|
|
1154
|
+
removed_vvar_ids: set[int] | None = None,
|
|
1155
|
+
arg_vvars: dict[int, tuple[ailment.Expr.VirtualVariable, SimVariable]] | None = None,
|
|
1089
1156
|
):
|
|
1090
1157
|
"""
|
|
1091
1158
|
Simplify the entire function once.
|
|
@@ -1106,6 +1173,8 @@ class Clinic(Analysis):
|
|
|
1106
1173
|
fold_callexprs_into_conditions=fold_callexprs_into_conditions,
|
|
1107
1174
|
use_callee_saved_regs_at_return=not self._register_save_areas_removed,
|
|
1108
1175
|
rewrite_ccalls=rewrite_ccalls,
|
|
1176
|
+
removed_vvar_ids=removed_vvar_ids,
|
|
1177
|
+
arg_vvars=arg_vvars,
|
|
1109
1178
|
)
|
|
1110
1179
|
# cache the simplifier's RDA analysis
|
|
1111
1180
|
self.reaching_definitions = simp._reaching_definitions
|
|
@@ -1133,7 +1202,7 @@ class Clinic(Analysis):
|
|
|
1133
1202
|
|
|
1134
1203
|
# Run each pass
|
|
1135
1204
|
for pass_ in self._optimization_passes:
|
|
1136
|
-
if pass_.STAGE
|
|
1205
|
+
if stage != pass_.STAGE:
|
|
1137
1206
|
continue
|
|
1138
1207
|
|
|
1139
1208
|
if pass_ in DUPLICATING_OPTS + CONDENSING_OPTS and self.unoptimized_graph is None:
|
|
@@ -1147,6 +1216,7 @@ class Clinic(Analysis):
|
|
|
1147
1216
|
blocks_by_addr_and_idx=addr_and_idx_to_blocks,
|
|
1148
1217
|
graph=ail_graph,
|
|
1149
1218
|
variable_kb=variable_kb,
|
|
1219
|
+
vvar_id_start=self.vvar_id_start,
|
|
1150
1220
|
**kwargs,
|
|
1151
1221
|
)
|
|
1152
1222
|
if a.out_graph:
|
|
@@ -1157,9 +1227,107 @@ class Clinic(Analysis):
|
|
|
1157
1227
|
self._register_save_areas_removed = True
|
|
1158
1228
|
# clear the cached RDA result
|
|
1159
1229
|
self.reaching_definitions = None
|
|
1230
|
+
self.vvar_id_start = a.vvar_id_start
|
|
1160
1231
|
|
|
1161
1232
|
return ail_graph
|
|
1162
1233
|
|
|
1234
|
+
@timethis
|
|
1235
|
+
def _create_argument_accessing_statements(
|
|
1236
|
+
self,
|
|
1237
|
+
arg_list: list[SimVariable],
|
|
1238
|
+
ail_graph: networkx.DiGraph,
|
|
1239
|
+
arg_vvars: dict[int, tuple[ailment.Expr.VirtualVariable, SimVariable]],
|
|
1240
|
+
) -> networkx.DiGraph:
|
|
1241
|
+
entrypoint = next(iter(bb for bb in ail_graph if (bb.addr, bb.idx) == self._entry_node_addr))
|
|
1242
|
+
new_stmts = []
|
|
1243
|
+
for arg in arg_list:
|
|
1244
|
+
if not isinstance(arg, SimRegisterVariable):
|
|
1245
|
+
continue
|
|
1246
|
+
|
|
1247
|
+
# get the full register if needed
|
|
1248
|
+
basereg_offset, basereg_size = self.project.arch.get_base_register(arg.reg, size=arg.size)
|
|
1249
|
+
|
|
1250
|
+
arg_vvar = ailment.Expr.VirtualVariable(
|
|
1251
|
+
self._ail_manager.next_atom(),
|
|
1252
|
+
self.vvar_id_start,
|
|
1253
|
+
arg.bits,
|
|
1254
|
+
ailment.Expr.VirtualVariableCategory.PARAMETER,
|
|
1255
|
+
oident=arg.reg,
|
|
1256
|
+
ins_addr=self.function.addr,
|
|
1257
|
+
)
|
|
1258
|
+
self.vvar_id_start += 1
|
|
1259
|
+
arg_vvars[arg_vvar.varid] = arg_vvar, arg
|
|
1260
|
+
|
|
1261
|
+
if basereg_size != arg.size:
|
|
1262
|
+
# extend the value to the full register
|
|
1263
|
+
arg_vvar = ailment.Expr.Convert(
|
|
1264
|
+
self._ail_manager.next_atom(),
|
|
1265
|
+
arg.size * self.project.arch.byte_width,
|
|
1266
|
+
basereg_size * self.project.arch.byte_width,
|
|
1267
|
+
False,
|
|
1268
|
+
arg_vvar,
|
|
1269
|
+
ins_addr=self.function.addr,
|
|
1270
|
+
)
|
|
1271
|
+
|
|
1272
|
+
fullreg_dst = ailment.Expr.Register(
|
|
1273
|
+
self._ail_manager.next_atom(),
|
|
1274
|
+
None,
|
|
1275
|
+
basereg_offset,
|
|
1276
|
+
basereg_size * self.project.arch.byte_width,
|
|
1277
|
+
ins_addr=self.function.addr,
|
|
1278
|
+
)
|
|
1279
|
+
stmt = ailment.Stmt.Assignment(
|
|
1280
|
+
self._ail_manager.next_atom(),
|
|
1281
|
+
fullreg_dst,
|
|
1282
|
+
arg_vvar,
|
|
1283
|
+
ins_addr=self.function.addr,
|
|
1284
|
+
)
|
|
1285
|
+
new_stmts.append(stmt)
|
|
1286
|
+
|
|
1287
|
+
non_label_stmt_idx = first_nonlabel_statement_id(entrypoint)
|
|
1288
|
+
# update the ail block in-place
|
|
1289
|
+
entrypoint.statements = (
|
|
1290
|
+
entrypoint.statements[:non_label_stmt_idx] + new_stmts + entrypoint.statements[non_label_stmt_idx:]
|
|
1291
|
+
)
|
|
1292
|
+
return ail_graph
|
|
1293
|
+
|
|
1294
|
+
@timethis
|
|
1295
|
+
def _transform_to_ssa_level0(self, ail_graph: networkx.DiGraph) -> networkx.DiGraph:
|
|
1296
|
+
ssailification = self.project.analyses.Ssailification(
|
|
1297
|
+
self.function,
|
|
1298
|
+
ail_graph,
|
|
1299
|
+
entry=next(iter(bb for bb in ail_graph if (bb.addr, bb.idx) == self._entry_node_addr)),
|
|
1300
|
+
ail_manager=self._ail_manager,
|
|
1301
|
+
ssa_stackvars=False,
|
|
1302
|
+
vvar_id_start=self.vvar_id_start,
|
|
1303
|
+
)
|
|
1304
|
+
self.vvar_id_start = ssailification.max_vvar_id + 1
|
|
1305
|
+
return ssailification.out_graph
|
|
1306
|
+
|
|
1307
|
+
@timethis
|
|
1308
|
+
def _transform_to_ssa_level1(self, ail_graph: networkx.DiGraph) -> networkx.DiGraph:
|
|
1309
|
+
ssailification = self.project.analyses.Ssailification(
|
|
1310
|
+
self.function,
|
|
1311
|
+
ail_graph,
|
|
1312
|
+
entry=next(iter(bb for bb in ail_graph if (bb.addr, bb.idx) == self._entry_node_addr)),
|
|
1313
|
+
ail_manager=self._ail_manager,
|
|
1314
|
+
ssa_stackvars=True,
|
|
1315
|
+
vvar_id_start=self.vvar_id_start,
|
|
1316
|
+
)
|
|
1317
|
+
self.vvar_id_start = ssailification.max_vvar_id + 1
|
|
1318
|
+
return ssailification.out_graph
|
|
1319
|
+
|
|
1320
|
+
@timethis
|
|
1321
|
+
def _collect_dephi_vvar_mapping_and_rewrite_blocks(self, ail_graph: networkx.DiGraph) -> dict[int, int]:
|
|
1322
|
+
dephication = self.project.analyses.GraphDephicationVVarMapping(
|
|
1323
|
+
self.function,
|
|
1324
|
+
ail_graph,
|
|
1325
|
+
entry=next(iter(bb for bb in ail_graph if (bb.addr, bb.idx) == self._entry_node_addr)),
|
|
1326
|
+
vvar_id_start=self.vvar_id_start,
|
|
1327
|
+
)
|
|
1328
|
+
self.vvar_id_start = dephication.vvar_id_start + 1
|
|
1329
|
+
return dephication.vvar_to_vvar_mapping
|
|
1330
|
+
|
|
1163
1331
|
@timethis
|
|
1164
1332
|
def _make_argument_list(self) -> list[SimVariable]:
|
|
1165
1333
|
if self.function.calling_convention is not None and self.function.prototype is not None:
|
|
@@ -1185,15 +1353,13 @@ class Clinic(Analysis):
|
|
|
1185
1353
|
name=arg_names[idx],
|
|
1186
1354
|
region=self.function.addr,
|
|
1187
1355
|
)
|
|
1188
|
-
|
|
1356
|
+
else:
|
|
1189
1357
|
argvar = SimVariable(
|
|
1190
1358
|
ident="arg_%d" % idx,
|
|
1191
1359
|
name=arg_names[idx],
|
|
1192
1360
|
region=self.function.addr,
|
|
1193
1361
|
size=arg.size,
|
|
1194
1362
|
)
|
|
1195
|
-
else:
|
|
1196
|
-
raise TypeError("Unsupported function argument type %s." % type(arg))
|
|
1197
1363
|
arg_vars.append(argvar)
|
|
1198
1364
|
return arg_vars
|
|
1199
1365
|
return []
|
|
@@ -1202,20 +1368,18 @@ class Clinic(Analysis):
|
|
|
1202
1368
|
def _make_callsites(self, ail_graph, stack_pointer_tracker=None):
|
|
1203
1369
|
"""
|
|
1204
1370
|
Simplify all function call statements.
|
|
1205
|
-
|
|
1206
|
-
:return: None
|
|
1207
1371
|
"""
|
|
1208
1372
|
|
|
1209
1373
|
# Computing reaching definitions
|
|
1210
|
-
rd = self.project.analyses.
|
|
1374
|
+
rd = self.project.analyses.SReachingDefinitions(
|
|
1211
1375
|
subject=self.function,
|
|
1212
1376
|
func_graph=ail_graph,
|
|
1213
|
-
|
|
1214
|
-
use_callee_saved_regs_at_return=not self._register_save_areas_removed,
|
|
1377
|
+
# use_callee_saved_regs_at_return=not self._register_save_areas_removed, FIXME
|
|
1215
1378
|
)
|
|
1216
1379
|
|
|
1217
1380
|
class TempClass: # pylint:disable=missing-class-docstring
|
|
1218
1381
|
stack_arg_offsets = set()
|
|
1382
|
+
removed_vvar_ids = set()
|
|
1219
1383
|
|
|
1220
1384
|
def _handler(block):
|
|
1221
1385
|
csm = self.project.analyses.AILCallSiteMaker(
|
|
@@ -1226,35 +1390,30 @@ class Clinic(Analysis):
|
|
|
1226
1390
|
)
|
|
1227
1391
|
if csm.stack_arg_offsets is not None:
|
|
1228
1392
|
TempClass.stack_arg_offsets |= csm.stack_arg_offsets
|
|
1229
|
-
if csm.
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1393
|
+
if csm.removed_vvar_ids:
|
|
1394
|
+
TempClass.removed_vvar_ids |= csm.removed_vvar_ids
|
|
1395
|
+
if csm.result_block and csm.result_block != block:
|
|
1396
|
+
ail_block = csm.result_block
|
|
1397
|
+
simp = self.project.analyses.AILBlockSimplifier(
|
|
1398
|
+
ail_block,
|
|
1399
|
+
self.function.addr,
|
|
1400
|
+
stack_pointer_tracker=stack_pointer_tracker,
|
|
1401
|
+
peephole_optimizations=self.peephole_optimizations,
|
|
1402
|
+
)
|
|
1403
|
+
return simp.result_block
|
|
1240
1404
|
return None
|
|
1241
1405
|
|
|
1242
1406
|
# rewriting call-sites at this point, pre-inlining, causes issues with incorrect call signatures
|
|
1243
1407
|
if not self._inlining_parents:
|
|
1244
1408
|
AILGraphWalker(ail_graph, _handler, replace_nodes=True).walk()
|
|
1245
1409
|
|
|
1246
|
-
return ail_graph, TempClass.stack_arg_offsets
|
|
1410
|
+
return ail_graph, TempClass.stack_arg_offsets, TempClass.removed_vvar_ids
|
|
1247
1411
|
|
|
1248
1412
|
@timethis
|
|
1249
1413
|
def _make_returns(self, ail_graph: networkx.DiGraph) -> networkx.DiGraph:
|
|
1250
1414
|
"""
|
|
1251
1415
|
Work on each return statement and fill in its return expressions.
|
|
1252
1416
|
"""
|
|
1253
|
-
if self._inlining_parents:
|
|
1254
|
-
# for inlining, we want to keep the return statement separate from the return value, so that
|
|
1255
|
-
# the former can be removed while preserving the latter
|
|
1256
|
-
return ail_graph
|
|
1257
|
-
|
|
1258
1417
|
if self.function.calling_convention is None:
|
|
1259
1418
|
# unknown calling convention. cannot do much about return expressions.
|
|
1260
1419
|
return ail_graph
|
|
@@ -1309,7 +1468,13 @@ class Clinic(Analysis):
|
|
|
1309
1468
|
self.function.is_prototype_guessed = False
|
|
1310
1469
|
|
|
1311
1470
|
@timethis
|
|
1312
|
-
def _recover_and_link_variables(
|
|
1471
|
+
def _recover_and_link_variables(
|
|
1472
|
+
self,
|
|
1473
|
+
ail_graph,
|
|
1474
|
+
arg_list: list,
|
|
1475
|
+
arg_vvars: dict[int, tuple[ailment.Expr.VirtualVariable, SimVariable]],
|
|
1476
|
+
vvar2vvar: dict[int, int],
|
|
1477
|
+
):
|
|
1313
1478
|
# variable recovery
|
|
1314
1479
|
tmp_kb = KnowledgeBase(self.project) if self.variable_kb is None else self.variable_kb
|
|
1315
1480
|
tmp_kb.functions = self.kb.functions
|
|
@@ -1320,6 +1485,8 @@ class Clinic(Analysis):
|
|
|
1320
1485
|
track_sp=False,
|
|
1321
1486
|
func_args=arg_list,
|
|
1322
1487
|
unify_variables=False,
|
|
1488
|
+
func_arg_vvars=arg_vvars,
|
|
1489
|
+
vvar_to_vvar=vvar2vvar,
|
|
1323
1490
|
)
|
|
1324
1491
|
# get ground-truth types
|
|
1325
1492
|
var_manager = tmp_kb.variables[self.function.addr]
|
|
@@ -1382,6 +1549,7 @@ class Clinic(Analysis):
|
|
|
1382
1549
|
labels=self.kb.labels,
|
|
1383
1550
|
arg_names=self.function.prototype.arg_names if self.function.prototype else None,
|
|
1384
1551
|
reset=self._reset_variable_names,
|
|
1552
|
+
func_blocks=list(ail_graph),
|
|
1385
1553
|
)
|
|
1386
1554
|
|
|
1387
1555
|
# Link variables to each statement
|
|
@@ -1406,6 +1574,14 @@ class Clinic(Analysis):
|
|
|
1406
1574
|
offset = var.offset
|
|
1407
1575
|
if offset in variable_manager.stack_offset_to_struct_member_info:
|
|
1408
1576
|
stmt.tags["struct_member_info"] = variable_manager.stack_offset_to_struct_member_info[offset]
|
|
1577
|
+
elif (
|
|
1578
|
+
isinstance(stmt, ailment.Stmt.Assignment)
|
|
1579
|
+
and isinstance(stmt.dst, ailment.Expr.VirtualVariable)
|
|
1580
|
+
and stmt.dst.was_stack
|
|
1581
|
+
):
|
|
1582
|
+
offset = stmt.dst.stack_offset
|
|
1583
|
+
if offset in variable_manager.stack_offset_to_struct_member_info:
|
|
1584
|
+
stmt.dst.tags["struct_member_info"] = variable_manager.stack_offset_to_struct_member_info[offset]
|
|
1409
1585
|
|
|
1410
1586
|
def _link_variables_on_block(self, block, kb):
|
|
1411
1587
|
"""
|
|
@@ -1499,6 +1675,13 @@ class Clinic(Analysis):
|
|
|
1499
1675
|
expr.variable = reg_var
|
|
1500
1676
|
expr.variable_offset = offset
|
|
1501
1677
|
|
|
1678
|
+
elif type(expr) is ailment.Expr.VirtualVariable:
|
|
1679
|
+
vars_ = variable_manager.find_variables_by_atom(block.addr, stmt_idx, expr, block_idx=block.idx)
|
|
1680
|
+
if len(vars_) >= 1:
|
|
1681
|
+
var, offset = next(iter(vars_))
|
|
1682
|
+
expr.variable = var
|
|
1683
|
+
expr.variable_offset = offset
|
|
1684
|
+
|
|
1502
1685
|
elif type(expr) is ailment.Expr.Load:
|
|
1503
1686
|
variables = variable_manager.find_variables_by_atom(block.addr, stmt_idx, expr, block_idx=block.idx)
|
|
1504
1687
|
if len(variables) == 0:
|
|
@@ -1510,10 +1693,11 @@ class Clinic(Analysis):
|
|
|
1510
1693
|
self._link_variables_on_expr(variable_manager, global_variables, block, stmt_idx, stmt, base_addr)
|
|
1511
1694
|
|
|
1512
1695
|
# if we are accessing the variable directly (offset == 0), we link the variable onto this expression
|
|
1513
|
-
if
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1696
|
+
if (
|
|
1697
|
+
offset == 0 or (isinstance(offset, ailment.Expr.Const) and offset.value == 0)
|
|
1698
|
+
) and "reference_variable" in base_addr.tags:
|
|
1699
|
+
expr.variable = base_addr.reference_variable
|
|
1700
|
+
expr.variable_offset = base_addr.reference_variable_offset
|
|
1517
1701
|
|
|
1518
1702
|
if base_addr is None and offset is None:
|
|
1519
1703
|
# this is a local variable
|
|
@@ -1588,17 +1772,16 @@ class Clinic(Analysis):
|
|
|
1588
1772
|
else:
|
|
1589
1773
|
# global variable?
|
|
1590
1774
|
global_vars = global_variables.get_global_variables(expr.value)
|
|
1591
|
-
if
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
if
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
global_vars = {global_var}
|
|
1775
|
+
# detect if there is a related symbol
|
|
1776
|
+
if not global_vars and self.project.loader.find_object_containing(expr.value):
|
|
1777
|
+
symbol = self.project.loader.find_symbol(expr.value)
|
|
1778
|
+
if symbol is not None:
|
|
1779
|
+
# Create a new global variable if there isn't one already
|
|
1780
|
+
global_vars = global_variables.get_global_variables(symbol.rebased_addr)
|
|
1781
|
+
if not global_vars:
|
|
1782
|
+
global_var = SimMemoryVariable(symbol.rebased_addr, symbol.size, name=symbol.name)
|
|
1783
|
+
global_variables.add_variable("global", global_var.addr, global_var)
|
|
1784
|
+
global_vars = {global_var}
|
|
1602
1785
|
if global_vars:
|
|
1603
1786
|
global_var = next(iter(global_vars))
|
|
1604
1787
|
expr.tags["reference_variable"] = global_var
|
|
@@ -1638,9 +1821,12 @@ class Clinic(Analysis):
|
|
|
1638
1821
|
|
|
1639
1822
|
ite_ins_addrs = []
|
|
1640
1823
|
for stmt in block.statements:
|
|
1641
|
-
if
|
|
1642
|
-
|
|
1643
|
-
|
|
1824
|
+
if (
|
|
1825
|
+
isinstance(stmt, ailment.Stmt.Assignment)
|
|
1826
|
+
and isinstance(stmt.src, ailment.Expr.ITE)
|
|
1827
|
+
and stmt.ins_addr not in ite_ins_addrs
|
|
1828
|
+
):
|
|
1829
|
+
ite_ins_addrs.append(stmt.ins_addr)
|
|
1644
1830
|
|
|
1645
1831
|
if ite_ins_addrs:
|
|
1646
1832
|
block_addr = block.addr
|
|
@@ -1968,31 +2154,22 @@ class Clinic(Analysis):
|
|
|
1968
2154
|
def _next_atom(self) -> int:
|
|
1969
2155
|
return self._ail_manager.next_atom()
|
|
1970
2156
|
|
|
1971
|
-
@staticmethod
|
|
1972
|
-
def _make_callsites_rd_observe_callback(ob_type, **kwargs):
|
|
1973
|
-
if ob_type != "insn":
|
|
1974
|
-
return False
|
|
1975
|
-
stmt = kwargs.pop("stmt")
|
|
1976
|
-
op_type = kwargs.pop("op_type")
|
|
1977
|
-
return isinstance(stmt, ailment.Stmt.Call) and op_type == OP_BEFORE
|
|
1978
|
-
|
|
1979
2157
|
def parse_variable_addr(self, addr: ailment.Expr.Expression) -> tuple[Any, Any] | None:
|
|
1980
2158
|
if isinstance(addr, ailment.Expr.Const):
|
|
1981
2159
|
return addr, 0
|
|
1982
|
-
if isinstance(addr, ailment.Expr.BinaryOp):
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
return op0, op1 # best-effort guess
|
|
2160
|
+
if isinstance(addr, ailment.Expr.BinaryOp) and addr.op == "Add":
|
|
2161
|
+
op0, op1 = addr.operands
|
|
2162
|
+
if (
|
|
2163
|
+
isinstance(op0, ailment.Expr.Const)
|
|
2164
|
+
and self.project.loader.find_object_containing(op0.value) is not None
|
|
2165
|
+
):
|
|
2166
|
+
return op0, op1
|
|
2167
|
+
if (
|
|
2168
|
+
isinstance(op1, ailment.Expr.Const)
|
|
2169
|
+
and self.project.loader.find_object_containing(op1.value) is not None
|
|
2170
|
+
):
|
|
2171
|
+
return op1, op0
|
|
2172
|
+
return op0, op1 # best-effort guess
|
|
1996
2173
|
return None, None
|
|
1997
2174
|
|
|
1998
2175
|
def new_block_addr(self) -> int:
|
|
@@ -2013,8 +2190,8 @@ class Clinic(Analysis):
|
|
|
2013
2190
|
def remove_empty_nodes(graph: networkx.DiGraph) -> networkx.DiGraph:
|
|
2014
2191
|
def handle_node(node: ailment.Block):
|
|
2015
2192
|
if not node.statements:
|
|
2016
|
-
preds =
|
|
2017
|
-
succs =
|
|
2193
|
+
preds = [pred for pred in graph.predecessors(node) if pred is not node]
|
|
2194
|
+
succs = [succ for succ in graph.successors(node) if succ is not node]
|
|
2018
2195
|
if len(preds) == 1 and len(succs) == 1:
|
|
2019
2196
|
pred = preds[0]
|
|
2020
2197
|
succ = succs[0]
|
|
@@ -2037,7 +2214,7 @@ class Clinic(Analysis):
|
|
|
2037
2214
|
|
|
2038
2215
|
if value_updated:
|
|
2039
2216
|
graph.add_edge(pred, succ)
|
|
2040
|
-
raise RemoveNodeNotice
|
|
2217
|
+
raise RemoveNodeNotice
|
|
2041
2218
|
elif len(preds) >= 1 and len(succs) == 1:
|
|
2042
2219
|
succ = succs[0]
|
|
2043
2220
|
branch_updates = 0
|
|
@@ -2072,9 +2249,9 @@ class Clinic(Analysis):
|
|
|
2072
2249
|
and last_stmt.false_target.value == node.addr
|
|
2073
2250
|
):
|
|
2074
2251
|
last_stmt.false_target.value = succ.addr
|
|
2075
|
-
raise RemoveNodeNotice
|
|
2252
|
+
raise RemoveNodeNotice
|
|
2076
2253
|
elif not preds or not succs:
|
|
2077
|
-
raise RemoveNodeNotice
|
|
2254
|
+
raise RemoveNodeNotice
|
|
2078
2255
|
|
|
2079
2256
|
AILGraphWalker(graph, handle_node, replace_nodes=True).walk()
|
|
2080
2257
|
return graph
|
|
@@ -2115,50 +2292,49 @@ class Clinic(Analysis):
|
|
|
2115
2292
|
for node in ail_graph:
|
|
2116
2293
|
if ail_graph.in_degree[node] == 2 and ail_graph.out_degree[node] == 2:
|
|
2117
2294
|
succs = ail_graph.successors(node)
|
|
2118
|
-
if node in succs:
|
|
2295
|
+
if node in succs and len(node.statements) >= 6:
|
|
2119
2296
|
# self loop!
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2297
|
+
stmt0 = node.statements[1] # skip the LABEL statement
|
|
2298
|
+
stmt1 = node.statements[2]
|
|
2299
|
+
last_stmt = node.statements[-1]
|
|
2300
|
+
if (
|
|
2301
|
+
(
|
|
2125
2302
|
isinstance(stmt0, ailment.Stmt.Assignment)
|
|
2126
2303
|
and isinstance(stmt0.dst, ailment.Expr.Register)
|
|
2127
2304
|
and isinstance(stmt0.src, ailment.Expr.StackBaseOffset)
|
|
2128
2305
|
and stmt0.src.offset == -0x1000
|
|
2129
|
-
)
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
break
|
|
2306
|
+
)
|
|
2307
|
+
and (
|
|
2308
|
+
isinstance(stmt1, ailment.Stmt.Store)
|
|
2309
|
+
and isinstance(stmt1.addr, ailment.Expr.StackBaseOffset)
|
|
2310
|
+
and stmt1.addr.offset == -0x1000
|
|
2311
|
+
and isinstance(stmt1.data, ailment.Expr.Load)
|
|
2312
|
+
and isinstance(stmt1.data.addr, ailment.Expr.StackBaseOffset)
|
|
2313
|
+
and stmt1.data.addr.offset == -0x1000
|
|
2314
|
+
)
|
|
2315
|
+
and (
|
|
2316
|
+
isinstance(last_stmt, ailment.Stmt.ConditionalJump)
|
|
2317
|
+
and isinstance(last_stmt.condition, ailment.Expr.BinaryOp)
|
|
2318
|
+
and last_stmt.condition.op == "CmpEQ"
|
|
2319
|
+
and isinstance(last_stmt.condition.operands[0], ailment.Expr.StackBaseOffset)
|
|
2320
|
+
and last_stmt.condition.operands[0].offset == -0x1000
|
|
2321
|
+
and isinstance(last_stmt.condition.operands[1], ailment.Expr.Register)
|
|
2322
|
+
and isinstance(last_stmt.false_target, ailment.Expr.Const)
|
|
2323
|
+
and last_stmt.false_target.value == node.addr
|
|
2324
|
+
)
|
|
2325
|
+
):
|
|
2326
|
+
# found it!
|
|
2327
|
+
alloca_node = node
|
|
2328
|
+
sp_equal_to = ailment.Expr.BinaryOp(
|
|
2329
|
+
None,
|
|
2330
|
+
"Sub",
|
|
2331
|
+
[
|
|
2332
|
+
ailment.Expr.Register(None, None, self.project.arch.sp_offset, self.project.arch.bits),
|
|
2333
|
+
last_stmt.condition.operands[1],
|
|
2334
|
+
],
|
|
2335
|
+
False,
|
|
2336
|
+
)
|
|
2337
|
+
break
|
|
2162
2338
|
|
|
2163
2339
|
if alloca_node is not None:
|
|
2164
2340
|
stmt0 = alloca_node.statements[1]
|