Repository navigation
Commit a66faad
committed
lcfs-fsverity: fix root_hash for zero-length files
lcfs_fsverity_context_get_digest() unconditionally zero-padded and
hashed a full Merkle tree block to produce root_hash, even for
zero-length files. Per the fs-verity on-disk format, an empty file has
zero Merkle tree blocks, so root_hash must be all-zero bytes instead.
This meant composefs-info measure-file (and any direct caller of
lcfs_fsverity_context_get_digest with empty input) reported a digest
the kernel, fsverity-utils, and composefs-rs's independent
reimplementation can never produce, even though composefs images
themselves are unaffected since they never reference empty backing
objects.
Assisted-by: https://github.com/cgwalters/cgwalters#llms
Closes: composefs#442
Signed-off-by: Colin Walters <walters@verbum.org>1 parent a7ea6cd commit a66faad
2 files changed
Lines changed: 33 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | | - | |
436 | | - | |
437 | 435 | | |
438 | 436 | | |
439 | 437 | | |
440 | 438 | | |
441 | 439 | | |
442 | 440 | | |
443 | 441 | | |
444 | | - | |
445 | | - | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
446 | 451 | | |
447 | 452 | | |
448 | 453 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
247 | 270 | | |
248 | 271 | | |
249 | 272 | | |
| |||
255 | 278 | | |
256 | 279 | | |
257 | 280 | | |
| 281 | + | |
258 | 282 | | |
0 commit comments