Documentation
¶
Index ¶
- func BinfmtMiscNamespacingSupported() (bool, error)
- func CreateUsernsProcess(idMap *specs.LinuxIDMapping, execFunc func(), cwd string, newMountNs bool, ...) (int, func(), error)
- func GetDistro() (string, error)
- func GetDistroPath(rootfs string) (string, error)
- func GetKernelRelease() (string, error)
- func GetLinuxHeaderPath(distro string) (string, error)
- func KernelCurrentVersionCmp(k1Major, k1Minor int) (int, error)
- func KernelModSupported(mod string) (bool, error)
- func ParseKernelRelease(rel string) (int, int, error)
- func ShmSysctlUserNamespaced() (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUsernsProcess ¶
func CreateUsernsProcess(idMap *specs.LinuxIDMapping, execFunc func(), cwd string, newMountNs bool, newIpcNs bool) (int, func(), error)
CreateUsernsProcess forks the current process into a new Linux user-namespace, using the given the ID mapping (common to both uid and gid). Returns the pid of the new process and a "kill" function (so that the caller can kill the child when desired). The new process executes the given function.
NOTE: adapted from github.com/containers/storage/drivers/overlay
func GetDistroPath ¶
Obtain system's linux distribution in the passed rootfs.
func GetKernelRelease ¶
GetKernelRelease returns the kernel release (e.g., "4.18")
func GetLinuxHeaderPath ¶
Obtain location of kernel-headers for a given linux distro.
func KernelCurrentVersionCmp ¶
Compares the given kernel version versus the current kernel version. Returns 0 if versions are equal, 1 if the current kernel has higher version than the given one, -1 otherwise.
func KernelModSupported ¶
KernelModSupported returns nil if the given module is loaded in the kernel.
func ParseKernelRelease ¶
Parses the kernel release string (obtained from GetKernelRelease()) and returns the major and minor numbers.
func ShmSysctlUserNamespaced ¶
ShmSysctlUserNamespaced checks if /proc/sys/kernel/shm* sysctls can be written to from within a user-ns empirically (by running an experiment). Support for such namespacing was added in upstream kernel 6.9 (commit 50ec499b9a43) but other distros (e.g., Ubuntu) may have backported to earlier versions so just checking for the kernel version is not sufficient.
Types ¶
This section is empty.