Cosa fa
- Breadcrumb e campi lock-free e senza allocazioni
- Firma dell'errore stabile tra build diverse
- Limitatore di crash loop che alimenta il rollback di <code>updater</code>
- Rimozione dei segreti (token, chiavi, PEM)
- Container <code>report.etlcrash</code> e coda su disco
- Upload multipart tramite un'interfaccia di trasporto
- Lettore di minidump (dbghelp e Breakpad)
Misurato
- Fuzzing del lettore: 300,000 iterazioni pulite su GCC e 2,000,000 sotto ASan
Limiti noti
- La cattura dei crash reali non è ancora implementata: mancano gli handler del sistema operativo, il processo separato e la scrittura dei minidump. Oggi solo i report non fatali producono un report
Ethereal::CrashReport · Tier 1 · extension of Diagnostics
The decision that defines the module: the process that crashed cannot be trusted to report its own crash. When a handler runs, the heap may be corrupted, the stack exhausted, locks held by dead threads, the loader lock taken. Any allocation, any lock, any CRT call can hang or fail a second time. A build without
ETL_CRASHREPORTcontains none of this, byte for byte.
---
The design
The primary design is out of process. The in-process side is the fallback. The in-process side can only capture the exception context, write it to a block of **memory allocated in Init**, signal the handler, and block or die. Nothing more.
Why out of process, in a table (spec §2 requires repeating it here, because integrators ask why the design is more complex than CrashRpt's):
| Crash source | Only one that catches it... |
|---|---|
__fastfail / __debugbreak | ...the out-of-process handler (it cannot be intercepted in process) |
| Heap corruption | ...the out-of-process one (it terminates the process directly) |
/GS buffer overrun (__report_gsfailure) | ...the out-of-process one (it bypasses the filter) |
The in-process only mode is also delivered, for those who cannot spawn a second process (sandbox, console targets, single binary), and the documentation states which crash classes it misses.
---
The absolute rules of the handler (spec §1)
Inside the in-process handler, violating any of them turns a recoverable report into a hang or a double fault: **no allocation, no locks, no CRT/iostreams/snprintf, no exceptions/RTTI/std::string, only async-signal-safe calls on POSIX.** Everything is preallocated in Init. Reentrancy guard: a crash inside the handler is caught on the first reentry and exits cleanly, never in a loop. A stack overflow needs its own stack (sigaltstack. On Windows, a precreated thread with its own reserve).
---
What this build of the module actually enables
The in-memory and logic backbone, which can be measured without crashing on purpose:
| Piece | What it does | File |
|---|---|---|
| Preallocated block | breadcrumbs (lock-free ring), key-value fields (coherent even/odd snapshot), in-memory log ring | capture.hpp |
| Signature + limiter | normalizes the top N frames to (module, offset), computes the hash, stops crash loops | signature.hpp |
| Scrubbing + environment list | wipes secrets from a buffer. Only the chosen environment gets through | scrub.hpp |
| Queue + consent | bounded queue (count and bytes, the oldest gives way). Nothing leaves without consent | queue.hpp |
| The API | Init/AddCustomField/AddBreadcrumb/ReportNonFatal/UploadPending/... | handler.hpp |
| Delivery (2026-09-28) | the report.etlcrash container, the crash.json, the multipart, the on-disk queue, sending through a seam | report.hpp, handler.hpp |
| The minidump reader (2026-09-28) | the summary (exception, threads, modules, memory) and each module, from untrusted bytes | minidump.hpp |
AddCustomField and AddBreadcrumb write to the block without allocating and without a lock (target < 100 ns), because the application calls them in normal code. The in-memory log ring is the most valuable log artifact there is: it survives a buffered write that never reached the disk.
---
Delivery (2026-09-28)
With SCrashParams::pReportDir, each report is a file <folder>/pending/<id>.etlcrash:
- The container. A magic (
ETLCRASH), and entries with a name, method (stored or raw deflate), CRC32 and sizes. Inside:crash.json,log.txt(the tail of the log ring) andattachments/<n>-<name>(the registered files, read up to each one's ceiling and never beyond 16 MB). An entry that does not gain from compression is stored. The reader (ReadReportIndex/ExtractReportItem) distrusts everything: relative and safe names, sizes within the buffer, nothing after the last entry, the CRC32 checked, and a ceiling for the decompressed size. - **The
crash.jsoncarries the product, the version, the signature, the reason, the fields, the breadcrumbs, the environment only from the list** (AllowEnvironmentVariable), the crash-loop count, and says whether it is "count only". External text goes out with JSON escapes, and invalid UTF-8 becomes U+FFFD. - Scrubbing runs before packaging: over the
crash.json, the log and the attachments. - The limiter decides what is written: up to the ceiling, the entire report. The next one only carries the
crash.jsonwith the count. After that, nothing. - The write is atomic (a
.tmpand arename), and the.tmpfiles a dead process left behind are deleted inInit. Unrelated files in the folder are not touched. - The queue survives a restart:
Initrebuilds it from disk, in id order (the time in the upper bits), and whatever does not fit within the limits gives way, oldest first, and is removed from disk. - Sending (
UploadPending) only runs after the consent gate, and through theICrashTransportseam. The module does not ship an HTTP client, like the Updater. Each report goes in amultipart/form-data(the fieldsproduct,version,report_idand the filereport), from oldest to newest. A 2xx response deletes it. So does a 413 (it was never going to fit). Any other response, or the network being down, stops sending and leaves the rest in the queue.
Without a folder, the queue remains logical only (it counts, but does not store bytes), as before.
---
The signature, and the link to the Updater
The signature normalizes the top frames to (module, offset), discards the handler's own frames, and computes the hash. It is stable across builds where the crash is the same, because an absolute address never goes into the hash (ASLR would change it on every load). It serves the client-side repetition limiter (a crash loop does not send 500 identical reports: past the ceiling, a count goes instead of a payload), grouping on the server, and:
The most valuable cross-module seam in the whole package:
CrashLoopCount(signature)is the signal the Updater's health check consumes to roll back on its own a release that always crashes. A bad release stops being a fleet incident and becomes a hiccup that heals itself.
---
Privacy is a product requirement (spec §6)
A memory dump carries whatever was in memory: passwords, tokens, customer records. Customers sell to the EU and Brazil and will be asked about this during procurement.
- Consent before sending, and the default is to ask.
MayDeliveris the rule in a single place. A test confirms that nothing leaves before it returns true. Silent sending exists as an explicit option for internal deployments with a policy. - Scrubbing before packaging: registered patterns are overwritten in the buffer. The common credential patterns come by default (
Bearer,api_key=,x-api-key:,AKIA, PEM, ...). Stated plainly: scrubbing an entire dump is best effort, and the real mitigation is not collecting an entire dump.EDumpLevel::eMinimalis the recommendation for consumer software. - Environment allowlist, never the entire environment (which routinely carries tokens). The default is empty, and empty lets nothing through: the safe-by-default path.
- No user identifier is collected by the module. If the integrator wants one, they add it as a field, on purpose.
---
The API
CCrashHandler::Init( params ); // the first line of main
CCrashHandler::AddCustomField( "tier", "pro" );// lock-free, < 100 ns
CCrashHandler::AddBreadcrumb( "opened doc" ); // lock-free
CCrashHandler::ReportNonFatal( "unexpected state" ); // captures and continues
if ( !CCrashHandler::HasConsent() ) { /* your prompt */ CCrashHandler::SetConsent( true ); }
CCrashHandler::UploadPending(); // nothing leaves before consentTest is not optional: every integrator will turn on the reporter and never know whether it works until a real crash, and by then it is too late. The module gives them a button that produces a report end to end. In this layer, Test(eNonFatal) produces a real one. The types that really crash depend on the OS handlers and say eNotImplemented instead of pretending.
There is also a complete C layer (ethereal/c/crashreport/crashreport.h), for the obvious consumers in C, Rust and C#. The clock crosses as a function pointer.
---
Implementation status
Against the acceptance table (§13). What is done is measured by crashreport (126 checks), crashreport.cabi.c11/c17 (22) and crashreport.fuzz.
| Criterion | Status |
|---|---|
| Disabled build identical byte for byte | ✅ sources out of the build, behind ETHEREAL_CRASHREPORT |
| Idle cost: zero threads in the app, documented footprint | ✅ no thread. Fixed block (see crashreport_common.hpp) |
| Signature stable across builds | ✅ only (module, offset), never absolute. Tested |
| Repetition limiting (crash loop → ceiling, then count) | ✅ CRateLimiter, tested |
| Queue limits (count and bytes, the oldest gives way) | ✅ CQueuePolicy, tested |
| No loss when the network is unavailable (queue before any send) | ✅ the report enters the queue. Sending is separate |
| Scrubbing (patterns likely absent from the dump) | ✅ CScrubber, tested with a real buffer |
| Privacy by default (environment only from the list) | ✅ CEnvAllowlist, empty denies, tested |
| Consent (nothing leaves before it) | ✅ MayDeliver + UploadPending returns eNoConsent before the network |
| Reentrancy guard (nested crash exits cleanly) | ✅ an atomic flag, tested on the non-fatal path |
| Names for all statuses | ✅ |
| OS handlers (VEH, SA_SIGINFO signals, Mach ports), with chaining | ❌ pending: the detailed work for each platform |
| Out-of-process handler (shared memory, minidump of the target) | ❌ pending |
**Minidump (MiniDumpWriteDump / process_vm_readv / Mach), valid in the debugger** | ❌ pending |
| Handler purity verified by interposers (aborts on alloc/lock) | ❌ pending (depends on the real handler) |
| Coverage of each source in §2, per platform | ❌ pending |
**Own stack for stack overflow (sigaltstack / reserved thread)** | ❌ pending |
| Screenshot by the handler, with separate consent | ❌ pending |
| System info, attachments by path | ⚠️ the attachments are copied into the report (with the ceiling and scrubbing). The system info is only the architecture and the number of CPUs |
**report.etlcrash container (compression, crash.json, multipart upload)** | ✅ BuildReport/ReadReportIndex/ExtractReportItem, BuildCrashJson, BuildMultipart. Sending through the ICrashTransport seam, tested with a fake transport (2xx, 413, 503, network down) |
| Queue persistence across restarts | ✅ <folder>/pending, atomic write, rebuilt in Init, the limits giving way from the oldest |
| Fuzzing of the container reader and the minidump reader | ✅ crashreport.fuzz (mutations of valid seeds, exact-size buffer. 300,000 clean iterations on GCC, 2,000,000 under ASan) |
| Sanitizers | ✅ ASan/UBSan and TSan clean on what exists (the backbone and delivery) |
Legend: ✅ done and tested · ⚠️ partial · ❌ not yet.
What is closed is what decides the content and the output of a report, and now also the delivery: the lock-free preallocated block, the stable signature and the crash-loop limiter (with the link to the Updater), secret scrubbing, the environment list, the bounded on-disk queue, the container, sending through the seam, and the consent gate in front of all of that.
What is missing is the capture of a real crash: the OS handlers, the separate process, writing the minidump, the dedicated stack for stack overflow, the screenshot. That is why **today only non-fatal reports (ReportNonFatal) produce a report.etlcrash**. A real crash leaves no report at all, and Test for a real type returns eNotImplemented. The minidump reader already exists (it reads dbghelp dumps and Breakpad format dumps), waiting for something to write them. The items are listed one by one so that nobody pretends they do not exist. The spec is clear: capture under a corrupted heap is the heart of the module.
---
Non-goals
Symbolication, a symbol server, a crash analytics backend/dashboard, bug tracker integration, sending anything at all to Anthropic or to Typename Studios, profiling, memory leak detection.