From af0bdb697bb6724eb3ea7ecb3ee77c36e8479f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ak=C4=B1n=20=C3=96zgen?= Date: Sun, 11 Oct 2026 00:01:44 +0300 Subject: [PATCH] [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. --- win32ss/user/winsrv/usersrv/harderror.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32ss/user/winsrv/usersrv/harderror.c b/win32ss/user/winsrv/usersrv/harderror.c index ee938411917..421ef3bd4c5 100644 --- a/win32ss/user/winsrv/usersrv/harderror.c +++ b/win32ss/user/winsrv/usersrv/harderror.c @@ -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;