quiet: trim the two recurring kprintf sources, keep every verdict - #121
Merged
Conversation
TinyOS grew ~2,150 kprintf sites as a debugging tool. Measuring two boots
(idle 200s, and a ring-3 login + exec idling ~6min) showed only ~187 of them
ever fire, and only TWO things actually RECUR:
1. the EDR 60-second status report -- 10 lines/minute, forever
2. the per-exec [ELF]/[PAE] load trace -- ~35 lines every exec
Everything else in the post-boot tail is one-time. The one-time boot banner is
deliberately untouched: it is the machine stating its posture, and it costs
nothing after boot.
EDR status report: inverted from loud-when-idle to quiet-when-idle.
The full block now prints only when a FINDING counter moves (threats,
responses, TI matches); otherwise one line; and nothing at all if even the scan
counter is unchanged. Scans/processes are progress, not findings, so they do
not force the block.
Two properties kept deliberately. The FIRST report always prints in full, so an
EDR that never started stays distinguishable from one running clean. And
liveness stays observable, so a wedged daemon goes SILENT rather than
continuing to print a reassuring block of zeroes -- the old behaviour was
exactly inverted, loudest when nothing was happening, which made the report
that finally carried a nonzero threat count look identical to the 60 before it.
Per-exec trace: new kdbg(), off by default.
17 pure-trace sites converted (12 in elf.c, 5 in pae.c) -- load addresses,
page-table plumbing, per-segment copies. Every ERROR / SECURITY / WARNING /
PASS / FAILED line is deliberately left on kprintf: a verbosity flag that can
hide a signature refusal turns "absent" and "denied" into the same output,
which is the status-surface failure this tree has hit four times.
New `loglevel [normal|debug]` restores the trace without a rebuild. Root-gated
for the same reason pae/wxaudit are: the trace prints kernel physical addresses
and CR3 values, which is ASLR-defeating material regardless of how mundane the
individual lines look.
MEASURED: post-boot output 185 -> 104 lines; recurring output 10 lines/min -> 1.
Boot banner unchanged at 191 lines.
Verified:
- make clean + rebuild: 0 warnings under -Werror
- auto-verify-exec.sh PASS (signature enforcement intact, hello.elf ran)
- edr-rejoin-test.sh 10/10 PASS including both negative controls
- checked all 60 harnesses: none greps for a converted line
- round-trip proven on a live guest: 0 trace lines by default,
8 restored after `loglevel debug`
NOT done, deliberately: the `grep -v Suspicious` filters in 29 harnesses were
initially assumed stale and are NOT. edr-rejoin-test.sh:61 has a dedicated unit
test asserting that marker is repaired, edr-rejoin.sh:14 records it as the
high-frequency tear, and advanced detection is enabled by default
(edr_advanced.c:528). "Did not appear in two boots" is not "cannot appear";
removing them would make 29 harnesses fail intermittently on a correct kernel.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CEkhAhgTxbE5TgifyYf8v4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
TinyOS grew ~2,150
kprintfsites as a debugging tool. Rather than sweep all of them, I measured two boots — idle 200s, and a ring-3 login +execidling ~6 min — to find what actually reaches the screen.Only ~187 of the 2,150 ever fire, and only two things recur:
[ELF]/[PAE]load traceexecThe one-time boot banner is deliberately left alone — it's the machine stating its posture, and it costs nothing after boot.
EDR report: inverted from loud-when-idle to quiet-when-idle
The full block now prints only when a finding counter moves (threats, responses, TI matches); otherwise one line; nothing at all if even the scan counter is unchanged.
Two properties kept deliberately:
Per-exec trace: new
kdbg(), off by default17 pure-trace sites converted (12
elf.c, 5pae.c) — load addresses, page-table plumbing, per-segment copies.Every
ERROR/SECURITY/WARNING/PASS/FAILEDline is deliberately left onkprintf: a verbosity flag that can hide a signature refusal turns "absent" and "denied" into the same output, which is the status-surface failure this tree has hit four times.New
loglevel [normal|debug]restores the trace without a rebuild. Root-gated for the same reasonpae/wxauditare: the trace prints kernel physical addresses and CR3 values, which is ASLR-defeating material regardless of how mundane the individual lines look.Measured
Verified
make clean+ rebuild: 0 warnings under-Werrorauto-verify-exec.shPASS (signature enforcement intact,hello.elfran)edr-rejoin-test.sh10/10 PASS including both negative controlsloglevel debugNot done, deliberately
I initially planned to remove the
grep -v Suspiciousfilters in 29 harnesses as stale. They are not stale, and I dropped that change.edr-rejoin-test.sh:61has a dedicated unit test asserting that marker is repaired,edr-rejoin.sh:14records it as the high-frequency tear, and advanced detection is enabled by default (edr_advanced.c:528). "Did not appear in two boots" is not "cannot appear" — removing them would make 29 harnesses fail intermittently on a correct kernel.🤖 Generated with Claude Code