Repository navigation
Commit 9545ea4
committed
perf(daemon): hash the executable image once per process; announce missed hook deadlines
The build-identity fingerprint is a SHA-256 over the entire ~295 MB
executable: ~1.1 s per hash on an M5 Pro, ~2.3 s on the machine where
this was first measured. A daemon pays it twice at start: the
supervisor's startup capture and the runtime service's active-image
check.
- Cache the fingerprint per process at
runtime_process_image_reference_acquire, keyed by (device, inode,
size, mtime, change time): the identity the acquire path already
verifies as stable across the hash, so a rebuilt or replaced binary
rolls the key. On Windows the change time is
FILE_BASIC_INFO.ChangeTime, which the kernel maintains and SetFileTime
cannot reset. Every hit is still bracketed by the same before/after
stat and process-maps checks, so a cached digest stays bound to the
verified image. A freshly hashed digest is committed only after the
acquire chain, including the post-hash stat check, has passed, and
only under the identity observed after the hash, so an image that
changed under the hash is never cached. The cache is process-local:
it removes the daemon's second start-up hash (cold start 6.5 s ->
5.3 s with a 296 MB image); a fresh hook process still hashes its own
image once.
- A missed hook deadline is announced on stderr as well as the timeouts
log, so a fired deadline is never a silent 0-byte exit 0. The
breadcrumb is formatted before the log path is resolved, so stderr
gets it even when the log cannot be opened. CBM_HOOK_DEADLINE_MS is
unchanged.
SHA-256 itself is unchanged: one portable scalar implementation on every
platform.
Refs #1335, #2058
Signed-off-by: Brian McNaboe <bmcnaboe@gmail.com>1 parent 80eb92a commit 9545ea4
5 files changed
Lines changed: 556 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
102 | 109 | | |
103 | 110 | | |
104 | 111 | | |
105 | 112 | | |
106 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
107 | 124 | | |
108 | 125 | | |
109 | 126 | | |
| |||
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | 139 | | |
131 | 140 | | |
132 | 141 | | |
| |||
0 commit comments