mountidmapped

package module
v0.0.0-...-6f26c4d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FSCONFIG_SET_FLAG        = 0x0
	FSCONFIG_SET_STRING      = 0x1
	FSCONFIG_SET_BINARY      = 0x2
	FSCONFIG_SET_PATH        = 0x3
	FSCONFIG_SET_PATH_EMPTY  = 0x4
	FSCONFIG_SET_FD          = 0x5
	FSCONFIG_CMD_CREATE      = 0x6
	FSCONFIG_CMD_RECONFIGURE = 0x7
)

Functions

func Fsconfig

func Fsconfig(fd int, cmd int, key string, value string, aux int) (err error)

Fsconfig is to call SYS_FSCONFIG syscall.

NOTE: It's based on https://go-review.googlesource.com/c/sys/+/398434.

func GetUsernsFD

func GetUsernsFD(uidMaps, gidMaps []ProcIDMap) (_ *os.File, retErr error)

GetUsernsFD returns a userns file descriptor.

NOTE: It forks a short-live process without CLONE_FILES, which the process might hold the copied file descriptors in a short time.

func IDMapMount

func IDMapMount(dir string, usernsFD uintptr) (int, error)

IDMapMount calls mount_setattr syscall with a given userns fd.

Types

type ProcIDMap

type ProcIDMap = syscall.SysProcIDMap

ProcIDMap holds Container ID to Host ID mappings used for User Namespaces in Linux. It's alias to syscall.SysProcIDMap.

type ProcIDMaps

type ProcIDMaps []ProcIDMap

func (ProcIDMaps) Marshal

func (idMaps ProcIDMaps) Marshal() []byte

Marshal returns data in the /proc/{uid,gid}_map's format.

type ProcSyncType

type ProcSyncType uint8

ProcSyncType is used for synchronisation between parent and child process during setup user namespace mappings.

const (
	// ProcSyncReady is to notify parent that child is running with
	// pdeathsig and parent can start to write uid/gid maps.
	ProcSyncReady ProcSyncType = 1
	// ProcSyncExit is to notify parent that the child is going to exit.
	ProcSyncExit ProcSyncType = 2
)

func (ProcSyncType) String

func (typ ProcSyncType) String() string

String returns human-readable type.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL