angr.storage.memory_mixins.memory_mixin

class angr.storage.memory_mixins.memory_mixin.SupportsMemoryMerge

Bases: SupportsMerge, Protocol

The merge contract of memory models: SupportsMerge plus the is_widening flag that widen passes.

widen(others)

Widen this memory with others. Only abstract (VSA) memories implement real widening; everything else merges.

Return type:

bool

Parameters:

others (list[Self])

class angr.storage.memory_mixins.memory_mixin.SupportsSubsumes

Bases: Protocol

The subsumes contract of memory models that support it. A Protocol so that Self binds to the implementing class.

subsumes(other)
Return type:

bool

Parameters:

other (Self)

__init__(*args, **kwargs)
class angr.storage.memory_mixins.memory_mixin.MemoryMixin

Bases: SimStatePlugin, SupportsMemoryMerge, Generic[InData, OutData, Addr]

MemoryMixin is the base class for the memory model in angr. It provides a set of methods that should be implemented by memory models. This is done using mixins, where each mixin handles some specific feature of the memory model, only overriding methods that it needs to implement its function. The memory model class itself then combines a set of mixins using inheritence to form the final memory model class.

SUPPORTS_CONCRETE_LOAD: bool = False
__init__(memory_id=None, endness='Iend_BE')
Parameters:
  • memory_id (str | None)

  • endness (str)

property category: str

reg, mem, or file.

Type:

Return the category of this SimMemory instance. It can be one of the three following categories

property variable_key_prefix: tuple[Any, ...]
find(addr, data, max_search, **kwargs)
Return type:

tuple[Addr, list[Bool], list[int]]

Parameters:
  • addr (Addr)

  • data (InData)

  • max_search (int)

load(addr, size=None, **kwargs)
Return type:

OutData

Parameters:
  • addr (Addr)

  • size (InData | None)

store(addr, data, size=None, **kwargs)
Return type:

None

Parameters:
  • addr (Addr)

  • data (InData)

  • size (InData | None)

MERGE_WHOLE_OBJECTS = False
permissions(addr, permissions=None, **kwargs)
Return type:

BV

Parameters:
  • addr (Addr)

  • permissions (int | claripy.ast.BV | None)

map_region(addr, length, permissions, *, init_zero=False, **kwargs)
Parameters:
  • addr (Addr)

  • length (int)

  • permissions (int | claripy.ast.BV)

  • init_zero (bool)

unmap_region(addr, length, **kwargs)
Parameters:
  • addr (Addr)

  • length (int)

concrete_load(addr, size, writing=False, **kwargs)

Set SUPPORTS_CONCRETE_LOAD to True and implement concrete_load if reading concrete bytes is faster in this memory model.

Parameters:
  • addr – The address to load from.

  • size – Size of the memory read.

  • writing

Return type:

Any

Returns:

A memoryview into the loaded bytes.

concrete_run_length(addr, size, **kwargs)

Return the number of concrete bytes starting at addr, capped at size.

Return type:

int

erase(addr, size=None, **kwargs)

Set [addr:addr+size) to uninitialized. In many cases this will be faster than overwriting those locations with new values. This is commonly used during static data flow analysis.

Parameters:
  • addr (Addr) – The address to start erasing.

  • size (int | None) – The number of bytes for erasing.

Return type:

None

Returns:

None

replace_all(old, new)
Parameters:
  • old (BV)

  • new (BV)

copy_contents(dst, src, size, condition=None, **kwargs)

Override this method to provide faster copying of large chunks of data.

Parameters:
  • dst (Addr) – The destination of copying.

  • src (Addr) – The source of copying.

  • size (InData) – The size of copying.

  • condition (Bool | None) – The storing condition.

  • kwargs – Other parameters.

Returns:

None