The syscall package has been deprecated in favor of golang.org/x/sys. Note that syscall is still used in the following places: - pkg/sentry/socket/hostinet/stack.go: some netlink related functionalities are not yet available in golang.org/x/sys. - syscall.Stat_t is still used in some places because os.FileInfo.Sys() still returns it and not unix.Stat_t. Updates #214 PiperOrigin-RevId: 360701387
This package defines primitives for sentry access to application memory.
Major types:
-
The
IOinterface represents a virtual address space and provides I/O methods on that address space.IOis the lowest-level primitive. The primary implementation of theIOinterface ismm.MemoryManager. -
IOSequencerepresents a collection of individually-contiguous address ranges in aIOthat is operated on sequentially, analogous to Linux'sstruct iov_iter.
Major usage patterns:
-
Access to a task's virtual memory, subject to the application's memory protections and while running on that task's goroutine, from a context that is at or above the level of the
kernelpackage (e.g. most syscall implementations insyscalls/linux); use thekernel.Task.Copy*wrappers defined inkernel/task_usermem.go. -
Access to a task's virtual memory, from a context that is at or above the level of the
kernelpackage, but where any of the above constraints does not hold (e.g.PTRACE_POKEDATA, which ignores application memory protections); obtain the task'smm.MemoryManagerby callingkernel.Task.MemoryManager, and call itsIOmethods directly. -
Access to a task's virtual memory, from a context that is below the level of the
kernelpackage (e.g. filesystem I/O); clients must pass I/O arguments from higher layers, usually in the form of anIOSequence. Thekernel.Task.SingleIOSequenceandkernel.Task.IovecsIOSequencefunctions inkernel/task_usermem.goare convenience functions for doing so.