VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Driver/EncryptedIoQueue.h
AgeCommit message (Collapse)AuthorFilesLines
2024-11-23Windows Driver: Make max work items count configurable. Increase default to ↵Mounir IDRASSI1-1/+1
1024. Queue write IRPs. - Made the maximum work items count configurable to allow flexibility based on system needs. - Increased the default value of max work items count to 1024 to better handle high-throughput scenarios. - Queue write IRPs in system worker thread to avoid potential deadlocks in write scenarios.
2024-11-17Windows Driver: Fix deadlock in EncryptedIoQueue due to re-entrant IRP ↵Mounir IDRASSI1-2/+22
completions There was a deadlock issue in the driver caused by the CompletionThreadProc function in EncryptedIoQueue.c: https://sourceforge.net/p/veracrypt/discussion/general/thread/f6e7f623d0/?page=20&limit=25#8362 The driver uses a single thread (CompletionThreadProc) to process IRP completions. When IoCompleteRequest is called within this thread, it can result in new IRPs being generated (e.g., for pagefile operations) that are intercepted by the driver and queued back into the CompletionThreadQueue. Since CompletionThreadProc is the only thread processing this queue and is waiting on IoCompleteRequest, these new IRPs are not handled, leading to a system freeze. To resolve this issue, the following changes have been made: Deferred IRP Completion Using Pre-allocated Work Items: - Introduced a pool of pre-allocated work items (COMPLETE_IRP_WORK_ITEM) to handle IRP completions without causing additional resource allocations that could trigger new IRPs. - The CompletionThreadProc now queues IRP completions to these work items, which are processed in a different context using IoQueueWorkItem, preventing re-entrant IRPs from blocking the completion thread. Thread-Safe Work Item Pool Management: - Implemented a thread-safe mechanism using a semaphore (WorkItemSemaphore), spin lock (WorkItemLock), and a free list (FreeWorkItemsList) to manage the pool of work items. - Threads acquire and release work items safely, and if all work items are busy, threads wait until one becomes available. Reference Counting and Improved Stop Handling: - Added an ActiveWorkItems counter to track the number of active work items. - Modified EncryptedIoQueueStop to wait for all active work items to complete before proceeding with cleanup, ensuring a clean shutdown. These changes address the deadlock issue by preventing CompletionThreadProc from being blocked by re-entrant IRPs generated during IoCompleteRequest. By deferring IRP completion to a different context using pre-allocated work items and managing resources properly, we avoid the deadlock and ensure that all IRPs are processed correctly.
2024-06-12Avoid conflict with C++17 features std::byte by using uint8 type instead of byteMounir IDRASSI1-6/+6
2023-08-13Windows: Implement support for mounting partially encrypted system partitionsMounir IDRASSI1-0/+1
For now, we force ReadOnly mounting for such partitions.
2021-12-30Windows driver: Set maximum values for encryption queue parameters. Add ↵Mounir IDRASSI1-0/+1
IOCTL code to read used values from user space maximum value for EncryptionFragmentSize is 2048 maximum value for EncryptionIoRequestCount is 8192 maximum value for EncryptionItemCount is (EncryptionIoRequestCount/2)
2021-12-20Windows Driver: Add registry settings to control driver internal encryption ↵Mounir IDRASSI1-0/+2
queue Under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\veracrypt: - VeraCryptEncryptionFragmentSize (REG_DWORD): size of encryption data fragment in KiB. Default is 256. - VeraCryptEncryptionIoRequestCount (REG_DWORD): maximum number of parallel I/O requests. Default is 16. - VeraCryptEncryptionItemCount (REG_DWORD): maximum number of encryption queue items processed in parallel. Default is 8.
2019-01-09Windows driver: remove newly added volatile qualifier from CRYPT_INFO ↵Mounir IDRASSI1-1/+1
pointers to fix build issue until a better approach is devised
2019-01-09Windows Security: Add new entry point in driver that allows emergency ↵Mounir IDRASSI1-1/+3
clearing of all encryption keys from memory. This entry point requires administrative privileges and it will caused BSDO when system encryption is active. It can be useful for example to applications that monitors physical access to the machine and which need to erase sensitive key material from RAM when unauthorized access is detected.
2017-06-23Update IDRIX copyright yearMounir IDRASSI1-1/+1
2016-12-26Driver with support of hidden OSkavsrf1-0/+2
Signed-off-by: kavsrf <kavsrf@gmail.com>
2016-05-10Remove trailing whitespaceDavid Foerster1-4/+4
2016-05-10Normalize all line terminatorsDavid Foerster1-165/+165
2016-01-20Copyright: update dates to include 2016.Mounir IDRASSI1-1/+1
2015-08-06Update license information to reflect the use of a dual license Apache 2.0 ↵Mounir IDRASSI1-5/+9
and TrueCrypt 3.0.
2014-11-08Add original TrueCrypt 7.1a sourcesMounir IDRASSI1-0/+161