Skip to main content

Module mem

Module mem 

Source
Expand description

Reading and writing tracee memory from the supervisor.

process_vm_readv/process_vm_writev are used when the container allows them; otherwise /proc/<pid>/mem is opened per access (the descriptor is not cached because it would silently read the old address space after an execve).

In the guest-stub restricted mode the supervisor cannot reach a guest’s memory at all; the stub copies what a syscall uses into the mailbox (see guest_stub), whose guest addresses are then served from the supervisor’s own mapping of it, and every other address is EFAULT.

Structs§

Mem
Tracee memory accessor. Cheap to copy; the probe result is global.

Constants§

MAX_ARG_STRLEN
The kernel’s limit on one argument or environment string of an exec (MAX_ARG_STRLEN, 32 pages): a longer one fails the exec with E2BIG before any supervisor sees it.
MODE_PROCESS_VM 🔒
MODE_PROC_MEM 🔒
MODE_UNPROBED 🔒

Statics§

MODE 🔒
WINDOWS 🔒
The mailbox of the guest-stub restricted mode as each ABI’s guests map it: its guest address, its length, and the address of the supervisor’s mapping of it.

Functions§

in_window 🔒
Where len bytes at guest address addr lie in the supervisor’s mapping of the mailbox, when it is in use.
open_mem 🔒
set_window
Serves every later access from the mailbox mapped at local.
write_window 🔒
Copies buf into the mailbox at a place in_window found.