Themida-virtualised routine silently produces no result under wow64 (no crash, buffer left untouched)
Summary
A Themida-packed 32-bit Windows application runs under FEX (wow64), but one obfuscated routine silently produces no result — no crash, no SIGSEGV, no unhandled exception. The routine is supposed to decrypt a buffer in place; under FEX the buffer is left completely untouched, and the caller then fails downstream. The same binary and the same data work correctly under Proton on x86_64.
I traced this down to the guest instruction level and confirmed the input buffer is byte-for-byte unmodified, so this looks like a correctness bug in translating Themida-virtualized code rather than a crash or a missing syscall.
Environment
- Host: Snapdragon 8 Gen 2 (
kalama), Android 13, aarch64 - Wine: proton 11.0-arm64x (also reproduced on proton 9.0-arm64x)
- Guest app: 32-bit PE via
libwow64fex.dll - FEX builds tested (all identical behaviour):
20241214,20251217,20260618,20260813
Config used (defaults from the host app):
{"Multiblock":"1","MaxInst":"5000","HostFeatures":"off","SmallTSCScale":"1",
"TSOEnabled":"1","VectorTSOEnabled":"0","MemcpySetTSOEnabled":"0",
"HalfBarrierTSOEnabled":"0","VolatileMetadata":"1","HideHypervisorBit":"0",
"X87ReducedPrecision":"1","MonoHacks":"1","SMCChecks":"1","ForceSVEWidth":"0"}
Application
Plutonium (a third-party Call of Duty client). Its plutonium-bootstrapper-win32.exe is
packed with Themida — sections .payload (VirtualSize 0x12000000), .themida,
.boot, and at runtime a ~786 MB rwxp region. The affected routine's entry point is a
jmp directly into the Themida-virtualised region, i.e. the code is executed by Themida's
obfuscation VM rather than as plain x86.
Note the app has two code paths: one that does not need the obfuscated routine works perfectly under FEX; only the path that calls into it fails. So the bulk of the Themida-protected binary translates fine — this is one specific VM'd routine.
Symptom and analysis
The guest calls a decrypt helper and then inflate() on the result:
40bd31: memset(&strm, 0, 0x34)
40bd3e: inflateInit2_(&strm, -15, ...) ; raw deflate
40bd87: call 0x5e4460 ; decrypt helper -> jmp into .themida region
40bd93: call 0x4310a0 ; inflate(&strm, Z_FULL_FLUSH)
40bda0: cmp eax, 1
40bda3: je done
40bda5: test eax, eax
40bda7: jne 0x40bda0 ; app spins forever on any error (app bug)
Profiling with simpleperf record -t <tid> showed 100% of samples inside
[anon:FEXMemJIT] in a 6-instruction loop. FEX's block metadata conveniently embeds the
guest RIPs next to the block-entry pattern (ADR X0,..; STR X0,[X28]; STRB WZR,[X28,#3712]),
which is how I mapped the JIT address back to guest 0x40bda0.
I then located the live call frame by scanning dumped guest memory for the return address
0x40bd98 (exactly one match) and read the z_stream:
msg="invalid distance too far back"total_in = 3,total_out = 0next_inpoints 16 bytes into the buffer, as the caller intends
Dumping the input buffer and comparing it against the on-disk source file shows it is
byte-identical — header and payload. The decrypt helper therefore wrote nothing at
all. It did not crash, and execution continued normally into inflate().
So the failure mode is: the Themida VM executes, returns, and produces no side effects, where on x86_64 it decrypts the buffer in place.
What I ruled out
- Input data: the file is md5-identical to the copy that works under Proton on x86_64.
- Wine version: reproduced on proton 11.0-arm64x and proton 9.0-arm64x.
- FEX version: 4 builds spanning Dec 2024 → Aug 2026, all identical.
- FEX settings, none of which changed the outcome:
VectorTSOEnabled=1,MemcpySetTSOEnabled=1Multiblock=0SMCChecks=1(mtrack) and3(full).SMCChecks=2prevents startup entirely (wine exits 5)HideHypervisorBit=1(in case of anti-VM detection)X87ReducedPrecision=0O0=1aborts the launch before the app starts, so it could not be evaluated
Given Themida leans on unusual flag semantics, x87, and self-modifying code, I suspect an edge case in one of those areas. Possibly related to #1746.
Why this may be worth supporting
Themida and VMProtect are common on Windows game binaries and anti-cheat/loader components, so a divergence here likely affects more than this one title. The silent-wrong-result mode is particularly awkward to diagnose — there is no crash to catch, and the failure only surfaces much later as corrupt data.
I am happy to run experiments, capture traces, or test patches on this device — I already have the whole launch-and-inspect cycle scripted.
Follow-up, and a correction: I've reproduced this on a completely different translator, so this is very likely not a FEX bug. Posting the data in case it's useful, but I'm happy for this to be closed.
Same device (Snapdragon 8 Gen 2, Android 13), same game, same input files — but run under Winlator 11.2, i.e. Box64 0.4.4 (BOX32) with wine 10 WoW64, instead of FEX under a proton-arm64ec container.
| engine | configuration | result |
|---|---|---|
| FEX dynarec | as originally reported | infinite spin in the caller's error path |
| Box64 dynarec | default "performance" tuning | infinite spin, same thread, same point |
| Box64 dynarec | max compatibility ¹ | infinite spin, same thread, same point |
| Box64 interpreter | BOX64_DYNAREC=0 |
process exits cleanly ~45s in — no signal, no tombstone |
¹ BOX64_DYNAREC_SAFEFLAGS=2 BIGBLOCK=0 STRONGMEM=3 CALLRET=0 NATIVEFLAGS=0 X87DOUBLE=1 FASTNAN=0 FASTROUND=0 WEAKBARRIER=0 FORWARD=0, confirmed present in /proc/<pid>/environ rather than just written to config.
In every dynarec case the failure is identical to the original report: the thread making the Themida-virtualised call spins at ~100% of a core with /proc/<tid>/syscall reporting running on every sample (never in a syscall) and no further file reads, and the output buffer is left byte-for-byte identical to the input.
The interpreter result is the decisive one. With BOX64_DYNAREC=0 there is no JIT involved at all, so there is no mistranslation available to explain the behaviour — and the process doesn't fault, it terminates itself. That fits the Themida VM detecting a non-native execution environment and taking a bail-out path far better than it fits any translator emitting wrong code.
So I think my original attribution was wrong: the routine isn't being mistranslated, it's declining to run. Unless the "silently returns without writing its output, no crash" shape is worth keeping around as a reference case, feel free to close this.
Sorry for the noise, and thanks for looking.
Just replying to this thread because I am experiencing the exact same issue with Plutonium, so color me surprised when I go to look through the issues page and see the most recent one shares nearly my exact issue.
Key differences for me are that I am instead running on ArmadaOS (immutable Fedora Linux based "SteamOS-like") on a Retroid Pocket 6. Having Claude comb through proton logs also indicated the issue was rooted in Themida, but it's interesting to know that it seems to not be a FEX issue. I wonder if there's any conceivable way to get the bootstrapper to pass this point on an ARM system?
@SirCanucklehead Good to have a second data point, and a useful one — same handheld, completely different OS/stack, same wall. That makes it three independent environments now (proton-arm64ec + FEX on Android, Box64 + wine 10 on Android, and your Proton stack on ArmadaOS).
First, a correction to my previous comment, because I'd rather you didn't chase the theory I put in it. I suggested the Themida VM might be detecting a non-native environment and bailing out. I now think that's wrong, on two pieces of evidence:
- The same Themida-packed
plutonium-bootstrapper-win32.exeruns World at War (T4) perfectly on the same device, same container, same translator. Packer anti-debug/anti-VM checks run at startup — if it were refusing emulated environments it would refuse before any game logic, not 40s into zone loading. - If the zone handed to that routine doesn't require the decrypt step, the bootstrapper sails straight past and gets all the way to renderer init (
FS_Startup, config exec, dxvk threads up).
So the environment isn't being rejected. One specific virtualised routine produces no output — it returns with the destination buffer left byte-for-byte identical to the source, then zlib is handed still-encrypted bytes and fails. The rest of the engine translates fine.
I wonder if there's any conceivable way to get the bootstrapper to pass this point on an ARM system?
Not one I've found, and I've spent a while on it. Ruled out on my side:
- FEX: TSO variants,
Multiblock,SMCChecks1/2/3,O0,HideHypervisorBit,X87ReducedPrecision; four builds spanning ~20 months - Box64: default tuning, max-compatibility tuning, and
BOX64_DYNAREC=0(pure interpreter, no JIT at all) - Containers: proton11.0-arm64x, proton9.0-arm64x, proton9.0-x64
Every dynarec configuration spins; the interpreter exits. No setting moves it.
The one thing worth knowing before you try the obvious workaround — running the game without Plutonium — is that that doesn't work either, and it fails much earlier. BO2's own retail executables carry a code virtualizer independent of Plutonium. Section layout of retail mp.exe:
.interpr RX 0x662c bytes (identical blob across T6 binaries — a stock VM engine)
.conceal RX entropy 7.89 (maximum — encrypted virtualised code)
Entry point is in .text, so that VM runs during startup. On my device retail mp.exe exits ~2s in, before the engine writes a single log line, while a non-virtualised control binary in the same container keeps running indefinitely. World at War's executables have no such sections — .text .rdata .data .tls .rsrc only — which is exactly why T4 works and T6 doesn't, at both layers.
So BO2 is virtualised twice over: Treyarch's VM in the game binaries, and Themida in Plutonium's bootstrapper. Both fail under x86→ARM translation, and that's the common thread rather than anything specific to FEX or Box64.
Separately, the hang is Plutonium's own bug and is platform-independent: when inflate() fails, their error path re-tests a stale register instead of re-reading the result, so any inflate failure becomes an unkillable silent freeze rather than an error naming the zone. That's filed at plutoniummod/issue-tracker#82 — worth a 👍 if you want it fixed, since it also bites Windows users with corrupt or partially-downloaded zones.
Nothing here is actionable for FEX as far as I can tell, so this can still be closed. Happy to run experiments on the device if a maintainer ever wants data on how a Themida-style VM behaves under translation.
Nothing here is actionable for FEX as far as I can tell, so this can still be closed
Will do! Feel free to reopen if necessary