Skip to content

Commit

Permalink
Comment out overly-generic function prologs and epliogs for riscv
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin committed Dec 18, 2023
1 parent a9e450b commit 6361eb4
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions angr_platforms/risc_v/arch_riscv.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,31 @@ def __init__(self, endness=Endness.LE):
max_inst_bytes = 4
instruction_alignment = 4
persistent_regs = []
function_prologs = {
br'[\x00-\xff][\x00-\xf1]\x01\x13',
# addi sp, sp, xxx
# 0b000000000000_00010_000_00010_0010011 0x00010113
# 0b111111111111_00010_000_00010_0010011 0xfff10113
br'[\x00-\xff][\x00-\xf1][\x20-\x2f][\x23-\xa3]'
# sw xx, xx(sp)
# 0b0000000_00000_00010_010_00000_0100011 0x00012023
# 0b1111111_11111_00010_010_11111_0100011 0xfff12fa3
}
function_epilogs = {
br'[\x00-\xff][\x00-\xf1][\x20-\x2f][\x23-\x83]',
# ld xx, xx(sp)
# 0b0000000_00000_00010_010_00000_0000011 0x00012003
# 0b1111111_11111_00010_010_11111_0000011 0xfff12f83
br'[\x00-\xff][\x00-\xf1]\x01\x13' # addi sp, sp, xxx
}
# These prologs and eplilogs had to be commented out because they are a bit
# too generic and match a log of false positives. This has the effect of
# poisoning the BoyScout analysis in angr when used for any other arch.
# If you need this, please uncomment and add more specific regexes if
# possible, or open an issue on github to discuss.
#
# function_prologs = {
# br'[\x00-\xff][\x00-\xf1]\x01\x13',
# # addi sp, sp, xxx
# # 0b000000000000_00010_000_00010_0010011 0x00010113
# # 0b111111111111_00010_000_00010_0010011 0xfff10113
# br'[\x00-\xff][\x00-\xf1][\x20-\x2f][\x23-\xa3]'
# # sw xx, xx(sp)
# # 0b0000000_00000_00010_010_00000_0100011 0x00012023
# # 0b1111111_11111_00010_010_11111_0100011 0xfff12fa3
# }
# function_epilogs = {
# br'[\x00-\xff][\x00-\xf1][\x20-\x2f][\x23-\x83]',
# # ld xx, xx(sp)
# # 0b0000000_00000_00010_010_00000_0000011 0x00012003
# # 0b1111111_11111_00010_010_11111_0000011 0xfff12f83
# br'[\x00-\xff][\x00-\xf1]\x01\x13' # addi sp, sp, xxx
# }
function_prologs = set()
function_epilogs = set()
ret_instruction = b'\x00\x00\x80\x67'
nop_instruction = b'\x13\x00\x00\x00'

Expand Down

0 comments on commit 6361eb4

Please sign in to comment.