fix(crashpad): capture a real CONTEXT for the immediate dump#2
Conversation
|
Note: I am not a maintainer or an employee of Fenris Creations. |
0276107 to
fc058e3
Compare
LPCONTEXT was zero-initialised to null, passed to GetThreadContext and then dereferenced, guaranteeing a crash in the crash path. Capture the calling thread's context with RtlCaptureContext and pass it to DumpWithoutCrash.
fc058e3 to
cff9816
Compare
You're right on both counts - thanks for the catch. I'd convinced myself the unqualified Your second point is the cleaner one anyway : I've dropped that commit from the PR rather than reframing it as cleanup : it didn't belong tied to a retracted security claim. It can land separately if a maintainer wants the cleanup. The PR now contains only the Crashpad immediate-dump null-deref fix. Maintainer or not, the technical points stand. Appreciated. |
|
Hi @Rakdos8 Thank you for the PR and apologies for the late response. We are still in the process of sorting out some details around contribution guidelines and PR templates. That said, this is a good find, addressing a real problem with capturing a thread context when using |
Summary
One fix at the crash-reporting entry point (1 atomic commit).
Problem
CrashpadCrashInterface::ProduceImmediateDumpzero-initialisedLPCONTEXTto null, passed it toGetThreadContextand dereferenced it — a guaranteed crash in the crash-reporting path.Fix
Capture the calling thread's context with
RtlCaptureContextand pass a realCONTEXTtoDumpWithoutCrash.Type
Guaranteed crash in the crash-reporting path (Critical).
Testing
Manual review; Win32-only path, behaviour for the legitimate case preserved.
Note
An earlier revision of this PR included a second commit reframing the
LoadLibrary("kernel32")call inSetProcessAffinityas a DLL search-order hijack. As @neptuwunium pointed out, that framing was wrong —kernel32is a KnownDLL, resolved from\KnownDlls, so the unqualified name is not a hijack vector. That commit has been dropped.