[WINSRV] Don't assume a CSR thread in UserServerHardError (#9647)

CSRSRV handles hard-error messages coming from threads that are not
CSR client threads (for example a kernel-mode system worker threads)
by calling the server DLLs `HardErrorCallback()` with a NULL `CSR_THREAD`
pointer (e.g. `CsrApiRequestThread()` in `subsystems/csr/csrsrv/api.c`).

`UserServerHardError()` unconditionally dereferenced that pointer in
an `ASSERT` and thus, on debug builds, any hard-error raised from such
a thread was making csrss.exe fault and bugcheck the system because a
critical process (csrss.exe) had died.

Note that `ThreadData` is not used anywhere else in the function.
This commit is contained in:
Akın Özgen
2026-10-11 00:01:44 +03:00
committed by GitHub
parent 30c0b21154
commit af0bdb697b

View File

@@ -1091,7 +1091,7 @@ UserServerHardError(
WCHAR LocalCaptionBuffer[256];
NTSTATUS Status;
ASSERT(ThreadData->Process != NULL);
ASSERT(!ThreadData || ThreadData->Process != NULL);
/* Default to not handled */
Message->Response = ResponseNotHandled;