Closed DDoSolitary closed 4 years ago
@DDoSolitary Thanks for your report very appreciated.
Do you have a code sample you could share which exactly produce the issue? I will try to take a look at it this week after you send it.
#pragma comment(lib, "ntdll.lib")
#include <Windows.h>
#include <winternl.h>
extern "C" NTSYSCALLAPI NTSTATUS NtSetInformationFile(
HANDLE FileHandle,
PIO_STATUS_BLOCK IoStatusBlock,
PVOID FileInformation,
ULONG Length,
FILE_INFORMATION_CLASS FileInformationClass
);
int main() {
HANDLE h = CreateFile(
L"Z:\\t",
GENERIC_ALL,
FILE_SHARE_READ,
nullptr,
OPEN_ALWAYS,
0,
nullptr
);
IO_STATUS_BLOCK sb = {};
int size = 65536; // Any value >= 32589 works
void *info = malloc(size);
memset(info, 0x00, size);
NtSetInformationFile(
h,
&sb,
info,
size,
(FILE_INFORMATION_CLASS)13 // FileDispositionInformation
);
}
Z: is the drive mounted by mirror
Thanks @DDoSolitary ! I have been able to reproduce and find a way to fix it but it is touching a piece of code that I am already planning to largely improve. How have you faced this issue ? have you seen an app doing so ? Do you think the fix can wait some time for me to finish the work ?
Well, I haven't seen any apps calling NtSetInformationFile in such a way practically. I encountered this issue when I was using the filetest utility, which uses a 65536 byte buffer by default, to debug my memfs implementation in Rust. Therefore, I think it is not something urgent and it might be OK to wait for the large improvement.
@DDoSolitary king to let you know I made a temporary fix until I will do the big changes that will avoid such case later.
Environment
Check List
Description
If I pass a large input buffer to
NtSetInformationFile
and pass size of the buffer rather thansizeof(FILE_XXX_INFORMATION)
to itsLength
parameter, Dokan will hang forever without returning anything. I'm not very sure about the exact minimum buffer size that triggers this bug, but it seems that it's approximately 32768 bytes. Normal NTFS drives can process such large buffers without errors.Logs
Mirror log: https://paste.ubuntu.com/p/YngkvrwNxJ/