Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment out overly-generic function prologs and epliogs for riscv #60

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 lot 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