I've been building a bare-metal kernel (Rust, no_std) as an independent project, and I'd like feedback on how it handles file integrity.
Most integrity schemes (fs-verity, dm-verity, IMA) verify once — at load, or when a page is first read from storage — and then trust the cached copy. That leaves a gap: if something corrupts the in-memory page after the check (DMA, a kernel bug, rowhammer), later reads return tampered bytes as authentic.
Re-hashing the whole file on every read closes the gap but scales with file size — reading 4 bytes of a 4 MiB file re-hashes all 4 MiB.
What I did instead: each file is split into 4 KiB blocks, each with a stored BLAKE3 leaf hash. A ranged read maps to the blocks it overlaps and verifies only those, so per-read cost is proportional to bytes read. A lazily-recomputed Merkle root over the leaves bounds write cost. I hook this into the VFS read path so there's no way to read without verifying.
On real hardware, per-block verification stays roughly constant (~2.7 µs x86-64, ~3.65 µs ARM64) across 4 KiB–4 MiB, while whole-file grows into milliseconds.
Repo's link : https://github.com/abhiprd2000/axiom-os-kernel. Curious whether anyone's done per-read (not load-time) integrity in their kernel, and how you'd approach the VFS hook differently.
Per-read file integrity in my kernel — verifying only the blocks a read touches
-
abhiprd2000
- Posts: 1
- Joined: Fri Jun 26, 2026 9:25 am
- Libera.chat IRC: Abhimanyu Prasad