[*] Fixed missed and double mimalloc init, via allocation under SwInfo, being probed by alternative nt clock query logic, under the fallback rng algorithm, possibly under another tls thread_only race condition
This commit is contained in:
parent
48c2175be9
commit
f798c59cb8
@ -114,14 +114,6 @@ namespace Aurora::RNG
|
||||
|
||||
static AuUInt32 RngWin32(AuUInt8 *pBuf, AuUInt32 uLen)
|
||||
{
|
||||
if (pRtlGenRandom)
|
||||
{
|
||||
if (pRtlGenRandom(pBuf, uLen))
|
||||
{
|
||||
return uLen;
|
||||
}
|
||||
}
|
||||
|
||||
if (pBCryptGenRandom)
|
||||
{
|
||||
if (AuSwInfo::IsWindows10OrGreater() ||
|
||||
@ -133,11 +125,21 @@ namespace Aurora::RNG
|
||||
}
|
||||
}
|
||||
|
||||
if (pRtlGenRandom(pBuf, uLen))
|
||||
{
|
||||
return uLen;
|
||||
}
|
||||
|
||||
if (pBCryptGenRandom(NULL, reinterpret_cast<PUCHAR>(pBuf), uLen, BCRYPT_USE_SYSTEM_PREFERRED_RNG) == 0)
|
||||
{
|
||||
return uLen;
|
||||
}
|
||||
}
|
||||
else if (pRtlGenRandom &&
|
||||
pRtlGenRandom(pBuf, uLen))
|
||||
{
|
||||
return uLen;
|
||||
}
|
||||
|
||||
#if defined(AURORA_RNG_HAS_OLD_WINCRYPT)
|
||||
if (gCryptoProv)
|
||||
@ -169,7 +171,7 @@ namespace Aurora::RNG
|
||||
static AuUInt64 gTimeHolder;
|
||||
static AuUInt64 gTime = (gTimeHolder = AuTime::SteadyClockJiffies()) >= 10'000'000ull ?
|
||||
1 :
|
||||
AuPageRoundUp<AuUInt64>((10'000'000ull / gTimeHolder), 1024);
|
||||
AuPageRoundUp<AuUInt64>(10'000'000ull, 1024) / gTimeHolder;
|
||||
return AuTime::SteadyClockNS() * gTime / 10'000ull;
|
||||
#endif
|
||||
}
|
||||
|
@ -88,13 +88,11 @@ namespace Aurora::SWInfo
|
||||
|
||||
#endif
|
||||
|
||||
void InitNTInfo(OSInformation &osInfo)
|
||||
void InitNTInfoNoAllocate(OSInformation &osInfo)
|
||||
{
|
||||
OSVERSIONINFOEX info {};
|
||||
info.dwOSVersionInfoSize = sizeof(info);
|
||||
|
||||
osInfo = AuMove(OSInformation(&gKernelString, &gUserlandBrand, &gUserlandDesktopEnv, &gBuildString, Aurora::Build::EPlatform::eEnumInvalid));
|
||||
|
||||
#if defined(AURORA_PLATFORM_WIN32)
|
||||
Win32SetIsServer(osInfo);
|
||||
osInfo.bIsEnterprise = osInfo.bIsServer;//IsWindowsEnterpriseBranch();
|
||||
@ -103,8 +101,6 @@ namespace Aurora::SWInfo
|
||||
osInfo.bIsEnterprise = false;
|
||||
#endif
|
||||
|
||||
gUserlandDesktopEnv = "Desktop Window Manager";
|
||||
|
||||
if (GetVersionExA(reinterpret_cast<LPOSVERSIONINFOA>(&info)))
|
||||
{
|
||||
osInfo.uKernelPatch = info.dwBuildNumber;
|
||||
@ -131,7 +127,18 @@ namespace Aurora::SWInfo
|
||||
osInfo.uUserlandMinor = ovi.wServicePackMajor;
|
||||
osInfo.uUserlandPatch = ovi.wServicePackMinor;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void InitNTInfo(OSInformation &osInfo)
|
||||
{
|
||||
osInfo = AuMove(OSInformation(&gKernelString, &gUserlandBrand, &gUserlandDesktopEnv, &gBuildString, Aurora::Build::EPlatform::eEnumInvalid));
|
||||
|
||||
InitNTInfoNoAllocate(osInfo);
|
||||
|
||||
gUserlandDesktopEnv = "Desktop Window Manager";
|
||||
|
||||
#if defined(AURORA_PLATFORM_WIN32)
|
||||
HKEY hKey;
|
||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
|
@ -10,4 +10,5 @@
|
||||
namespace Aurora::SWInfo
|
||||
{
|
||||
void InitNTInfo(OSInformation &info);
|
||||
void InitNTInfoNoAllocate(OSInformation &info);
|
||||
}
|
@ -30,6 +30,7 @@ namespace Aurora::SWInfo
|
||||
|
||||
AUKN_SYM const OSInformation &GetPlatformInfo()
|
||||
{
|
||||
SysAssert(gInfo, "No Platform Information Initialized");
|
||||
return *gInfo;
|
||||
}
|
||||
|
||||
@ -48,4 +49,13 @@ namespace Aurora::SWInfo
|
||||
gTempInfo.ePlatform = Build::kCurrentPlatform;
|
||||
gInfo = &gTempInfo;
|
||||
}
|
||||
|
||||
void InitSwInfoEarly()
|
||||
{
|
||||
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
||||
InitNTInfoNoAllocate(gTempInfo);
|
||||
gTempInfo.ePlatform = Build::kCurrentPlatform;
|
||||
gInfo = &gTempInfo;
|
||||
#endif
|
||||
}
|
||||
}
|
@ -10,4 +10,5 @@
|
||||
namespace Aurora::SWInfo
|
||||
{
|
||||
void InitSwInfo();
|
||||
void InitSwInfoEarly();
|
||||
}
|
@ -133,7 +133,7 @@
|
||||
gInitOnce.Call([]
|
||||
{
|
||||
Aurora::InitNTAddresses();
|
||||
AuSwInfo::InitSwInfo();
|
||||
AuSwInfo::InitSwInfoEarly();
|
||||
|
||||
if constexpr (AuBuild::kCurrentPlatform == AuBuild::EPlatform::ePlatformWin32)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user