overlayutils

package
v1.7.14 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPathOnTmpfs added in v1.6.13

func IsPathOnTmpfs(d string) bool

IsPathOnTmpfs returns whether the path is on a tmpfs or not.

It uses statfs to check if the fs type is TMPFS_MAGIC (0x01021994) see https://man7.org/linux/man-pages/man2/statfs.2.html

func NeedsUserXAttr

func NeedsUserXAttr(d string) (bool, error)

NeedsUserXAttr returns whether overlayfs should be mounted with the "userxattr" mount option.

The "userxattr" option is needed for mounting overlayfs inside a user namespace with kernel >= 5.11.

The "userxattr" option is NOT needed for the initial user namespace (aka "the host").

Also, Ubuntu (since circa 2015) and Debian (since 10) with kernel < 5.11 can mount the overlayfs in a user namespace without the "userxattr" option.

The corresponding kernel commit: https://github.com/torvalds/linux/commit/2d2f2d7322ff43e0fe92bf8cccdc0b09449bf2e1 > ovl: user xattr > > Optionally allow using "user.overlay." namespace instead of "trusted.overlay." > ... > Disable redirect_dir and metacopy options, because these would allow privilege escalation through direct manipulation of the > "user.overlay.redirect" or "user.overlay.metacopy" xattrs. > ...

The "userxattr" support is not exposed in "/sys/module/overlay/parameters".

func Supported

func Supported(root string) error

Supported returns nil when the overlayfs is functional on the system with the root directory. Supported is not called during plugin initialization, but exposed for downstream projects which uses this snapshotter as a library.

func SupportsMultipleLowerDir

func SupportsMultipleLowerDir(d string) error

SupportsMultipleLowerDir checks if the system supports multiple lowerdirs, which is required for the overlay snapshotter. On 4.x kernels, multiple lowerdirs are always available (so this check isn't needed), and backported to RHEL and CentOS 3.x kernels (3.10.0-693.el7.x86_64 and up). This function is to detect support on those kernels, without doing a kernel version compare.

Ported from moby overlay2.

Types

This section is empty.

Jump to

Keyboard shortcuts

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