mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-07-06 04:58:01 -05:00
Windows: Harden Windows driver input validation
Validate SecRegion password cache offsets before use. Wipe decrypted SecRegion password-cache data even when cache validation fails. Clamp encrypted I/O work item counts and check allocation sizing. Reject invalid boot drive sector writes and initialize decoy wipe data unit. Validate hidden-system boot offsets and remap arithmetic before use.
This commit is contained in:
@@ -1250,10 +1250,15 @@ NTSTATUS EncryptedIoQueueStart (EncryptedIoQueue *queue)
|
||||
NTSTATUS status;
|
||||
EncryptedIoQueueBuffer *buffer;
|
||||
int i, j, preallocatedIoRequestCount, preallocatedItemCount, fragmentSize;
|
||||
int maxWorkItems;
|
||||
SIZE_T workItemPoolSize;
|
||||
|
||||
preallocatedIoRequestCount = EncryptionIoRequestCount;
|
||||
preallocatedItemCount = EncryptionItemCount;
|
||||
fragmentSize = EncryptionFragmentSize;
|
||||
maxWorkItems = EncryptionMaxWorkItems;
|
||||
if (maxWorkItems <= 0 || maxWorkItems > VC_MAX_WORK_ITEMS)
|
||||
maxWorkItems = VC_MAX_WORK_ITEMS;
|
||||
|
||||
queue->StartPending = TRUE;
|
||||
queue->ThreadExitRequested = FALSE;
|
||||
@@ -1355,11 +1360,16 @@ retry_preallocated:
|
||||
|
||||
// Initialize the free work item list
|
||||
InitializeListHead(&queue->FreeWorkItemsList);
|
||||
KeInitializeSemaphore(&queue->WorkItemSemaphore, EncryptionMaxWorkItems, EncryptionMaxWorkItems);
|
||||
KeInitializeSemaphore(&queue->WorkItemSemaphore, maxWorkItems, maxWorkItems);
|
||||
KeInitializeSpinLock(&queue->WorkItemLock);
|
||||
|
||||
queue->MaxWorkItems = EncryptionMaxWorkItems;
|
||||
queue->WorkItemPool = (PCOMPLETE_IRP_WORK_ITEM)TCalloc(sizeof(COMPLETE_IRP_WORK_ITEM) * queue->MaxWorkItems);
|
||||
queue->MaxWorkItems = maxWorkItems;
|
||||
if (FAILED(SizeTMult(sizeof(COMPLETE_IRP_WORK_ITEM), queue->MaxWorkItems, &workItemPoolSize)))
|
||||
{
|
||||
goto noMemory;
|
||||
}
|
||||
|
||||
queue->WorkItemPool = (PCOMPLETE_IRP_WORK_ITEM)TCalloc(workItemPoolSize);
|
||||
if (!queue->WorkItemPool)
|
||||
{
|
||||
goto noMemory;
|
||||
|
||||
Reference in New Issue
Block a user