Generated constants

Every value below is generated from the source by tools/docs/peios-reference/generators/gen-stratafs-constants.py. Nothing here is transcribed by hand, and the generator's --check mode fails if the two drift apart.

Filesystem identity #

ConstantValueMeaning
STRATAFS_MAGIC0x53545241Superblock magic, reported by statfs (Mount Options)
STRATAFS_NAME"stratafs"The name the filesystem registers under
STRATAFS_MAX_STRATA16Longest stratum stack accepted (The Stratum Stack)

STRATAFS_MAGIC is an alias for STRATAFS_SUPER_MAGIC, which is declared in the header stratafs shares with KACS so that the mount policy class keyed on it cannot drift (Mount Policy).

Stratum flags #

ConstantValueMeaning
STRATAFS_F_CREATE0x1The create flag (The Stratum Stack)
STRATAFS_F_RO0x2The ro flag
STRATAFS_F_AM0x4The am flag

Extended attributes #

ConstantValueMeaning
STRATAFS_XATTR_PREFIX"system.stratafs."Reserved namespace; never forwarded to a provider (The Origin Attribute)
STRATAFS_XATTR_ORIGIN"system.stratafs.origin"Synthetic, read-only, hidden from listings (The Origin Attribute)
STRATAFS_XATTR_STAGING"security.peios.stratafs_staging"Copy-up staging marker; also reserved (Copy-Up)

STRATAFS_XATTR_STAGING is an alias for STRATAFS_STAGING_XATTR, declared in the shared header. Note the name it resolves to lies outside the reserved system.stratafs. namespace, yet receives the same treatment (The Origin Attribute).

The canonical security-descriptor attribute is KACS's, not stratafs's; stratafs only detects it in order to exclude it from copy-up replication (Descriptors on Copy-Up).

Copy-up and staging #

ConstantValueMeaning
STRATAFS_STAGE_MARKER_MAGIC0x53544731Marker magic
STRATAFS_STAGE_MARKER_VERSION1Marker version
STRATAFS_COPY_BUFFER_SIZE65536Copy-up read/write chunk, in bytes (Copy-Up)
STRATAFS_STAGE_PREFIX".stratafs-stage-"Staged-name prefix
STRATAFS_RECOVERY_BATCH128Names scanned per staging-recovery pass

The staging marker #

struct stratafs_stage_marker is packed and 24 bytes, all fields little-endian. It is the value of the staging attribute above.

OffsetSizeFieldType
04magic__le32
42version__le16
62size__le16
88boot_cookie__le64
168mount_cookie__le64

Routing #

The value route_existing returns (Write Routing), as the Rust decision core names it and as the C glue mirrors it. The discriminants match.

C enumeratorValueRust
STRATAFS_ROUTE_IN_PLACE0InPlace
STRATAFS_ROUTE_COPY_UP1CopyUp
STRATAFS_ROUTE_READ_ONLY2ReadOnly

The decision core #

stratafs-core holds the stack-wide flag rules, provider selection, and routing. Its flag bits match the C ones above exactly.

ConstantValue
MAX_STRATA16
FLAG_CREATE0x1
FLAG_READ_ONLY0x2
FLAG_ABSENT_MAY0x4
FLAG_MASK0x7

The crate distinguishes these configuration errors. The C boundary collapses all of them to EINVAL, so the distinction is not observable to a caller (The Stratum Stack).

ErrorDiscriminant
Empty1
TooMany2
UnknownFlag3
RepeatedCreate4
CreateReadOnly5

Build configuration #

stratafs is built by CONFIG_STRATAFS_FS, a boolean option, so what it builds is linked into vmlinux rather than loaded. It depends on CONFIG_SECURITY_PKM and selects FS_STACK. Its sources are staged into the kernel tree as fs/stratafs, separate from PKM's own security/pkm. CONFIG_STRATAFS_FS_TEST_HOOKS compiles the test rendezvous and fail points (Stratum flags), inert unless the kernel is booted with stratafs.test_hooks=1. CONFIG_STRATAFS_KUNIT_TEST builds the in-kernel unit tests.

The translation units are:

  • super.o
  • lookup.o
  • inode.o
  • file.o
  • dir.o
  • dir_cache.o
  • xattr.o
  • copy_up.o

Edit this page