Documentation ¶
Overview ¶
Package linux provides a kernel that wants to separate the running process from the host system.
Index ¶
- Constants
- Variables
- func HandleStat(buf co.Obuf, stat *LinuxStat64_x86, u models.Usercorn, large bool) uint64
- func NewDarwinStat(stat *LinuxStat64_x86, bits uint, large bool) interface{}
- func NewLinuxStat_generic(stat *LinuxStat64_x86, bits uint, large bool) interface{}
- func NewLinuxStat_x86(stat *LinuxStat64_x86, bits uint, large bool) interface{}
- func PackAddrs(u models.Usercorn, addrs []uint64) ([]byte, error)
- func PushStrings(u models.Usercorn, args ...string) ([]uint64, error)
- func SetupElfAuxv(u models.Usercorn) ([]byte, error)
- func StackInit(u models.Usercorn, args, env []string) error
- func Unpack(k co.Kernel, arg interface{}, vals []interface{}) error
- type DarwinStat
- type DarwinStat64
- type ElfAuxv
- type File
- type Iovec32
- type Iovec64
- type Linux32Stat64_x86
- type Linux32Stat_x86
- type LinuxKernel
- func (k *LinuxKernel) Access(path string, mode uint32) uint64
- func (k *LinuxKernel) Alarm(uint64)
- func (k *LinuxKernel) Brk(addr uint64) uint64
- func (k *LinuxKernel) Close(fd co.Fd) uint64
- func (k *LinuxKernel) Exit(code uint64)
- func (k *LinuxKernel) ExitGroup(code uint64)
- func (k *LinuxKernel) Fstat(fd co.Fd, buf co.Obuf) uint64
- func (k *LinuxKernel) Futex(uaddr co.Buf, op, val int, timeout, uaddr2 co.Buf, val3 uint64) int
- func (k *LinuxKernel) Getrlimit()
- func (k *LinuxKernel) Mmap(addrHint, size uint64, prot enum.MmapProt, flags enum.MmapFlag, fd co.Fd, ...) uint64
- func (k *LinuxKernel) Mprotect(addr, size uint64, prot uint64) uint64
- func (k *LinuxKernel) Open(path string, flags enum.OpenFlag, mode uint64) uint64
- func (k *LinuxKernel) Read(fd co.Fd, buf co.Obuf, size co.Len) uint64
- func (k *LinuxKernel) Readlink(path string, buf co.Obuf, size co.Len) uint64
- func (k *LinuxKernel) RtSigaction()
- func (k *LinuxKernel) RtSigprocmask()
- func (k *LinuxKernel) SetRobustList(tid int, head co.Buf)
- func (k *LinuxKernel) SetTidAddress(tidptr co.Buf) uint64
- func (k *LinuxKernel) Stat(path string, buf co.Obuf) uint64
- func (k *LinuxKernel) StdinOutPort(port int) error
- func (k *LinuxKernel) Ugetrlimit()
- func (k *LinuxKernel) Uname(buf co.Buf)
- func (k *LinuxKernel) Write(fd co.Fd, buf co.Buf, size co.Len) uint64
- func (k *LinuxKernel) Writev(fd co.Fd, iov co.Buf, count uint64) uint64
- type LinuxStat64_x86
- type LinuxStat_generic
Constants ¶
View Source
const ( ELF_AT_NULL = iota ELF_AT_IGNORE ELF_AT_EXECFD ELF_AT_PHDR ELF_AT_PHENT ELF_AT_PHNUM ELF_AT_PAGESZ ELF_AT_BASE ELF_AT_FLAGS ELF_AT_ENTRY ELF_AT_NOTELF ELF_AT_UID ELF_AT_EUID ELF_AT_GID ELF_AT_EGID ELF_AT_PLATFORM ELF_AT_HWCAP ELF_AT_CLKTCK = 17 ELF_AT_RANDOM = 25 ELF_AT_SYSINFO = 32 ELF_AT_SYSINFO_EHDR = 33 )
View Source
const ( STACK_BASE = 0xbf800000 STACK_SIZE = 0x00800000 // MinusOne represents -1 when interpreted as signed integer. // This is often used to indicate an error. MinusOne = 0xFFFFFFFFFFFFFFFF )
View Source
const ( FUTEX_WAIT = 0 FUTEX_WAKE = 1 FUTEX_FD = 2 FUTEX_REQUEUE = 3 FUTEX_CMP_REQUEUE = 4 FUTEX_WAKE_OP = 5 FUTEX_LOCK_PI = 6 FUTEX_UNLOCK_PI = 7 FUTEX_TRYLOCK_PI = 8 FUTEX_WAIT_BITSET = 9 FUTEX_WAKE_BITSET = 10 FUTEX_WAIT_REQUEUE_PI = 11 FUTEX_CMP_REQUEUE_PI = 12 )
View Source
const ( FUTEX_PRIVATE_FLAG = 128 FUTEX_CLOCK_REALTIME = 256 FUTEX_CMD_MASK = ^(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) )
View Source
const (
// PageSize that the memory must be aligned
PageSize = 0x1000
)
Variables ¶
View Source
var ENOSYS = 33
Functions ¶
func HandleStat ¶
func NewDarwinStat ¶
func NewDarwinStat(stat *LinuxStat64_x86, bits uint, large bool) interface{}
func NewLinuxStat_generic ¶
func NewLinuxStat_generic(stat *LinuxStat64_x86, bits uint, large bool) interface{}
func NewLinuxStat_x86 ¶
func NewLinuxStat_x86(stat *LinuxStat64_x86, bits uint, large bool) interface{}
Types ¶
type DarwinStat ¶
type DarwinStat struct { }
type DarwinStat64 ¶
type DarwinStat64 struct { Dev int32 /* [XSI] ID of device containing file */ Mode uint16 /* [XSI] Mode of file (see below) */ Nlink uint16 /* [XSI] Number of hard links */ Ino uint64 /* [XSI] File serial number */ Uid uint32 /* [XSI] User ID of the file */ Gid uint32 /* [XSI] Group ID of the file */ Rdev int32 /* [XSI] Device ID */ Pad0 int32 /* padding to align the embedded structs */ Atime int64 /* time of last access */ AtimeNsec int64 /* time of last access */ Mtime int64 /* time of last data modification */ MtimeNsec int64 /* time of last data modification */ Ctime int64 /* time of last status change */ CtimeNsec int64 /* time of last status change */ Birthtime int64 /* time of file creation(birth) */ BirthtimeNsec int64 /* time of file creation(birth) */ Size int64 /* [XSI] file size, in bytes */ Blkcnt int64 /* [XSI] blocks allocated for file */ Blksize int32 /* [XSI] optimal blocksize for I/O */ // contains filtered or unexported fields }
type Linux32Stat64_x86 ¶
type Linux32Stat_x86 ¶
type LinuxKernel ¶
type LinuxKernel struct { *co.KernelBase Unpack func(co.Buf, interface{}) Fs *ramfs.Filesystem Fds map[co.Fd]File // Open file descriptors // contains filtered or unexported fields }
LinuxKernel is a kernel that isolates processes from the host.
func NewKernel ¶
func NewKernel(fs *ramfs.Filesystem) *LinuxKernel
NewKernel creates a Linux Kernel that is isolated from the operating system.
func (*LinuxKernel) Access ¶
func (k *LinuxKernel) Access(path string, mode uint32) uint64
Access syscall
func (*LinuxKernel) Futex ¶
Futex syscall Timeout is a co.Buf here because some forms of futex don't pass it
func (*LinuxKernel) Getrlimit ¶
func (k *LinuxKernel) Getrlimit()
Getrlimit syscall (not implemented)
func (*LinuxKernel) Mmap ¶
func (k *LinuxKernel) Mmap(addrHint, size uint64, prot enum.MmapProt, flags enum.MmapFlag, fd co.Fd, off co.Off) uint64
Mmap syscall
func (*LinuxKernel) Mprotect ¶
func (k *LinuxKernel) Mprotect(addr, size uint64, prot uint64) uint64
Mprotect syscall
func (*LinuxKernel) RtSigaction ¶
func (k *LinuxKernel) RtSigaction()
RtSigaction syscall (not implemented)
func (*LinuxKernel) RtSigprocmask ¶
func (k *LinuxKernel) RtSigprocmask()
RtSigprocmask syscall (not implemented)
func (*LinuxKernel) SetRobustList ¶
func (k *LinuxKernel) SetRobustList(tid int, head co.Buf)
SetRobustList syscall (not implemented)
func (*LinuxKernel) SetTidAddress ¶
func (k *LinuxKernel) SetTidAddress(tidptr co.Buf) uint64
SetTidAddress syscall (not implemented)
func (*LinuxKernel) StdinOutPort ¶
func (k *LinuxKernel) StdinOutPort(port int) error
StdinOutPort redirects stdin and stout to the connection that connects to the specified port.
func (*LinuxKernel) Ugetrlimit ¶
func (k *LinuxKernel) Ugetrlimit()
Ugetrlimit syscall (not implemented)
type LinuxStat64_x86 ¶
type LinuxStat_generic ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.