Linux file sealing
Linux file sealing irreversibly restricts selected operations on a supported file, with restrictions shared by all descriptors referring to its inode.
Scope: F_ADD_SEALS adds restrictions and F_GET_SEALS reads them. F_SEAL_SEAL prevents further additions, rather than freezing content. Restrictions cannot be removed. [1]
Writes: F_SEAL_WRITE cannot be installed while a shared writable mapping exists. F_SEAL_FUTURE_WRITE allows earlier shared writable mappings to keep changing the file while blocking new ones and write calls. A pre-existing shared PROT_READ mapping from a writable descriptor can also block F_SEAL_WRITE: Linux counts potential write capability, not only current store permissions. [4] Private copy-on-write mappings remain distinct from writes to the backing object. [1] [3]
Size: F_SEAL_SHRINK and F_SEAL_GROW control resizing separately from writes. Combining both with F_SEAL_WRITE constrains size and content through these APIs. Seals on volatile memfds do not create persistent storage or authenticate the data's origin. [2]
Mapping order: changing an earlier shared mapping to PROT_READ does not necessarily remove its potential write capability. In the companion Linux 6.8 controls, it could be upgraded after FUTURE_WRITE and modify the file. A shared read-only mapping created after that seal could not be upgraded; the kernel clears VM_MAYWRITE at mapping creation. [3] [5]
Read-only descriptors: a shared mapping from a separately reopened O_RDONLY descriptor could not be upgraded, but still saw writes through another descriptor before sealing. That reader did not prevent the writable descriptor from installing WRITE. Adding seals itself requires a writable descriptor. [1] [5]
Relations
- related
- memfd-create, memory-mapped-file, file-truncation, copy-on-write
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
- Linux man-pages: F_GET_SEALS / F_ADD_SEALS
- Linux v6.12: memfd sealing implementation
- Linux v6.12: seal_check_write mapping checks
- Linux v6.12: shared mappings with potential write capability
- Linux man-pages: mprotect(2), access changes and EACCES
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.
Published by Hesela team · Updated
Report a correction · Editorial standards · Reuse guidance
Cite this page
Hesela team. Linux file sealing. Hesela. 2026-10-18. https://hesela.dev/terms/file-sealing/