angr.simos.userland

class angr.simos.userland.SimUserland

Bases: SimOS

This is a base class for any SimOS that wants to support syscalls.

It uses the CLE kernel object to provide addresses for syscalls. Syscalls will be emulated as a jump to one of these addresses, where a SimProcedure from the syscall library provided at construction time will be executed.

__init__(project, syscall_library=None, syscall_addr_alignment=4, **kwargs)
syscall_cc(state)
Return type:

SimCCSyscall

syscall(state, allow_unsupported=True)

Given a state, return the procedure corresponding to the current syscall. This procedure will have .syscall_number, .display_name, and .addr set.

Parameters:
  • state – The state to get the syscall number from

  • allow_unsupported – Whether to return a “dummy” sycall instead of raising an unsupported exception

syscall_abi(state)

Optionally, override this function to determine which abi is being used for the state’s current syscall.

is_syscall_addr(addr)

Return whether or not the given address corresponds to a syscall implementation.

syscall_from_addr(addr, allow_unsupported=True)

Get a syscall SimProcedure from an address.

Parameters:
  • addr – The address to convert to a syscall SimProcedure

  • allow_unsupported – Whether to return a dummy procedure for an unsupported syscall instead of raising an exception.

Returns:

The SimProcedure for the syscall, or None if the address is not a syscall address.

syscall_from_number(number, allow_unsupported=True, abi=None)

Get a syscall SimProcedure from its number.

Parameters:
  • number – The syscall number

  • allow_unsupported – Whether to return a “stub” syscall for unsupported numbers instead of throwing an error

  • abi – The name of the abi to use. If None, will assume that the abis have disjoint numbering schemes and pick the right one.

Returns:

The SimProcedure for the syscall