[*] Fix up AuProcess version handling handling. Includes a new secret env-var.

(amended)
This commit is contained in:
Reece Wilson 2023-06-08 09:52:53 +01:00
parent a56538a4cd
commit 519ba4b26e
3 changed files with 35 additions and 7 deletions

View File

@ -399,9 +399,40 @@ namespace Aurora::Process
return this->allocations; return this->allocations;
} }
void ProcessSectionView::DoVanillaDriverlessExtesionWin7Test()
{
#if defined(AURORA_PLATFORM_WIN32)
#define WIN_7_WARN "WARNING: ADDRESS SPACE CANNOT BE RESERVED ON OLDER NT KERNELS. \r\n" \
"AuProcess::ReserveAddressSpace(AuUInt uOffset) is about to lie about reserving the address space, yield the entire address space, and leave a note to terminate the application if an explicit fixed-offset request is made."
SysPushErrorUnimplemented("Win7_ReserveAddressSpace_RS4_REQ");
AuUInt uEnvSize {};
::getenv_s(&uEnvSize, nullptr, 0, "AURORA_FORCE_RANDOM_ADDRESS_WITHOUT_VIRTALLOC2");
if (uEnvSize)
{
// bah
// enjoy return not respecting what was provided as the expected offset.
// this is not a workaround for missing functionality in the operating systems userland and kernel abstraction.
// this will just prevent us from panicing preemptively.
this->bPanicOnEx = true;
}
else
{
AuLogWarn(WIN_7_WARN);
this->bPanicOnEx = false;
}
#else
AuLogWarn("I don't know this platform - AuProcess");
this->bPanicOnEx = true;
#endif
}
AUKN_SYM AuSPtr<IProcessSectionView> GetGlobalProcessSpace() AUKN_SYM AuSPtr<IProcessSectionView> GetGlobalProcessSpace()
{ {
static ProcessSectionView gSingleton; static ProcessSectionView gSingleton;
gSingleton.DoVanillaDriverlessExtesionWin7Test();
return AuUnsafeRaiiToShared(&gSingleton); return AuUnsafeRaiiToShared(&gSingleton);
} }
} }

View File

@ -11,10 +11,12 @@ namespace Aurora::Process
{ {
struct ProcessSectionView : IProcessSectionView struct ProcessSectionView : IProcessSectionView
{ {
bool bPanicOnEx {}; bool bPanicOnEx { true }; // SysAssert(this->bPanicOnEx) - it's inverted! true -> dont panic
AuThreadPrimitives::SpinLock spinlock; AuThreadPrimitives::SpinLock spinlock;
AuList<AuPair<AuUInt, AuUInt>> allocations; AuList<AuPair<AuUInt, AuUInt>> allocations;
void DoVanillaDriverlessExtesionWin7Test();
AuUInt GetStart() override; AuUInt GetStart() override;
AuUInt GetEnd() override; AuUInt GetEnd() override;

View File

@ -559,13 +559,8 @@ namespace Aurora::Process
if (!pVirtualAlloc2) // allow modified windows runtimes if (!pVirtualAlloc2) // allow modified windows runtimes
#endif #endif
{ {
#define WIN_7_WARN "WARNING: ADDRESS SPACE CANNOT BE RESERVED ON OLDER NT KERNELS. \r\n" \
"AuProcess::ReserveAddressSpace(AuUInt uOffset) is about to lie about reserving the address space, yield the entire address space, and leave a note to terminate the application if an explicit fixed-offset request is made."
SysPushErrorUnimplemented("Win7_ReserveAddressSpace_RS4_REQ");
AuLogWarn(WIN_7_WARN);
static ProcessSectionView gSingleton; static ProcessSectionView gSingleton;
gSingleton.bPanicOnEx = true; gSingleton.DoVanillaDriverlessExtesionWin7Test();
return AuUnsafeRaiiToShared(&gSingleton); return AuUnsafeRaiiToShared(&gSingleton);
} }