Lines Matching +full:64 +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
253 fs-verity compatible verification of the file. This only makes sense
257 This is a fairly specialized use case, and most fs-verity users won't
282 - ``FS_VERITY_METADATA_TYPE_DESCRIPTOR`` reads the fs-verity
283 descriptor. See `fs-verity descriptor`_.
293 cast to a 64-bit integer. ``__reserved`` must be 0. On success, the
301 implement fs-verity compatible verification anyway (though absent a
315 - ``ENOTTY``: this type of filesystem does not implement fs-verity, or
317 - ``EOPNOTSUPP``: the kernel was not configured with fs-verity
324 The existing ioctl FS_IOC_GETFLAGS (which isn't specific to fs-verity)
325 can also be used to check whether a file has fs-verity enabled or not.
335 the file has fs-verity enabled. This can perform better than
351 allowed, since these are not measured by fs-verity. Verity files
363 - If the sysctl "fs.verity.require_signatures" is set to 1 and the
364 file is not signed by a key in the ".fs-verity" keyring, then
369 its "verity"-ness. fs-verity is primarily meant for files like
375 This section describes how fs-verity hashes the file contents using a
378 that support fs-verity.
381 compute fs-verity file digests itself, e.g. in order to sign files.
405 64 bytes for SHA-256 or 128 bytes for SHA-512. The padded salt is
423 fs-verity descriptor
431 To solve this problem, the fs-verity file digest is actually computed
442 __u8 root_hash[64]; /* Merkle tree root hash */
451 verification of fs-verity builtin signatures.
454 It is not the only way to do signatures with fs-verity, and the
461 1. At boot time, the kernel creates a keyring named ".fs-verity". The
466 detached signature in DER format of the file's fs-verity digest.
470 in the ".fs-verity" keyring. This verification happens as long as the
472 "fs.verity.require_signatures" described in the next item. The IPE LSM
476 3. A new sysctl "fs.verity.require_signatures" is made available.
481 is the fs-verity file digest in the following format::
490 That's it. It should be emphasized again that fs-verity builtin
491 signatures are not the only way to do signatures with fs-verity. See
492 `Use cases`_ for an overview of ways in which fs-verity can be used.
493 fs-verity builtin signatures have some major limitations that should
497 that any files actually have fs-verity enabled. Thus, it is not a
500 code to explicitly check whether files have fs-verity enabled with a
502 fs.verity.require_signatures=1, just checking whether fs-verity is
507 - Another approach is to utilize fs-verity builtin signature
510 files with a verified fs-verity builtin signature to perform certain
512 fs.verity.require_signatures=1.
517 fs-verity is being enabled on the file. Changing or deleting the
521 all fs-verity enabled files on the system. Different keys cannot be
524 - The sysctl fs.verity.require_signatures applies system-wide.
525 Setting it to 1 only works when all users of fs-verity on the system
527 fs-verity from being used in cases where it would be helpful.
534 - fs-verity builtin signatures are in PKCS#7 format, and the public
536 including by some other kernel features (which is why the fs-verity
543 fs-verity users who do not need advanced features of X.509 and
547 fs-verity users who choose to use X.509 and PKCS#7 anyway should
556 Note: IMA appraisal, which supports fs-verity, does not use PKCS#7
563 fs-verity is supported by several filesystems, described below. The
564 CONFIG_FS_VERITY kconfig option must be enabled to use fs-verity on
568 ``fs/verity/`` support layer and filesystems. Briefly, filesystems
573 ``fs/verity/`` at certain times, such as when a file is opened or when
579 ext4 supports fs-verity since Linux v5.4 and e2fsprogs v1.45.2.
595 fs-verity. In this case, the plaintext data is verified rather than
596 the ciphertext. This is necessary in order to make the fs-verity file
600 past the end of the file, starting at the first 64K boundary beyond
615 f2fs supports fs-verity since Linux v5.4 and f2fs-tools v1.11.0.
626 64K boundary beyond i_size. See explanation for ext4 above.
636 btrfs supports fs-verity since Linux v5.15. Verity-enabled inodes are
646 fs-verity ensures that all reads of a verity file's data are verified,
660 Therefore, fs/verity/ provides the function fsverity_verify_blocks()
693 filesystems to support fs-verity, fs/verity/ also provides a function
718 this case from bypassing fs-verity, filesystems use
722 direct I/O would bypass fs-verity.
728 fs-verity can be found at:
730 https://git.kernel.org/pub/scm/fs/fsverity/fsverity-utils.git
733 including examples of setting up fs-verity protected files.
738 To test fs-verity, use xfstests. For example, using `kvm-xfstests
746 This section answers frequently asked questions about fs-verity that
749 :Q: Why isn't fs-verity part of IMA?
750 :A: fs-verity and IMA (Integrity Measurement Architecture) have
751 different focuses. fs-verity is a filesystem-level mechanism for
757 IMA supports the fs-verity hashing mechanism as an alternative
760 doesn't make sense to force all uses of fs-verity to be through
761 IMA. fs-verity already meets many users' needs even as a
765 :Q: Isn't fs-verity useless because the attacker can just modify the
767 :A: To verify the authenticity of an fs-verity file you must verify
768 the authenticity of the "fs-verity file digest", which
771 :Q: Isn't fs-verity useless because the attacker can just replace a
774 userspace code that authenticates the files; fs-verity is just a
822 :Q: Why doesn't fs-verity support writes?
825 fs-verity. Write support would require:
847 very different cases; the same applies to fs-verity.
854 properties are unwanted for fs-verity, so reusing the immutable
863 :Q: Does fs-verity support remote filesystems?
864 :A: So far all filesystems that have implemented fs-verity support are
866 per-file verity metadata can support fs-verity, regardless of
871 by ``fs/verity/`` also assume that the filesystem uses the Linux
874 :Q: Why is anything filesystem-specific at all? Shouldn't fs-verity