fsverity.rst (9d4d8572a539ef807e21c196f145aa365fd52f0e) | fsverity.rst (e17fe6579de023725ec22a16965e9099e4a05ac9) |
---|---|
1.. SPDX-License-Identifier: GPL-2.0 2 3.. _fsverity: 4 5======================================================= 6fs-verity: read-only file-based authenticity protection 7======================================================= 8 --- 203 unchanged lines hidden (view full) --- 212- ``ENODATA``: the file is not a verity file 213- ``ENOTTY``: this type of filesystem does not implement fs-verity 214- ``EOPNOTSUPP``: the kernel was not configured with fs-verity 215 support, or the filesystem superblock has not had the 'verity' 216 feature enabled on it. (See `Filesystem support`_.) 217- ``EOVERFLOW``: the digest is longer than the specified 218 ``digest_size`` bytes. Try providing a larger buffer. 219 | 1.. SPDX-License-Identifier: GPL-2.0 2 3.. _fsverity: 4 5======================================================= 6fs-verity: read-only file-based authenticity protection 7======================================================= 8 --- 203 unchanged lines hidden (view full) --- 212- ``ENODATA``: the file is not a verity file 213- ``ENOTTY``: this type of filesystem does not implement fs-verity 214- ``EOPNOTSUPP``: the kernel was not configured with fs-verity 215 support, or the filesystem superblock has not had the 'verity' 216 feature enabled on it. (See `Filesystem support`_.) 217- ``EOVERFLOW``: the digest is longer than the specified 218 ``digest_size`` bytes. Try providing a larger buffer. 219 |
220FS_IOC_READ_VERITY_METADATA 221--------------------------- 222 223The FS_IOC_READ_VERITY_METADATA ioctl reads verity metadata from a 224verity file. This ioctl is available since Linux v5.12. 225 226This ioctl allows writing a server program that takes a verity file 227and serves it to a client program, such that the client can do its own 228fs-verity compatible verification of the file. This only makes sense 229if the client doesn't trust the server and if the server needs to 230provide the storage for the client. 231 232This is a fairly specialized use case, and most fs-verity users won't 233need this ioctl. 234 235This ioctl takes in a pointer to the following structure:: 236 237 struct fsverity_read_metadata_arg { 238 __u64 metadata_type; 239 __u64 offset; 240 __u64 length; 241 __u64 buf_ptr; 242 __u64 __reserved; 243 }; 244 245``metadata_type`` specifies the type of metadata to read. 246 247The semantics are similar to those of ``pread()``. ``offset`` 248specifies the offset in bytes into the metadata item to read from, and 249``length`` specifies the maximum number of bytes to read from the 250metadata item. ``buf_ptr`` is the pointer to the buffer to read into, 251cast to a 64-bit integer. ``__reserved`` must be 0. On success, the 252number of bytes read is returned. 0 is returned at the end of the 253metadata item. The returned length may be less than ``length``, for 254example if the ioctl is interrupted. 255 256The metadata returned by FS_IOC_READ_VERITY_METADATA isn't guaranteed 257to be authenticated against the file digest that would be returned by 258`FS_IOC_MEASURE_VERITY`_, as the metadata is expected to be used to 259implement fs-verity compatible verification anyway (though absent a 260malicious disk, the metadata will indeed match). E.g. to implement 261this ioctl, the filesystem is allowed to just read the Merkle tree 262blocks from disk without actually verifying the path to the root node. 263 264FS_IOC_READ_VERITY_METADATA can fail with the following errors: 265 266- ``EFAULT``: the caller provided inaccessible memory 267- ``EINTR``: the ioctl was interrupted before any data was read 268- ``EINVAL``: reserved fields were set, or ``offset + length`` 269 overflowed 270- ``ENODATA``: the file is not a verity file 271- ``ENOTTY``: this type of filesystem does not implement fs-verity, or 272 this ioctl is not yet implemented on it 273- ``EOPNOTSUPP``: the kernel was not configured with fs-verity 274 support, or the filesystem superblock has not had the 'verity' 275 feature enabled on it. (See `Filesystem support`_.) 276 |
|
220FS_IOC_GETFLAGS 221--------------- 222 223The existing ioctl FS_IOC_GETFLAGS (which isn't specific to fs-verity) 224can also be used to check whether a file has fs-verity enabled or not. 225To do so, check for FS_VERITY_FL (0x00100000) in the returned flags. 226 227The verity flag is not settable via FS_IOC_SETFLAGS. You must use --- 503 unchanged lines hidden --- | 277FS_IOC_GETFLAGS 278--------------- 279 280The existing ioctl FS_IOC_GETFLAGS (which isn't specific to fs-verity) 281can also be used to check whether a file has fs-verity enabled or not. 282To do so, check for FS_VERITY_FL (0x00100000) in the returned flags. 283 284The verity flag is not settable via FS_IOC_SETFLAGS. You must use --- 503 unchanged lines hidden --- |