Skip to content

Commit 1268488

Browse files
committed
orchestrator: resolve the engine at the caller, not in the summary builder
compute_kaslr_info() called engine_resolve() and the sync itself, so a function named for building a summary also owned when the engine ran. Its five KASLD_TESTING blocks all hung off that: they reached file-static engine globals the testing translation unit does not link, so 202 of the function's 382 lines - 53% - were cut out of the very binary that tests it, and each quantity gaining a render sink widened the gap further. Take the two resolutions as PARAMETERS instead. struct engine was already in a header and struct engine_resolution is plain data, so the types are universal even where the instances are not; the gates become runtime `if (auth)` / `if (likely)`, and the resolution moves to emit_summary(), the single caller. compute_kaslr_info() now carries zero KASLD_TESTING blocks and compiles whole in every build. Not merely tidier: test_compute_kaslr_info_engine_pin_overrides_raw_anchor constructs a snapshot with a pinned estimate and asserts it beats the verdict-blind anchor scan. That test could not have been written before, because the code it exercises did not exist in this binary. Disabling the reconcile fails it. One hazard the move introduced and closed: a block dereferenced the likely snapshot under the auth guard. kasld_reconcile_concrete_base reads the likely edges only under have_likely, so a zeroed stand-in is sound; every auth-> and likely-> use was then audited against the guard it sits under.
1 parent 1525c71 commit 1268488

3 files changed

Lines changed: 258 additions & 151 deletions

File tree

src/include/kasld/internal.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,19 @@ int meta_get_all(const struct component_meta *m, const char *key,
887887
const char **values, int max_values);
888888
void inject_kaslr_defaults(struct summary *s);
889889
void compute_component_stats(struct summary *s);
890-
void compute_kaslr_info(struct summary *s);
890+
/* Declared at file scope: first naming these inside the parameter list below
891+
* would give them PROTOTYPE scope -- a distinct type from the definition in
892+
* orchestrator.c, which the compiler then reports as a conflicting declaration.
893+
*/
894+
struct engine;
895+
struct engine_resolution;
896+
897+
/* Projects `layout` plus the engine's two resolutions into the summary. The
898+
* snapshots are PARAMETERS, not globals: the resolution itself belongs to the
899+
* caller, and passing them keeps this whole function compiled -- and testable
900+
* -- in the build that does not link the engine, where a caller passes NULL. */
901+
void compute_kaslr_info(struct summary *s, const struct engine *auth,
902+
const struct engine_resolution *likely);
891903

892904
/* =========================================================================
893905
* Rendering (defined in render.c)

0 commit comments

Comments
 (0)