Lines Matching full:fs
6 fs-verity: read-only file-based authenticity protection
12 fs-verity (``fs/verity/``) is a support layer that filesystems can
16 code is needed to support fs-verity.
18 fs-verity is similar to `dm-verity
21 filesystems supporting fs-verity, userspace can execute an ioctl that
30 the "fs-verity file digest", which is a hash that includes the Merkle
31 tree root hash) that fs-verity is enforcing for the file. This ioctl
34 fs-verity is essentially a way to hash a file in constant time,
41 By itself, fs-verity only provides integrity protection, i.e.
44 However, because fs-verity makes retrieving the file hash extremely
49 A standard file hash could be used instead of fs-verity. However,
57 Unlike an ahead-of-time hash, fs-verity also re-verifies data each
61 fs-verity does not replace or obsolete dm-verity. dm-verity should
62 still be used on read-only filesystems. fs-verity is for files that
66 fs-verity does not mandate a particular scheme for authenticating its
69 authenticating fs-verity file hashes include:
79 retrieving its fs-verity digest using `FS_IOC_MEASURE_VERITY`_, then
83 - Integrity Measurement Architecture (IMA). IMA supports fs-verity
91 including those protected by fs-verity's built-in signatures.
92 "IPE policy" specifically allows for the authorization of fs-verity
95 files with a verified fs-verity's built-in signature. For
108 The FS_IOC_ENABLE_VERITY ioctl enables fs-verity on a file. It takes
185 - ``ENOKEY``: the ".fs-verity" keyring doesn't contain the certificate
187 - ``ENOPKG``: fs-verity recognizes the hash algorithm, but it's not
190 - ``ENOTTY``: this type of filesystem does not implement fs-verity
191 - ``EOPNOTSUPP``: the kernel was not configured with fs-verity
193 feature enabled on it; or the filesystem does not support fs-verity
206 The fs-verity file digest is a cryptographic digest that identifies
238 - ``ENOTTY``: this type of filesystem does not implement fs-verity
239 - ``EOPNOTSUPP``: the kernel was not configured with fs-verity
255 to a client program, such that the client can do its own fs-verity
263 This is a fairly specialized use case, and most fs-verity users won't
288 - ``FS_VERITY_METADATA_TYPE_DESCRIPTOR`` reads the fs-verity
289 descriptor. See `fs-verity descriptor`_.
307 implement fs-verity compatible verification anyway (though absent a
321 - ``ENOTTY``: this type of filesystem does not implement fs-verity, or
323 - ``EOPNOTSUPP``: the kernel was not configured with fs-verity
330 The existing ioctl FS_IOC_GETFLAGS (which isn't specific to fs-verity)
331 can also be used to check whether a file has fs-verity enabled or not.
341 the file has fs-verity enabled. This can perform better than
357 allowed, since these are not measured by fs-verity. Verity files
369 - If the sysctl "fs.verity.require_signatures" is set to 1 and the
370 file is not signed by a key in the ".fs-verity" keyring, then
375 its "verity"-ness. fs-verity is primarily meant for files like
381 This section describes how fs-verity hashes the file contents using a
384 that support fs-verity.
387 compute fs-verity file digests itself, e.g. in order to sign files.
429 fs-verity descriptor
437 To solve this problem, the fs-verity file digest is actually computed
457 verification of fs-verity builtin signatures.
460 It is not the only way to do signatures with fs-verity, and the
467 1. At boot time, the kernel creates a keyring named ".fs-verity". The
472 detached signature in DER format of the file's fs-verity digest.
476 in the ".fs-verity" keyring. This verification happens as long as the
478 "fs.verity.require_signatures" described in the next item. The IPE LSM
482 3. A new sysctl "fs.verity.require_signatures" is made available.
487 is the fs-verity file digest in the following format::
496 That's it. It should be emphasized again that fs-verity builtin
497 signatures are not the only way to do signatures with fs-verity. See
498 `Use cases`_ for an overview of ways in which fs-verity can be used.
499 fs-verity builtin signatures have some major limitations that should
503 that any files actually have fs-verity enabled. Thus, it is not a
506 code to explicitly check whether files have fs-verity enabled with a
508 fs.verity.require_signatures=1, just checking whether fs-verity is
513 - Another approach is to utilize fs-verity builtin signature
516 files with a verified fs-verity builtin signature to perform certain
518 fs.verity.require_signatures=1.
523 fs-verity is being enabled on the file. Changing or deleting the
527 all fs-verity enabled files on the system. Different keys cannot be
530 - The sysctl fs.verity.require_signatures applies system-wide.
531 Setting it to 1 only works when all users of fs-verity on the system
533 fs-verity from being used in cases where it would be helpful.
540 - fs-verity builtin signatures are in PKCS#7 format, and the public
542 including by some other kernel features (which is why the fs-verity
549 fs-verity users who do not need advanced features of X.509 and
553 fs-verity users who choose to use X.509 and PKCS#7 anyway should
562 Note: IMA appraisal, which supports fs-verity, does not use PKCS#7
569 fs-verity is supported by several filesystems, described below. The
570 CONFIG_FS_VERITY kconfig option must be enabled to use fs-verity on
574 ``fs/verity/`` support layer and filesystems. Briefly, filesystems
579 ``fs/verity/`` at certain times, such as when a file is opened or when
585 ext4 supports fs-verity since Linux v5.4 and e2fsprogs v1.45.2.
601 fs-verity. In this case, the plaintext data is verified rather than
602 the ciphertext. This is necessary in order to make the fs-verity file
621 f2fs supports fs-verity since Linux v5.4 and f2fs-tools v1.11.0.
642 btrfs supports fs-verity since Linux v5.15. Verity-enabled inodes are
652 fs-verity ensures that all reads of a verity file's data are verified,
666 Therefore, fs/verity/ provides the function fsverity_verify_blocks()
699 filesystems to support fs-verity, fs/verity/ also provides a function
724 this case from bypassing fs-verity, filesystems use
728 direct I/O would bypass fs-verity.
734 fs-verity can be found at:
736 https://git.kernel.org/pub/scm/fs/fsverity/fsverity-utils.git
739 including examples of setting up fs-verity protected files.
744 To test fs-verity, use xfstests. For example, using `kvm-xfstests
752 This section answers frequently asked questions about fs-verity that
755 :Q: Why isn't fs-verity part of IMA?
756 :A: fs-verity and IMA (Integrity Measurement Architecture) have
757 different focuses. fs-verity is a filesystem-level mechanism for
763 IMA supports the fs-verity hashing mechanism as an alternative
766 doesn't make sense to force all uses of fs-verity to be through
767 IMA. fs-verity already meets many users' needs even as a
771 :Q: Isn't fs-verity useless because the attacker can just modify the
773 :A: To verify the authenticity of an fs-verity file you must verify
774 the authenticity of the "fs-verity file digest", which
777 :Q: Isn't fs-verity useless because the attacker can just replace a
780 userspace code that authenticates the files; fs-verity is just a
828 :Q: Why doesn't fs-verity support writes?
831 fs-verity. Write support would require:
853 very different cases; the same applies to fs-verity.
860 properties are unwanted for fs-verity, so reusing the immutable
869 :Q: Does fs-verity support remote filesystems?
870 :A: So far all filesystems that have implemented fs-verity support are
872 per-file verity metadata can support fs-verity, regardless of
877 by ``fs/verity/`` also assume that the filesystem uses the Linux
880 :Q: Why is anything filesystem-specific at all? Shouldn't fs-verity