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
189 - ``ENOTTY``: this type of filesystem does not implement fs-verity
190 - ``EOPNOTSUPP``: the kernel was not configured with fs-verity
192 feature enabled on it; or the filesystem does not support fs-verity
205 The fs-verity file digest is a cryptographic digest that identifies
237 - ``ENOTTY``: this type of filesystem does not implement fs-verity
238 - ``EOPNOTSUPP``: the kernel was not configured with fs-verity
254 to a client program, such that the client can do its own fs-verity
262 This is a fairly specialized use case, and most fs-verity users won't
287 - ``FS_VERITY_METADATA_TYPE_DESCRIPTOR`` reads the fs-verity
288 descriptor. See `fs-verity descriptor`_.
306 implement fs-verity compatible verification anyway (though absent a
320 - ``ENOTTY``: this type of filesystem does not implement fs-verity, or
322 - ``EOPNOTSUPP``: the kernel was not configured with fs-verity
329 The existing ioctl FS_IOC_GETFLAGS (which isn't specific to fs-verity)
330 can also be used to check whether a file has fs-verity enabled or not.
340 the file has fs-verity enabled. This can perform better than
356 allowed, since these are not measured by fs-verity. Verity files
368 - If the sysctl "fs.verity.require_signatures" is set to 1 and the
369 file is not signed by a key in the ".fs-verity" keyring, then
374 its "verity"-ness. fs-verity is primarily meant for files like
380 This section describes how fs-verity hashes the file contents using a
383 that support fs-verity.
386 compute fs-verity file digests itself, e.g. in order to sign files.
428 fs-verity descriptor
436 To solve this problem, the fs-verity file digest is actually computed
456 verification of fs-verity builtin signatures.
459 It is not the only way to do signatures with fs-verity, and the
466 1. At boot time, the kernel creates a keyring named ".fs-verity". The
471 detached signature in DER format of the file's fs-verity digest.
475 in the ".fs-verity" keyring. This verification happens as long as the
477 "fs.verity.require_signatures" described in the next item. The IPE LSM
481 3. A new sysctl "fs.verity.require_signatures" is made available.
486 is the fs-verity file digest in the following format::
495 That's it. It should be emphasized again that fs-verity builtin
496 signatures are not the only way to do signatures with fs-verity. See
497 `Use cases`_ for an overview of ways in which fs-verity can be used.
498 fs-verity builtin signatures have some major limitations that should
502 that any files actually have fs-verity enabled. Thus, it is not a
505 code to explicitly check whether files have fs-verity enabled with a
507 fs.verity.require_signatures=1, just checking whether fs-verity is
512 - Another approach is to utilize fs-verity builtin signature
515 files with a verified fs-verity builtin signature to perform certain
517 fs.verity.require_signatures=1.
522 fs-verity is being enabled on the file. Changing or deleting the
526 all fs-verity enabled files on the system. Different keys cannot be
529 - The sysctl fs.verity.require_signatures applies system-wide.
530 Setting it to 1 only works when all users of fs-verity on the system
532 fs-verity from being used in cases where it would be helpful.
539 - fs-verity builtin signatures are in PKCS#7 format, and the public
541 including by some other kernel features (which is why the fs-verity
548 fs-verity users who do not need advanced features of X.509 and
552 fs-verity users who choose to use X.509 and PKCS#7 anyway should
561 Note: IMA appraisal, which supports fs-verity, does not use PKCS#7
568 fs-verity is supported by several filesystems, described below. The
569 CONFIG_FS_VERITY kconfig option must be enabled to use fs-verity on
573 ``fs/verity/`` support layer and filesystems. Briefly, filesystems
578 ``fs/verity/`` at certain times, such as when a file is opened or when
584 ext4 supports fs-verity since Linux v5.4 and e2fsprogs v1.45.2.
600 fs-verity. In this case, the plaintext data is verified rather than
601 the ciphertext. This is necessary in order to make the fs-verity file
620 f2fs supports fs-verity since Linux v5.4 and f2fs-tools v1.11.0.
641 btrfs supports fs-verity since Linux v5.15. Verity-enabled inodes are
651 fs-verity ensures that all reads of a verity file's data are verified,
665 Therefore, fs/verity/ provides the function fsverity_verify_blocks()
698 filesystems to support fs-verity, fs/verity/ also provides a function
723 this case from bypassing fs-verity, filesystems use
727 direct I/O would bypass fs-verity.
733 fs-verity can be found at:
735 https://git.kernel.org/pub/scm/fs/fsverity/fsverity-utils.git
738 including examples of setting up fs-verity protected files.
743 To test fs-verity, use xfstests. For example, using `kvm-xfstests
751 This section answers frequently asked questions about fs-verity that
754 :Q: Why isn't fs-verity part of IMA?
755 :A: fs-verity and IMA (Integrity Measurement Architecture) have
756 different focuses. fs-verity is a filesystem-level mechanism for
762 IMA supports the fs-verity hashing mechanism as an alternative
765 doesn't make sense to force all uses of fs-verity to be through
766 IMA. fs-verity already meets many users' needs even as a
770 :Q: Isn't fs-verity useless because the attacker can just modify the
772 :A: To verify the authenticity of an fs-verity file you must verify
773 the authenticity of the "fs-verity file digest", which
776 :Q: Isn't fs-verity useless because the attacker can just replace a
779 userspace code that authenticates the files; fs-verity is just a
827 :Q: Why doesn't fs-verity support writes?
830 fs-verity. Write support would require:
852 very different cases; the same applies to fs-verity.
859 properties are unwanted for fs-verity, so reusing the immutable
868 :Q: Does fs-verity support remote filesystems?
869 :A: So far all filesystems that have implemented fs-verity support are
871 per-file verity metadata can support fs-verity, regardless of
876 by ``fs/verity/`` also assume that the filesystem uses the Linux
879 :Q: Why is anything filesystem-specific at all? Shouldn't fs-verity