mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-14 00:23:50 +00:00
fix: warden mmap on macOS, add external listfile support to asset extractor
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
84108c44f5
commit
b3fa8cf5f3
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