mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-25 13:03:50 +00:00
fix: warden mmap on macOS, add external listfile support to asset extractor
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Drop PROT_EXEC from warden module mmap when using Unicorn emulation (not needed — module image is copied into emulator address space). Use MAP_JIT on macOS for the native fallback path. Add --listfile option to asset_extract and SFileAddListFileEntries support for resolving unnamed MPQ hash table entries from external listfiles.
This commit is contained in:
parent
2fd9473f3b
commit
2343b768ce
4 changed files with 110 additions and 17 deletions
|
|
@ -535,11 +535,25 @@ bool WardenModule::parseExecutableFormat(const std::vector<uint8_t>& exeData) {
|
|||
return false;
|
||||
}
|
||||
#else
|
||||
// When using Unicorn emulation the module image is copied into the
|
||||
// emulator's address space, so we only need read/write access here.
|
||||
// Native execution paths (non-Unicorn) need PROT_EXEC; on macOS this
|
||||
// requires MAP_JIT due to hardened-runtime restrictions.
|
||||
#ifdef HAVE_UNICORN
|
||||
int mmapProt = PROT_READ | PROT_WRITE;
|
||||
int mmapFlags = MAP_PRIVATE | MAP_ANONYMOUS;
|
||||
#elif defined(__APPLE__)
|
||||
int mmapProt = PROT_READ | PROT_WRITE | PROT_EXEC;
|
||||
int mmapFlags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_JIT;
|
||||
#else
|
||||
int mmapProt = PROT_READ | PROT_WRITE | PROT_EXEC;
|
||||
int mmapFlags = MAP_PRIVATE | MAP_ANONYMOUS;
|
||||
#endif
|
||||
moduleMemory_ = mmap(
|
||||
nullptr,
|
||||
finalCodeSize,
|
||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS,
|
||||
mmapProt,
|
||||
mmapFlags,
|
||||
-1,
|
||||
0
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue