arch/arm32_binaries
Define a set predicates to abstract from ARM32 specific instruction set and characteristics
- thumb_sym(Name:symbol)
Mapping symbol names from elf: e.g., $t, $a, $d, etc.
See https://sourceware.org/binutils/docs/as/ARM-Mapping-Symbols.htm
- arm_sym(Name:symbol)
- data_sym(Name:symbol)
Uses:
defined_symbolUsed by:
avoid_symbols,basic_target,labeled_ea
- movw_movt(EA:address, Reg:register, Val:number, Operation:symbol)
Either movw r, #N or movt r, #N
Used by:
movw_movt_pair
- movw_movt_pair(EA_movw:address, EA_movt:address, Value:number)
- E.g., EA_movw: movw reg, N
EA_movt: movt reg, M
=> reg’s Value = N | (M << 16)
- plt_bx_pc(EA:address, Function:symbol)
- E.g.,
bx pc // thumb b.n XXX or nop // thumb add ip, pc, #0, #12 add ip, ip, #16, #20 ldr pc, [ip, #2640]
- plt_entry_arm_candidate(EA_entry:address, EA_jump:address, Function:symbol, EA_reloc:address)
EA_entry: The address of the PLT entry EA_jump: The address of the last jump instruction in the PLT entry Function: The external function that the PLT entry forwards EA_reloc: The destination address of the PLT entry
Uses:
arch.load_operation,arch.reg_arithmetic_operation,arch.reg_reg_arithmetic_operation,instruction,instruction_get_dest_op,instruction_get_src_op,loaded_section,movw_movt_pair,next,op_indirect_mapped,op_regdirect_contains_reg,plt_section,relocationUsed by:
block_heuristic,data_block_candidate,plt_bx_pc,plt_entry
- symbol_minus_symbol_candidate_arm(EA:address, Size:unsigned, Symbol1:address, Symbol2:address, Scale:unsigned, Offset:number)
This rule is shared by
init_symbol_minus_symbol_candidate_armandcinf_symbol_minus_symbol_candidate_arm.
WARNING: Predicate not present in compiled Datalog program (Dead Code)
- arm_jump_table_candidate_start(EA_access:address, EA_jump:address, RegIndex:reg_nullable, Reference:address, TableStart:address, EntrySize:unsigned, Type:symbol, Scale:unsigned, Offset:number)
Represents the first entry of an ARM jump table.
Attributes:
EA_access: address of instruction that accesses the jump table entries
EA_jump: address of jump instruction
RegIndex: register used for indexing into the jumptable. May be “NONE” if the index reg is pre-multiplied.
Reference: relative base for offsets (if the Type is rel_*, 0 otherwise)
TableStart: address of first table entry
EntrySize: size of entries
Type: “absolute”, “rel_signed”, or “rel_unsigned”
Offset: “1” if the jump table pattern requires “+1” for symbol-symbol Thumb targets in symbolic expression
Uses:
arch.pc_relative_addr,instruction,op_indirect_mapped,reg_jump,thumb_jumptable_instructionRecursive:
block_candidate_boundaries,jump_table_start,candidate_block_is_not_padding,reg_def_use.used_in_block,tls_get_addr,block,inter_procedural_edge,next_end,arch.extend_load,value_reg_unsupported,block_implies_block,last_value_reg_limit,init_symbol_minus_symbol_candidate_arm,block_points_proportional,wis_memo,indefinite_litpool_ref,cmp_defines,arm_jump_table_data_block,reg_def_use.return_block_end,data_access,__agg_subclause6,resolved_reaches,split_load_candidate,possible_target,arm_jump_table_block_instruction,incomplete_block,__agg_subclause7,must_fallthrough,indexed_pc_relative_load,stack_def_use.live_var_at_block_end,overlapping_instruction,gp_relative_operand,invalid,arm_jump_table_data_block_limit,arm_jump_table_cmp_limit,inferred_main_in_reg,reg_def_use.flow_def,arm_jump_table_block_start,wis_schedule,invalid_jump_table_candidate,straight_line_def_used,next_start,wis_has_prior,known_block,jump_table_target,flags_and_jump_pair,block_limit,block_candidate_dependency_edge,jump_table_candidate,split_load_for_symbolization,reg_def_use.def_used,block_next,no_return_call_refined,reg_reg_arithmetic_operation_defs,block_last_instruction,next_block_in_byte_interval,reg_def_use.ambiguous_last_def_in_block,arm_jump_table_skip_first_entry,straight_line_last_def,compare_and_jump_indirect,litpool_ref,relocation_adjustment_total,__agg_subclause3,data_in_code,may_fallthrough,reg_used_for,adrp_used,impossible_block,start_function,wis_prior,reg_def_use.defined_in_block,def_used_for_address,contains_implausible_instr_seq,reg_def_use.block_last_def,reg_def_use.last_def_in_block,stack_def_use.live_var_at_prior_used,data_block_limit,compare_and_jump_indirect_op_valid,simple_data_access_pattern,stack_def_use.live_var_def,tls_relative_operand_mips,segment_target_range,unresolved_block_overlap,__agg_single3,split_load_conflict,nop_in_padding_candidate,plt_block,code_in_block_candidate_refined,data_in_code_propagate,stack_def_use.live_var_used_in_block,block_total_points,reg_has_base_image,arm_jump_table_candidate,initialized_data_segment,possible_target_from,padding_block_limit,after_end,arm_jump_table_candidate_start,code_in_block,stack_base_reg_move,compare_and_jump_immediate,adjusts_stack_in_block,reg_def_use.ref_in_block,overlap_with_litpool,relocation_adjustment,split_load_total_points,reg_def_use.ambiguous_block_last_def,composite_data_access,litpool_boundaries,jump_table_candidate_refined,const_value_reg_used,relative_address_start,inferred_main_dispatch,call_tls_get_addr_mips,no_return_block,value_reg_edge,candidate_block_is_padding,__agg_single2,no_return_call,__agg_subclause4,compare_and_jump_register,jump_table_signed,reg_def_use.live_var_def,block_heuristic,no_return_call_propagated,arch.reg_relative_load,base_relative_operand,got_relative_operand,block_points,call_tls_get_addr,block_boundaries,split_load_point,is_padding,block_overlap,function_inference.function_entry_initial,next_type,common_tail,padding_block_candidate,stack_def_use.last_def_in_block,litpool_symbolic_operand,data_segment,stack_def_use.block_last_def,instruction_memory_access_size,litpool_confidence,init_ldr_add_pc,plt_entry,hi_load_prop,stack_def_use.defined_in_block,basic_target,__agg_subclause2,symbolic_expr_from_relocation,unlikely_have_symbolic_immediate,unresolved_interval,unresolved_interval_order,split_load,symbol_minus_symbol_litpool_access_pattern,negative_block_heuristic,jump_table_element_access,first_block_in_byte_interval,self_contained_segment,cinf_ldr_add_pc,jump_table_prelude,wis_schedule_iter,transition_block_limit,tls_desc_call,jump_table_max,correlated_live_reg,branch_to_calculated_pc_rel_addr,__agg_single10,no_value_reg_limit,data_block_candidate,__agg_single6,block_instruction_next,split_load_operand,stack_def_use.live_var_used,base_relative_operation,discarded_block,contains_plausible_instr_seq,code_in_block_candidate,reg_def_use.return_val_used,arch.simple_data_load,value_reg,stack_def_use.used_in_block,indexed_pc_relative_load_relative,stack_def_use.def_used,relative_address,cmp_reg_to_reg,discarded_split_load,reg_has_got,reg_def_use.live_var_at_prior_used,value_reg_limit,local_dynamic_tls_candidate,stack_def_use.ref_in_block,reg_def_use.live_var_used,relative_jump_table_entry_candidate,reg_def_use.used,likely_fallthrough,unresolved_block,base_relative_jump,reg_def_use.live_var_at_block_end
- arm_jump_table_candidate(EA_jump:address, Reference:address, TableStart:address, EntryAddr:address, EntrySize:unsigned, TargetAddr:address, TableLimit:address, Type:symbol, Scale:unsigned)
Represents an entry in an ARM jump table.
Attributes:
EA_jump: address of jump instruction
Reference: relative base for offsets (if the Type is rel_*, 0 otherwise)
TableStart: address of first table entry
EntryAddr: address of table entry
EntrySize: size of entries
TargetAddr: resolved target of the jump
TableLimit: first address that cannot be part of the jump table
Type: “absolute”, “rel_signed”, or “rel_unsigned”
Uses:
address_in_data,arch.instruction_at,defined_symbol,instructionUsed by:
data_object_candidate,data_object_pointRecursive:
block_candidate_boundaries,jump_table_start,candidate_block_is_not_padding,reg_def_use.used_in_block,tls_get_addr,block,inter_procedural_edge,next_end,arch.extend_load,value_reg_unsupported,block_implies_block,last_value_reg_limit,init_symbol_minus_symbol_candidate_arm,block_points_proportional,wis_memo,indefinite_litpool_ref,cmp_defines,arm_jump_table_data_block,reg_def_use.return_block_end,data_access,__agg_subclause6,resolved_reaches,split_load_candidate,possible_target,arm_jump_table_block_instruction,incomplete_block,__agg_subclause7,must_fallthrough,indexed_pc_relative_load,stack_def_use.live_var_at_block_end,overlapping_instruction,gp_relative_operand,invalid,arm_jump_table_data_block_limit,arm_jump_table_cmp_limit,inferred_main_in_reg,reg_def_use.flow_def,arm_jump_table_block_start,wis_schedule,invalid_jump_table_candidate,straight_line_def_used,next_start,wis_has_prior,known_block,jump_table_target,flags_and_jump_pair,block_limit,block_candidate_dependency_edge,jump_table_candidate,split_load_for_symbolization,reg_def_use.def_used,block_next,no_return_call_refined,reg_reg_arithmetic_operation_defs,block_last_instruction,next_block_in_byte_interval,reg_def_use.ambiguous_last_def_in_block,arm_jump_table_skip_first_entry,straight_line_last_def,compare_and_jump_indirect,litpool_ref,relocation_adjustment_total,__agg_subclause3,data_in_code,may_fallthrough,reg_used_for,adrp_used,impossible_block,start_function,wis_prior,reg_def_use.defined_in_block,def_used_for_address,contains_implausible_instr_seq,reg_def_use.block_last_def,reg_def_use.last_def_in_block,stack_def_use.live_var_at_prior_used,data_block_limit,compare_and_jump_indirect_op_valid,simple_data_access_pattern,stack_def_use.live_var_def,tls_relative_operand_mips,segment_target_range,unresolved_block_overlap,__agg_single3,split_load_conflict,nop_in_padding_candidate,plt_block,code_in_block_candidate_refined,data_in_code_propagate,stack_def_use.live_var_used_in_block,block_total_points,reg_has_base_image,arm_jump_table_candidate,initialized_data_segment,possible_target_from,padding_block_limit,after_end,arm_jump_table_candidate_start,code_in_block,stack_base_reg_move,compare_and_jump_immediate,adjusts_stack_in_block,reg_def_use.ref_in_block,overlap_with_litpool,relocation_adjustment,split_load_total_points,reg_def_use.ambiguous_block_last_def,composite_data_access,litpool_boundaries,jump_table_candidate_refined,const_value_reg_used,relative_address_start,inferred_main_dispatch,call_tls_get_addr_mips,no_return_block,value_reg_edge,candidate_block_is_padding,__agg_single2,no_return_call,__agg_subclause4,compare_and_jump_register,jump_table_signed,reg_def_use.live_var_def,block_heuristic,no_return_call_propagated,arch.reg_relative_load,base_relative_operand,got_relative_operand,block_points,call_tls_get_addr,block_boundaries,split_load_point,is_padding,block_overlap,function_inference.function_entry_initial,next_type,common_tail,padding_block_candidate,stack_def_use.last_def_in_block,litpool_symbolic_operand,data_segment,stack_def_use.block_last_def,instruction_memory_access_size,litpool_confidence,init_ldr_add_pc,plt_entry,hi_load_prop,stack_def_use.defined_in_block,basic_target,__agg_subclause2,symbolic_expr_from_relocation,unlikely_have_symbolic_immediate,unresolved_interval,unresolved_interval_order,split_load,symbol_minus_symbol_litpool_access_pattern,negative_block_heuristic,jump_table_element_access,first_block_in_byte_interval,self_contained_segment,cinf_ldr_add_pc,jump_table_prelude,wis_schedule_iter,transition_block_limit,tls_desc_call,jump_table_max,correlated_live_reg,branch_to_calculated_pc_rel_addr,__agg_single10,no_value_reg_limit,data_block_candidate,__agg_single6,block_instruction_next,split_load_operand,stack_def_use.live_var_used,base_relative_operation,discarded_block,contains_plausible_instr_seq,code_in_block_candidate,reg_def_use.return_val_used,arch.simple_data_load,value_reg,stack_def_use.used_in_block,indexed_pc_relative_load_relative,stack_def_use.def_used,relative_address,cmp_reg_to_reg,discarded_split_load,reg_has_got,reg_def_use.live_var_at_prior_used,value_reg_limit,local_dynamic_tls_candidate,stack_def_use.ref_in_block,reg_def_use.live_var_used,relative_jump_table_entry_candidate,reg_def_use.used,likely_fallthrough,unresolved_block,base_relative_jump,reg_def_use.live_var_at_block_end
- arm_jump_table_data_block_limit(EA_jmp:address, TableStart:address, Limit:address)
Addresses at which jump table data blocks should be split
Uses:
arch.instruction_at,direct_jumpRecursive:
block_candidate_boundaries,jump_table_start,candidate_block_is_not_padding,reg_def_use.used_in_block,tls_get_addr,block,inter_procedural_edge,next_end,arch.extend_load,value_reg_unsupported,block_implies_block,last_value_reg_limit,init_symbol_minus_symbol_candidate_arm,block_points_proportional,wis_memo,indefinite_litpool_ref,cmp_defines,arm_jump_table_data_block,reg_def_use.return_block_end,data_access,__agg_subclause6,resolved_reaches,split_load_candidate,possible_target,arm_jump_table_block_instruction,incomplete_block,__agg_subclause7,must_fallthrough,indexed_pc_relative_load,stack_def_use.live_var_at_block_end,overlapping_instruction,gp_relative_operand,invalid,arm_jump_table_data_block_limit,arm_jump_table_cmp_limit,inferred_main_in_reg,reg_def_use.flow_def,arm_jump_table_block_start,wis_schedule,invalid_jump_table_candidate,straight_line_def_used,next_start,wis_has_prior,known_block,jump_table_target,flags_and_jump_pair,block_limit,block_candidate_dependency_edge,jump_table_candidate,split_load_for_symbolization,reg_def_use.def_used,block_next,no_return_call_refined,reg_reg_arithmetic_operation_defs,block_last_instruction,next_block_in_byte_interval,reg_def_use.ambiguous_last_def_in_block,arm_jump_table_skip_first_entry,straight_line_last_def,compare_and_jump_indirect,litpool_ref,relocation_adjustment_total,__agg_subclause3,data_in_code,may_fallthrough,reg_used_for,adrp_used,impossible_block,start_function,wis_prior,reg_def_use.defined_in_block,def_used_for_address,contains_implausible_instr_seq,reg_def_use.block_last_def,reg_def_use.last_def_in_block,stack_def_use.live_var_at_prior_used,data_block_limit,compare_and_jump_indirect_op_valid,simple_data_access_pattern,stack_def_use.live_var_def,tls_relative_operand_mips,segment_target_range,unresolved_block_overlap,__agg_single3,split_load_conflict,nop_in_padding_candidate,plt_block,code_in_block_candidate_refined,data_in_code_propagate,stack_def_use.live_var_used_in_block,block_total_points,reg_has_base_image,arm_jump_table_candidate,initialized_data_segment,possible_target_from,padding_block_limit,after_end,arm_jump_table_candidate_start,code_in_block,stack_base_reg_move,compare_and_jump_immediate,adjusts_stack_in_block,reg_def_use.ref_in_block,overlap_with_litpool,relocation_adjustment,split_load_total_points,reg_def_use.ambiguous_block_last_def,composite_data_access,litpool_boundaries,jump_table_candidate_refined,const_value_reg_used,relative_address_start,inferred_main_dispatch,call_tls_get_addr_mips,no_return_block,value_reg_edge,candidate_block_is_padding,__agg_single2,no_return_call,__agg_subclause4,compare_and_jump_register,jump_table_signed,reg_def_use.live_var_def,block_heuristic,no_return_call_propagated,arch.reg_relative_load,base_relative_operand,got_relative_operand,block_points,call_tls_get_addr,block_boundaries,split_load_point,is_padding,block_overlap,function_inference.function_entry_initial,next_type,common_tail,padding_block_candidate,stack_def_use.last_def_in_block,litpool_symbolic_operand,data_segment,stack_def_use.block_last_def,instruction_memory_access_size,litpool_confidence,init_ldr_add_pc,plt_entry,hi_load_prop,stack_def_use.defined_in_block,basic_target,__agg_subclause2,symbolic_expr_from_relocation,unlikely_have_symbolic_immediate,unresolved_interval,unresolved_interval_order,split_load,symbol_minus_symbol_litpool_access_pattern,negative_block_heuristic,jump_table_element_access,first_block_in_byte_interval,self_contained_segment,cinf_ldr_add_pc,jump_table_prelude,wis_schedule_iter,transition_block_limit,tls_desc_call,jump_table_max,correlated_live_reg,branch_to_calculated_pc_rel_addr,__agg_single10,no_value_reg_limit,data_block_candidate,__agg_single6,block_instruction_next,split_load_operand,stack_def_use.live_var_used,base_relative_operation,discarded_block,contains_plausible_instr_seq,code_in_block_candidate,reg_def_use.return_val_used,arch.simple_data_load,value_reg,stack_def_use.used_in_block,indexed_pc_relative_load_relative,stack_def_use.def_used,relative_address,cmp_reg_to_reg,discarded_split_load,reg_has_got,reg_def_use.live_var_at_prior_used,value_reg_limit,local_dynamic_tls_candidate,stack_def_use.ref_in_block,reg_def_use.live_var_used,relative_jump_table_entry_candidate,reg_def_use.used,likely_fallthrough,unresolved_block,base_relative_jump,reg_def_use.live_var_at_block_end
- litpool_ref(EA:address, EA_ldr:address, RefAddr:address, Offset:unsigned, Size:unsigned, OpIndex:operand_index)
Instruction at address
EAaccesses a literal pool located atLitPoolAddr- EA: EA of the instruction containing the literal-pool label.
Note that for ADR/LDR case, EA is the address of ADR. For other cases, EA is the address of the load instruction.
- EA_ldr: EA of the load instruction that actually accesses the literal pool
EA = EA_ldr for non-ADR/LDR case
RefAddr: The address of referenced label Offset: This is for handling the ADR/LDR case:
adr BaseReg, Label ldr Reg, [BaseReg, Offset]
For other cases, Offset is 0. The actual literal pool address would be
RefAddr + Offset.- Size: The whole size of the literal pool entry accessed by the instruction
at EA_ldr: E.g., 1 for LDRB
2 for LDRH 4 for LDR 8 for LDRD 8 for VLDR N*4 for LDM R, {R1,…,RN}
- OpIndex: The index of operand for literal-pool label.
E.g., 1 for LDR, 2 for LDRD, 1 for ADR
Used by:
alignment,data_object_candidate,data_object_point,symbolic_operand_attribute,symbolic_operand_candidateRecursive:
block_candidate_boundaries,jump_table_start,candidate_block_is_not_padding,reg_def_use.used_in_block,tls_get_addr,block,inter_procedural_edge,next_end,arch.extend_load,value_reg_unsupported,block_implies_block,last_value_reg_limit,init_symbol_minus_symbol_candidate_arm,block_points_proportional,wis_memo,indefinite_litpool_ref,cmp_defines,arm_jump_table_data_block,reg_def_use.return_block_end,data_access,__agg_subclause6,resolved_reaches,split_load_candidate,possible_target,arm_jump_table_block_instruction,incomplete_block,__agg_subclause7,must_fallthrough,indexed_pc_relative_load,stack_def_use.live_var_at_block_end,overlapping_instruction,gp_relative_operand,invalid,arm_jump_table_data_block_limit,arm_jump_table_cmp_limit,inferred_main_in_reg,reg_def_use.flow_def,arm_jump_table_block_start,wis_schedule,invalid_jump_table_candidate,straight_line_def_used,next_start,wis_has_prior,known_block,jump_table_target,flags_and_jump_pair,block_limit,block_candidate_dependency_edge,jump_table_candidate,split_load_for_symbolization,reg_def_use.def_used,block_next,no_return_call_refined,reg_reg_arithmetic_operation_defs,block_last_instruction,next_block_in_byte_interval,reg_def_use.ambiguous_last_def_in_block,arm_jump_table_skip_first_entry,straight_line_last_def,compare_and_jump_indirect,litpool_ref,relocation_adjustment_total,__agg_subclause3,data_in_code,may_fallthrough,reg_used_for,adrp_used,impossible_block,start_function,wis_prior,reg_def_use.defined_in_block,def_used_for_address,contains_implausible_instr_seq,reg_def_use.block_last_def,reg_def_use.last_def_in_block,stack_def_use.live_var_at_prior_used,data_block_limit,compare_and_jump_indirect_op_valid,simple_data_access_pattern,stack_def_use.live_var_def,tls_relative_operand_mips,segment_target_range,unresolved_block_overlap,__agg_single3,split_load_conflict,nop_in_padding_candidate,plt_block,code_in_block_candidate_refined,data_in_code_propagate,stack_def_use.live_var_used_in_block,block_total_points,reg_has_base_image,arm_jump_table_candidate,initialized_data_segment,possible_target_from,padding_block_limit,after_end,arm_jump_table_candidate_start,code_in_block,stack_base_reg_move,compare_and_jump_immediate,adjusts_stack_in_block,reg_def_use.ref_in_block,overlap_with_litpool,relocation_adjustment,split_load_total_points,reg_def_use.ambiguous_block_last_def,composite_data_access,litpool_boundaries,jump_table_candidate_refined,const_value_reg_used,relative_address_start,inferred_main_dispatch,call_tls_get_addr_mips,no_return_block,value_reg_edge,candidate_block_is_padding,__agg_single2,no_return_call,__agg_subclause4,compare_and_jump_register,jump_table_signed,reg_def_use.live_var_def,block_heuristic,no_return_call_propagated,arch.reg_relative_load,base_relative_operand,got_relative_operand,block_points,call_tls_get_addr,block_boundaries,split_load_point,is_padding,block_overlap,function_inference.function_entry_initial,next_type,common_tail,padding_block_candidate,stack_def_use.last_def_in_block,litpool_symbolic_operand,data_segment,stack_def_use.block_last_def,instruction_memory_access_size,litpool_confidence,init_ldr_add_pc,plt_entry,hi_load_prop,stack_def_use.defined_in_block,basic_target,__agg_subclause2,symbolic_expr_from_relocation,unlikely_have_symbolic_immediate,unresolved_interval,unresolved_interval_order,split_load,symbol_minus_symbol_litpool_access_pattern,negative_block_heuristic,jump_table_element_access,first_block_in_byte_interval,self_contained_segment,cinf_ldr_add_pc,jump_table_prelude,wis_schedule_iter,transition_block_limit,tls_desc_call,jump_table_max,correlated_live_reg,branch_to_calculated_pc_rel_addr,__agg_single10,no_value_reg_limit,data_block_candidate,__agg_single6,block_instruction_next,split_load_operand,stack_def_use.live_var_used,base_relative_operation,discarded_block,contains_plausible_instr_seq,code_in_block_candidate,reg_def_use.return_val_used,arch.simple_data_load,value_reg,stack_def_use.used_in_block,indexed_pc_relative_load_relative,stack_def_use.def_used,relative_address,cmp_reg_to_reg,discarded_split_load,reg_has_got,reg_def_use.live_var_at_prior_used,value_reg_limit,local_dynamic_tls_candidate,stack_def_use.ref_in_block,reg_def_use.live_var_used,relative_jump_table_entry_candidate,reg_def_use.used,likely_fallthrough,unresolved_block,base_relative_jump,reg_def_use.live_var_at_block_end