Darwin JIT runtime state is reset to prevent cross-invocation corruption.
Darwin's JIT compilation environment now resets necessary states to avoid corruption between compiler invocations.
This change addresses a vulnerability in GCC’s Darwin JIT environment where states expected to be initialized are not reset between compiler runs within the same process. By resetting relevant values and pointers in functions like machopic_finish and finalize_ctors/dtors, it prevents issues that could arise from stale data carrying over.
In Details
The JIT re-invokes the compiler in-process. For Darwin's Mach-O object format generation, certain states (like pointers to output sections or constructor/destructor lists) must be clean for each invocation. This patch ensures these states are reset in functions like machopic_finish, finalize_ctors, finalize_dtors, and darwin_file_start/darwin_file_end to prevent data corruption across JIT runs.