Skip to main content

Module security

Module security 

Source
Expand description

Metadata sync, permissions, ownership, ACL, and xattr operations. Metadata sync, permissions, ownership, xattr operations.

Functionsยง

acquire_mandatory_lock
Acquire an exclusive OFD write lock on the entire file
acquire_read_lock
Acquire a shared OFD read lock on the entire file
apply_metadata
Apply ownership, permissions, timestamps, and sync marker from src to dst
calc_dir_integrity_hash_target
Compute a directory integrity hash from inode metadata and immediate children
canonicalize_safe
Canonicalize path and verify it stays within root. Returns the canonical path or a security error.
check_and_lock_dir_integrity
Acquire a lock and read the directory integrity hash atomically
check_capacity
Return false if available space is below threshold_mb or free inodes are below 1000
check_sync_marker
Verifies if the target has a signature matching the current source state.
copy_timestamps
Copy atime and mtime from src to dst with nanosecond precision via utimensat
create_hard_link
Create a hard link to an existing file
create_mknod
Create a special file (device node, FIFO, socket) via mknod(2)
create_symlink
Create a symbolic link pointing to target
create_version_snapshot
Create a CoW (FICLONE) snapshot of a file for MARS versioning
do_fallocate
Call fallocate(2) on a file with the given mode, offset, and length
enable_compression
Enable filesystem-level compression via FS_IOC_SETFLAGS
enable_f2fs_pinning
Pin a file on F2FS to prevent garbage collection from moving its blocks
get_target_epoch
Read the replication epoch counter from xattr/sidecar metadata
get_valid_dir_hash
Get the stored directory integrity hash, returning 0 if stale or missing
ioctl_ficlone
Clone a file via FICLONE ioctl (CoW reflink from src_fd to a new file at dst_path)
is_dir_metadata_synced
Check if directory metadata (uid, gid, mode, mtime) matches between src and dst
is_filesystem_compressed
Check if the filesystem at path uses transparent compression (btrfs or F2FS)
open_beneath
Open a file beneath root using openat2(2) with RESOLVE_BENEATH. The kernel rejects any path that escapes root via .. or symlinks. Falls back to canonicalize_safe + standard open if openat2 unavailable.
path_within_root
Check that path is within root after canonicalization. Rejects symlinks that escape the root directory.
preallocate
Preallocate disk space with FALLOC_FL_KEEP_SIZE (best-effort, ignores errors)
probe_direct_io
Probe whether the filesystem supports O_DIRECT by writing a test block
probe_rwf_uncached
Probe whether the kernel supports RWF_UNCACHED via io_uring registered buffer read
probe_xattr_support
Probe whether the filesystem at target_root supports extended attributes
revert_snapshot
Revert a file to a previous snapshot version by copying the version file over the live path.
set_file_attr
Set filesystem inode flags via FS_IOC_SETFLAGS (e.g. immutable, append-only)
set_ownership
Set file ownership (uid/gid) via chown
set_project_id
Set the XFS/ext4 project ID for directory quota tracking
sync_xattrs
Copy all extended attributes from src to dst (best-effort, ignores errors)
truncate_file
Truncate or extend a file to the specified size
write_dir_integrity_hash
Write a directory integrity hash with mtime guard for staleness detection