file-sealing · shipping · also file seals, memfd sealing

Linux file sealing

Linux file sealing irreversibly restricts selected operations on a supported file, with restrictions shared by all descriptors referring to its inode.

Related Observatory article: Read on hesela.com

Scope: F_ADD_SEALS adds irreversible inode-wide restrictions; F_GET_SEALS reads them. Adding seals requires a writable descriptor. F_SEAL_SEAL blocks further additions, not data changes. [1]

Writes: F_SEAL_WRITE blocks backing-object writes but requires releasing shared mappings with potential write capability. A PROT_READ mapping created from O_RDWR can still block it. FUTURE_WRITE leaves earlier shared writable mappings usable; private COW edits do not modify the file. [1] [4]

Mapping order: downgrading an earlier shared mapping with mprotect need not revoke its potential write capability. A later shared read-only mapping created under FUTURE_WRITE cannot be upgraded. A separately reopened O_RDONLY mapping is distinct: it cannot be upgraded but sees other writers before sealing. [3] [5]

Size: WRITE does not prevent resizing; add SHRINK and GROW to fix the extent. Volatile memfd seals provide neither persistence nor origin authentication. [2]

Handoff: SCM_RIGHTS and dup share an open file description's offset. Seals do not stop another holder from seeking. [6] In a 4096-byte handoff, read and dup-read consumed 3072 unchanged suffix bytes after a sender seek to 1024; positional and reopened controls read all 4096. [8]

Consumption: pread supplies an explicit offset. A complete reader still checks errors, short reads and expected coverage; byte stability and valid format do not prove complete consumption. [7]

Relations

related
Linux memfd_create, Memory-mapped file, File truncation, Copy-on-write (storage), Open file description

Advantages

  • Kernel enforcement can constrain a peer that holds a writable descriptor.

Limitations

  • A receiver still needs to inspect the actual seal mask and validate the application's data format.

Citations

  1. Linux man-pages: F_GET_SEALS / F_ADD_SEALS (accessed 2026-10-17)
  2. Linux v6.12: memfd sealing implementation (accessed 2026-10-17)
  3. Linux v6.12: seal_check_write mapping checks (accessed 2026-10-17)
  4. Linux v6.12: shared mappings with potential write capability (accessed 2026-10-18)
  5. Linux man-pages: mprotect(2), access changes and EACCES (accessed 2026-10-18)
  6. Linux man-pages: unix(7), SCM_RIGHTS shares the open file description (accessed 2026-10-23)
  7. Linux man-pages: pread(2), explicit offsets and short reads (accessed 2026-10-23)
  8. Hesela: sealed bytes and a shared read cursor (accessed 2026-10-23)
Sources & caveats
  • The companion probe tests seven sequential cases on one host, not a concurrent interprocess protocol.
  • The source review uses Linux v6.12 code to explain mechanisms; the measured kernel is recorded separately.
  • Three additional mapping-capability controls and raw observations: https://hesela.dev/research/file-seal-capability.json; runnable source: https://hesela.dev/research/file-seal-capability.py.
  • A separate two-process SCM_RIGHTS supplement tests eleven ordered cases three times per capture; this does not change the earlier sequential experiments' populations. Raw evidence and reproduction guide: https://hesela.dev/research/sealed-handoff/README.md.

JSON: /data/terms/file-sealing.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Linux file sealing. Hesela. 2026-10-23. https://hesela.dev/terms/file-sealing/