https://bugs.winehq.org/show_bug.cgi?id=54364
Bug ID: 54364 Summary: RtlGenRandom fails on systems with more than 128 cores Product: Wine Version: 8.0-rc5 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: advapi32 Assignee: wine-bugs@winehq.org Reporter: tjeerd.bakker38@gmail.com Distribution: ---
WinHttpSendRequest() fails with ERROR_OUTOFMEMORY when the WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET is set on systems with 256 cores. I've tracked it down to dlls/advapi32/crypt.c.
RtlGenRandom is implemented by calling NtQuerySystemInformation(SystemInterruptInformation, ...) with a buffer sufficient for the data from at most 128 CPUs. The buffer size is determined by the #define in line 2393:
#define MAX_CPUS 128
Changing this line to
#define MAX_CPUS 256
make the problem go away for me, but the problem will probably return when someone builds a system with even more cores. I would suggest implementing RtlGenRandom() with a better source of randomness instead.
https://bugs.winehq.org/show_bug.cgi?id=54364
--- Comment #1 from Hans Leidekker hans@meelstraat.net --- (In reply to tjeerd.bakker38 from comment #0)
WinHttpSendRequest() fails with ERROR_OUTOFMEMORY when the WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET is set on systems with 256 cores. I've tracked it down to dlls/advapi32/crypt.c.
RtlGenRandom is implemented by calling NtQuerySystemInformation(SystemInterruptInformation, ...) with a buffer sufficient for the data from at most 128 CPUs. The buffer size is determined by the #define in line 2393:
#define MAX_CPUS 128
Changing this line to
#define MAX_CPUS 256
make the problem go away for me, but the problem will probably return when someone builds a system with even more cores. I would suggest implementing RtlGenRandom() with a better source of randomness instead.
Note that NtQuerySystemInformation(SystemInterruptInformation, ...) returns a buffer filled get with getrandom(). It's more a matter of finding the right interface to fetch the bytes from the Unix side than picking the right source. It would be nice if we could avoid introducing a PE/Unix split just for this purpose.
I think bumping the size to 256 is okay for now.
https://bugs.winehq.org/show_bug.cgi?id=54364
Hans Leidekker hans@meelstraat.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Fixed by SHA1| |369e0cfae6052937ef6b90e8c9f | |e916ea6765d9b Resolution|--- |FIXED
--- Comment #2 from Hans Leidekker hans@meelstraat.net --- Fixed with 369e0cfae6052937ef6b90e8c9fe916ea6765d9b.
https://bugs.winehq.org/show_bug.cgi?id=54364
--- Comment #3 from tjeerd.bakker38@gmail.com --- Thanks
https://bugs.winehq.org/show_bug.cgi?id=54364
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #4 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 8.1.
https://bugs.winehq.org/show_bug.cgi?id=54364
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |8.0.x
https://bugs.winehq.org/show_bug.cgi?id=54364
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|8.0.x |---
--- Comment #5 from Michael Stefaniuc mstefani@winehq.org --- Removing the 8.0.x milestone from bug fixes included in 8.0.1.