Skip to main content

Module image

Module image 

Source
Expand description

Verified private worker images, reused under a settled complete stat stamp (ADR 0082, ADR 0173).

Every native job runs a private copy of the installed worker whose bytes were hashed against the installation manifest, so a later change to the installed file cannot change what runs. Hashing and copying the 76 MB worker cost about 100 ms per job (#765). This module keeps one verified copy per installed worker in a per-user private directory and reuses it while both files keep their recorded complete stamps:

  • The installed worker’s stamp (device, inode, size, mode, mtime and ctime with nanoseconds) is recorded only when it was settled (Stamp::settled) before the bytes were read and is unchanged after they were hashed. Any later write, replacement, chmod or utimes advances ctime, so the next job misses and verifies the bytes again.
  • The private copy is mode 0500 in a mode 0700 directory owned by this user. Its own complete stamp, owner and link count must still equal the ones recorded right after it was written; writing it needs a chmod first, which changes ctime.

Anything unexpected (another owner, a symbolic link, wider permissions, an unreadable or foreign record, a different source path or digest) misses, and the job uses a fresh verified copy of its own exactly as before. A miss never fails a job that would otherwise run.

Structs§

Image
A verified private copy of the worker, ready to execute.

Functions§

fresh
A fresh verified copy of source for one job, as before caching.
image
The verified private copy of source for one job: a reused one when both stamps still match, otherwise a fresh one, recorded for reuse when the installed worker was settled and unchanged while it was hashed.