요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
Verity files
------------
ext4 supports fs-verity, which is a filesystem feature that provides
Merkle tree based hashing for individual readonly files. Most of
fs-verity is common to all filesystems that support it; see
:ref:`Documentation/filesystems/fsverity.rst <fsverity>` for the
fs-verity documentation. However, the on-disk layout of the verity
metadata is filesystem-specific. On ext4, the verity metadata is
stored after the end of the file data itself, in the following format:
- Zero-padding to the next 65536-byte boundary. This padding need not
actually be allocated on-disk, i.e. it may be a hole.
- The Merkle tree, as documented in
:ref:`Documentation/filesystems/fsverity.rst
<fsverity_merkle_tree>`, with the tree levels stored in order from
root to leaf, and the tree blocks within each level stored in their
natural order.
- Zero-padding to the next filesystem block boundary.
- The verity descriptor, as documented in
:ref:`Documentation/filesystems/fsverity.rst <fsverity_descriptor>`,
with optionally appended signature blob.
- Zero-padding to the next offset that is 4 bytes before a filesystem
block boundary.
- The size of the verity descriptor in bytes, as a 4-byte little
endian integer.
Verity inodes have EXT4_VERITY_FL set, and they must use extents, i.e.
EXT4_EXTENTS_FL must be set and EXT4_INLINE_DATA_FL must be clear.
They can have EXT4_ENCRYPT_FL set, in which case the verity metadata
is encrypted as well as the data itself.
Verity files cannot have blocks allocated past the end of the verity
metadata.
Verity and DAX are not compatible and attempts to set both of these flags
on a file will fail.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
ext4 verity file의 on-disk layout
1-44ext4는 개별 read-only file에 Merkle tree 기반 hashing을 제공하는 filesystem 기능인 fs-verity를 지원합니다. fs-verity의 공통 동작은 `Documentation/filesystems/fsverity.rst`에 설명되어 있지만 verity metadata의 on-disk layout은 filesystem마다 다릅니다.
ext4에서는 file data 끝 뒤에 verity metadata를 둡니다. 먼저 다음 65,536바이트 경계까지 zero-padding하며, 이 padding은 disk에 실제로 할당하지 않은 hole이어도 됩니다.
그 뒤에는 fs-verity 문서가 정의한 Merkle tree를 root level부터 leaf level 순서로 저장하고, 각 level 안의 tree block은 자연스러운 순서로 배치합니다.
Merkle tree 뒤를 다음 filesystem block 경계까지 0으로 채운 다음, 선택적 signature blob을 붙일 수 있는 verity descriptor를 기록합니다. 이어서 filesystem block 경계 4바이트 전 offset까지 다시 0으로 채우고, 마지막 4바이트에 descriptor 크기를 little-endian integer로 저장합니다.
file data 뒤에서 metadata 끝까지의 정확한 저장 순서입니다.
verity inode에는 `EXT4_VERITY_FL`이 설정됩니다. 반드시 extent를 사용해야 하므로 `EXT4_EXTENTS_FL`은 설정되고 `EXT4_INLINE_DATA_FL`은 해제되어야 합니다.
`EXT4_ENCRYPT_FL`을 함께 설정할 수 있으며, 이 경우 file data뿐 아니라 verity metadata도 암호화됩니다. verity metadata 끝을 지나 block을 할당할 수는 없습니다.
verity와 함께 허용되거나 필수·금지되는 inode flag입니다.
Verity와 DAX는 호환되지 않으므로 한 file에 두 flag를 모두 설정하려는 시도는 실패합니다.
.. SPDX-License-Identifier: GPL-2.0
Verity files
------------
ext4 supports fs-verity, which is a filesystem feature that provides
Merkle tree based hashing for individual readonly files. Most of
fs-verity is common to all filesystems that support it; see
:ref:`Documentation/filesystems/fsverity.rst <fsverity>` for the
fs-verity documentation. However, the on-disk layout of the verity
metadata is filesystem-specific. On ext4, the verity metadata is
stored after the end of the file data itself, in the following format:
- Zero-padding to the next 65536-byte boundary. This padding need not
actually be allocated on-disk, i.e. it may be a hole.
- The Merkle tree, as documented in
:ref:`Documentation/filesystems/fsverity.rst
<fsverity_merkle_tree>`, with the tree levels stored in order from
root to leaf, and the tree blocks within each level stored in their
natural order.
- Zero-padding to the next filesystem block boundary.
- The verity descriptor, as documented in
:ref:`Documentation/filesystems/fsverity.rst <fsverity_descriptor>`,
with optionally appended signature blob.
- Zero-padding to the next offset that is 4 bytes before a filesystem
block boundary.
- The size of the verity descriptor in bytes, as a 4-byte little
endian integer.
Verity inodes have EXT4_VERITY_FL set, and they must use extents, i.e.
EXT4_EXTENTS_FL must be set and EXT4_INLINE_DATA_FL must be clear.
They can have EXT4_ENCRYPT_FL set, in which case the verity metadata
is encrypted as well as the data itself.
Verity files cannot have blocks allocated past the end of the verity
metadata.
Verity and DAX are not compatible and attempts to set both of these flags
on a file will fail.
요약·해설
verity.rst:1-44ext4 verity file은 일반 data 뒤 64KiB 경계에서 Merkle tree를 시작하고, descriptor와 마지막 4바이트 크기 field로 metadata를 끝냅니다.
verity inode는 extent가 필수이고 inline data는 금지됩니다. encryption은 함께 사용할 수 있지만 DAX는 함께 사용할 수 없습니다.
layout과 inode 조건을 함께 확인합니다.