[CSRSRV] CsrCaptureArguments(): Tell the compiler the contents ClientCaptureBuffer points to has a volatile character.

See https://docs.microsoft.com/fr-fr/archive/blogs/itgoestoeleven/why-your-user-mode-pointer-captures-are-probably-broken
for more details.

Since the contents of ClientCaptureBuffer is in the shared memory, the
client could modify it while it is being probed and captured, and so we
have to avoid any potential compiler optimizations regarding the
captured "Length = ClientCaptureBuffer->Size" and
"PointerCount = ClientCaptureBuffer->PointerCount" values.
This commit is contained in:
Hermès Bélusca-Maïto 2020-04-15 14:07:25 +02:00
parent d7a632a094
commit e3a7066279
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -848,7 +848,6 @@ CsrApiRequestThread(IN PVOID Parameter)
/* Reply back to the API port now */
ReplyMsg = NULL;
ReplyPort = CsrApiPort;
CsrDereferenceThread(CsrThread);
}
else if (ReplyCode == CsrReplyPending)
@ -1121,7 +1120,8 @@ CsrCaptureArguments(IN PCSR_THREAD CsrThread,
IN PCSR_API_MESSAGE ApiMessage)
{
PCSR_PROCESS CsrProcess = CsrThread->Process;
PCSR_CAPTURE_BUFFER ClientCaptureBuffer, ServerCaptureBuffer = NULL;
volatile CSR_CAPTURE_BUFFER* ClientCaptureBuffer;
PCSR_CAPTURE_BUFFER ServerCaptureBuffer = NULL;
ULONG_PTR EndOfClientBuffer;
SIZE_T SizeOfBufferThroughOffsetsArray;
SIZE_T BufferDistance;