Skip to content

Commit 996cb66

Browse files
committed
render, engine: drop two write-only struct fields
stride_binding (struct estimate) and n_projecting (struct hardening_report) were each populated but never read outside a single test assertion. stride_binding was a symmetry artifact of the engine rewrite with no stride-lineage consumer; n_projecting shipped un-wired in its introducing commit — the combined-ceiling line it was meant to gate has always gated on has_projection. Remove both fields, their assignments, and the stale comment that described the never-wired gate. No behavior change: the -H output is byte-identical and the stride pair (value + CRT folding) is untouched. Adjust the two tests that asserted the fields.
1 parent 2d24dfe commit 996cb66

7 files changed

Lines changed: 12 additions & 27 deletions

File tree

src/estimate.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ void estimate_meet(struct estimate *e, const struct quantity_def *qd,
206206
if (e->stride == 0) {
207207
e->stride = m;
208208
e->stride_offset = r % m;
209-
e->stride_binding = c->id;
210209
} else {
211210
unsigned long combined_r, combined_m;
212211
if (!stride_crt(e->stride_offset, e->stride, r % m, m, &combined_r,
@@ -216,12 +215,10 @@ void estimate_meet(struct estimate *e, const struct quantity_def *qd,
216215
* the standard interval test. */
217216
e->lo = 1;
218217
e->hi = 0;
219-
e->stride_binding = c->id;
220218
break;
221219
}
222220
e->stride = combined_m;
223221
e->stride_offset = combined_r;
224-
e->stride_binding = c->id;
225222
}
226223
break;
227224
}

src/include/kasld/estimate.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ struct estimate {
4848
* value satisfies (q % stride) == stride_offset in addition to lying in
4949
* [lo, hi]. Multiple C_STRIDE constraints fold via CRT in estimate_meet;
5050
* unsolvable systems push the estimate to bottom. Always 0 on
51-
* LK_MAXALIGN / LK_FINSET (the stride concept doesn't apply there).
52-
* stride_binding names the most-recent C_STRIDE that touched the pair. */
51+
* LK_MAXALIGN / LK_FINSET (the stride concept doesn't apply there). */
5352
unsigned long stride;
5453
unsigned long stride_offset;
55-
uint32_t stride_binding;
5654
};
5755

5856
/* Result of resolving one quantity: the estimate plus the ids of constraints

src/include/kasld/render_internal.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,14 @@ struct hardening_report {
183183

184184
/* Projected posture: current guaranteed residual entropy, and the
185185
* ceiling if ALL suggestions are applied together. has_projection is 0 when
186-
* the engine is compiled out (projected rows are then suppressed).
187-
* n_projecting counts suggestions carrying a projection (the combined-ceiling
188-
* line is only informative once more than one contributes). The lockdown and
189-
* dmesg-fallback suggestions carry their own projected pair because they are
190-
* not gate_suggestions[] entries. */
186+
* the engine is compiled out (projected rows are then suppressed). The
187+
* lockdown and dmesg-fallback suggestions carry their own projected pair
188+
* because they are not gate_suggestions[] entries. */
191189
int has_projection;
192190
int cur_vbits, cur_pbits;
193191
int all_vbits, all_pbits;
194-
int all_impact; /* distinct components silenced by applying every suggestion
195-
*/
196-
int n_projecting; /* suggestions (gate + lockdown + dmesg) with a projection
197-
*/
192+
int all_impact; /* distinct components silenced by applying every suggestion
193+
*/
198194
/* Leave-one-out for the lockdown and dmesg-fallback suggestions (they are not
199195
* gate_suggestions[] entries). skip_* / silences mirror hr_suggestion. */
200196
int lockdown_has_projection, lockdown_silences;

src/quantities.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ static void top_interval(struct estimate *e, unsigned long lo,
4242
e->lo_conf = e->hi_conf = CONF_PARSED; /* honest top is an arch axiom */
4343
e->stride = 0;
4444
e->stride_offset = 0;
45-
e->stride_binding = 0;
4645
}
4746

4847
static void top_virt_image_base(struct estimate *e) {
@@ -118,7 +117,7 @@ static void top_maxalign(struct estimate *e) {
118117
e->hi = 0ul;
119118
e->lo_binding = e->hi_binding = 0;
120119
e->lo_conf = e->hi_conf = CONF_PARSED; /* honest top is an arch axiom */
121-
e->stride = e->stride_offset = e->stride_binding = 0;
120+
e->stride = e->stride_offset = 0;
122121
}
123122

124123
static void top_va_bits(struct estimate *e) {
@@ -130,7 +129,7 @@ static void top_va_bits(struct estimate *e) {
130129
e->hi = 0ul;
131130
e->lo_binding = e->hi_binding = 0;
132131
e->lo_conf = e->hi_conf = CONF_PARSED; /* honest top is an arch axiom */
133-
e->stride = e->stride_offset = e->stride_binding = 0;
132+
e->stride = e->stride_offset = 0;
134133
}
135134

136135
/* ---- the table -------------------------------------------------------- */

src/render/hardening.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,6 @@ void build_hardening_report(struct hardening_report *r) {
412412
sg->has_projection = 1;
413413
sg->skip_vbits = pp.vbits;
414414
sg->skip_pbits = pp.pbits;
415-
r->n_projecting++;
416415
}
417416
}
418417
if (r->suggest_lockdown) {
@@ -422,7 +421,6 @@ void build_hardening_report(struct hardening_report *r) {
422421
r->lockdown_has_projection = 1;
423422
r->lockdown_skip_vbits = pp.vbits;
424423
r->lockdown_skip_pbits = pp.pbits;
425-
r->n_projecting++;
426424
}
427425
}
428426
if (r->suggest_dmesg_fallback) {
@@ -432,7 +430,6 @@ void build_hardening_report(struct hardening_report *r) {
432430
r->dmesg_fallback_has_projection = 1;
433431
r->dmesg_fallback_skip_vbits = pp.vbits;
434432
r->dmesg_fallback_skip_pbits = pp.pbits;
435-
r->n_projecting++;
436433
}
437434
}
438435

tests/test_estimate.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -509,17 +509,16 @@ static struct constraint mk_stride(enum kasld_quantity q, unsigned long residue,
509509
return c;
510510
}
511511

512-
/* First stride constraint sets the annotation; the estimate's stride pair
513-
* matches the residue and modulus. */
514-
static void test_stride_first_constraint_sets_annotation(void) {
512+
/* First stride constraint sets the estimate's stride pair to the residue and
513+
* modulus. */
514+
static void test_stride_first_constraint_sets_pair(void) {
515515
struct estimate e;
516516
quantities[Q_VIRT_IMAGE_BASE].init_top(&e);
517517
struct constraint c =
518518
mk_stride(Q_VIRT_IMAGE_BASE, 0x1234ul, 0x100000ul /* 1 MiB */, 1);
519519
estimate_meet(&e, &quantities[Q_VIRT_IMAGE_BASE], &c);
520520
assert(e.stride == 0x100000ul);
521521
assert(e.stride_offset == 0x1234ul);
522-
assert(e.stride_binding == 1);
523522
assert(!estimate_is_bottom(&e, &quantities[Q_VIRT_IMAGE_BASE]));
524523
}
525524

@@ -649,7 +648,7 @@ int main(void) {
649648
RUN(test_finset_meet);
650649

651650
BEGIN_CATEGORY("Stride (C_STRIDE) algebra");
652-
RUN(test_stride_first_constraint_sets_annotation);
651+
RUN(test_stride_first_constraint_sets_pair);
653652
RUN(test_stride_same_modulus_agreeing_residues);
654653
RUN(test_stride_same_modulus_disagreeing_residues_bottom);
655654
RUN(test_stride_crt_combines_to_lcm);

tests/test_render.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1867,7 +1867,6 @@ static void test_hardening_projection(void) {
18671867
assert(rep.suggest_dmesg_fallback && rep.dmesg_fallback_has_projection == 1 &&
18681868
rep.dmesg_fallback_silences == 1 &&
18691869
rep.dmesg_fallback_skip_vbits == 6);
1870-
assert(rep.n_projecting == 3);
18711870

18721871
/* Text: the current-vs-hardened anchor + a load-bearing verdict per
18731872
* suggestion (each forfeits 1 bit). */

0 commit comments

Comments
 (0)