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
98 The FS_IOC_ENABLE_VERITY ioctl enables fs-verity on a file. It takes
175 - ``ENOKEY``: the ".fs-verity" keyring doesn't contain the certificate
177 - ``ENOPKG``: fs-verity recognizes the hash algorithm, but it's not
180 - ``ENOTTY``: this type of filesystem does not implement fs-verity
181 - ``EOPNOTSUPP``: the kernel was not configured with fs-verity
183 feature enabled on it; or the filesystem does not support fs-verity
196 The fs-verity file digest is a cryptographic digest that identifies
228 - ``ENOTTY``: this type of filesystem does not implement fs-verity
229 - ``EOPNOTSUPP``: the kernel was not configured with fs-verity
243 fs-verity compatible verification of the file. This only makes sense
247 This is a fairly specialized use case, and most fs-verity users won't
272 - ``FS_VERITY_METADATA_TYPE_DESCRIPTOR`` reads the fs-verity
273 descriptor. See `fs-verity descriptor`_.
291 implement fs-verity compatible verification anyway (though absent a
305 - ``ENOTTY``: this type of filesystem does not implement fs-verity, or
307 - ``EOPNOTSUPP``: the kernel was not configured with fs-verity
314 The existing ioctl FS_IOC_GETFLAGS (which isn't specific to fs-verity)
315 can also be used to check whether a file has fs-verity enabled or not.
325 the file has fs-verity enabled. This can perform better than
341 allowed, since these are not measured by fs-verity. Verity files
353 - If the sysctl "fs.verity.require_signatures" is set to 1 and the
354 file is not signed by a key in the ".fs-verity" keyring, then
359 its "verity"-ness. fs-verity is primarily meant for files like
365 This section describes how fs-verity hashes the file contents using a
368 that support fs-verity.
371 compute fs-verity file digests itself, e.g. in order to sign files.
413 fs-verity descriptor
421 To solve this problem, the fs-verity file digest is actually computed
441 verification of fs-verity builtin signatures.
444 It is not the only way to do signatures with fs-verity, and the
451 1. At boot time, the kernel creates a keyring named ".fs-verity". The
456 detached signature in DER format of the file's fs-verity digest.
460 in the ".fs-verity" keyring.
462 3. A new sysctl "fs.verity.require_signatures" is made available.
467 is the fs-verity file digest in the following format::
476 That's it. It should be emphasized again that fs-verity builtin
477 signatures are not the only way to do signatures with fs-verity. See
478 `Use cases`_ for an overview of ways in which fs-verity can be used.
479 fs-verity builtin signatures have some major limitations that should
483 that any files actually have fs-verity enabled. Thus, it is not a
486 code to explicitly check whether files have fs-verity enabled with a
488 fs.verity.require_signatures=1, just checking whether fs-verity is
494 fs-verity is being enabled on the file. Changing or deleting the
498 all fs-verity enabled files on the system. Different keys cannot be
501 - The sysctl fs.verity.require_signatures applies system-wide.
502 Setting it to 1 only works when all users of fs-verity on the system
504 fs-verity from being used in cases where it would be helpful.
511 - fs-verity builtin signatures are in PKCS#7 format, and the public
513 including by some other kernel features (which is why the fs-verity
520 fs-verity users who do not need advanced features of X.509 and
524 fs-verity users who choose to use X.509 and PKCS#7 anyway should
533 Note: IMA appraisal, which supports fs-verity, does not use PKCS#7
540 fs-verity is supported by several filesystems, described below. The
541 CONFIG_FS_VERITY kconfig option must be enabled to use fs-verity on
545 ``fs/verity/`` support layer and filesystems. Briefly, filesystems
550 ``fs/verity/`` at certain times, such as when a file is opened or when
556 ext4 supports fs-verity since Linux v5.4 and e2fsprogs v1.45.2.
572 fs-verity. In this case, the plaintext data is verified rather than
573 the ciphertext. This is necessary in order to make the fs-verity file
592 f2fs supports fs-verity since Linux v5.4 and f2fs-tools v1.11.0.
613 btrfs supports fs-verity since Linux v5.15. Verity-enabled inodes are
623 fs-verity ensures that all reads of a verity file's data are verified,
637 Therefore, fs/verity/ provides the function fsverity_verify_blocks()
670 filesystems to support fs-verity, fs/verity/ also provides a function
695 this case from bypassing fs-verity, filesystems use
699 direct I/O would bypass fs-verity.
705 fs-verity can be found at:
707 https://git.kernel.org/pub/scm/fs/fsverity/fsverity-utils.git
710 including examples of setting up fs-verity protected files.
715 To test fs-verity, use xfstests. For example, using `kvm-xfstests
723 This section answers frequently asked questions about fs-verity that
726 :Q: Why isn't fs-verity part of IMA?
727 :A: fs-verity and IMA (Integrity Measurement Architecture) have
728 different focuses. fs-verity is a filesystem-level mechanism for
734 IMA supports the fs-verity hashing mechanism as an alternative
737 doesn't make sense to force all uses of fs-verity to be through
738 IMA. fs-verity already meets many users' needs even as a
742 :Q: Isn't fs-verity useless because the attacker can just modify the
744 :A: To verify the authenticity of an fs-verity file you must verify
745 the authenticity of the "fs-verity file digest", which
748 :Q: Isn't fs-verity useless because the attacker can just replace a
751 userspace code that authenticates the files; fs-verity is just a
799 :Q: Why doesn't fs-verity support writes?
802 fs-verity. Write support would require:
824 very different cases; the same applies to fs-verity.
831 properties are unwanted for fs-verity, so reusing the immutable
840 :Q: Does fs-verity support remote filesystems?
841 :A: So far all filesystems that have implemented fs-verity support are
843 per-file verity metadata can support fs-verity, regardless of
848 by ``fs/verity/`` also assume that the filesystem uses the Linux
851 :Q: Why is anything filesystem-specific at all? Shouldn't fs-verity