Skip to content

memory ¤

Reading, writing, and describing memory.

Classes:

  • Page

    Represents the address space and page permissions of at least

Functions:

Attributes:

PAGE_SIZE module-attribute ¤

PAGE_SIZE = 4096

PAGE_MASK module-attribute ¤

PAGE_MASK = ~(PAGE_SIZE - 1)

align_down module-attribute ¤

align_down = round_down

align_up module-attribute ¤

align_up = round_up

Page ¤

Page(
    start: int,
    size: int,
    flags: int,
    offset: int,
    objfile: str = "",
    in_darwin_shared_cache: bool = False,
)

Represents the address space and page permissions of at least one page of memory.

Methods:

Attributes:

vaddr class-attribute instance-attribute ¤

vaddr = start

memsz class-attribute instance-attribute ¤

memsz = size

flags class-attribute instance-attribute ¤

flags = flags

offset class-attribute instance-attribute ¤

offset = offset

objfile class-attribute instance-attribute ¤

objfile = objfile

Possible non-empty values of objfile: - Contains square brackets "[]" if it's not a memory mapped file. Examples: [stack], [vsyscall], [heap], [vdso] - A path to a file, such as /usr/lib/libc.so.6

in_darwin_shared_cache instance-attribute ¤

in_darwin_shared_cache: bool = in_darwin_shared_cache

Whether this mapping is part of the Darwin Shared Cache.

This is an interesting property to know, as these entries may not be useful to us at all times, and having an easy way to filter them out is helpful..

start property ¤

start: int

Mapping start address.

end property ¤

end: int

Address beyond mapping. So the last effective address is self.end-1 It is the same as displayed in /proc//maps

is_stack property ¤

is_stack: bool

is_memory_mapped_file property ¤

is_memory_mapped_file: bool

read property ¤

read: bool

write property ¤

write: bool

execute property ¤

execute: bool

rw property ¤

rw: bool

wx property ¤

wx: bool

rwx property ¤

rwx: bool

is_guard property ¤

is_guard: bool

permstr property ¤

permstr: str

__str__ ¤

__str__() -> str

__repr__ ¤

__repr__() -> str

__contains__ ¤

__contains__(addr: int) -> bool

__eq__ ¤

__eq__(other: object) -> bool

__lt__ ¤

__lt__(other: object) -> bool

__hash__ ¤

__hash__() -> int

round_down ¤

round_down(address: int, align: int) -> int

round_down(address, align) -> int

Round down address to the nearest increment of align.

round_up ¤

round_up(address: int, align: int) -> int

round_up(address, align) -> int

Round up address to the nearest increment of align.

format_address ¤

format_address(
    vaddr: int,
    memsz: int,
    permstr: str,
    offset: int,
    objfile: str | None = None,
) -> str

Format the given address as a string.

page_align ¤

page_align(address: int) -> int

page_align(address) -> int

Round down address to the nearest page boundary.

page_size_align ¤

page_size_align(address: int) -> int

page_offset ¤

page_offset(address: int) -> int