#2367·unicorn

x86 self modifying code regression broken

Author: boborjan2Created Jul 20, 2026Updated Sep 10, 2026

commit 6a790682977d8af4a5fccd2ca57408d38a26260f breaks compatibility with native cpu and previous behavior of unicorn.

I have no shellcode reproduction scenario yet but my regression semantics are quite simple and resembles very much to this:

static uint8_t function_in_data[] = {
    0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
    0xb8, 0x78, 0x56, 0x34, 0x12,   /* mov eax, 0x12345678 */
    0xc3
};
int main(void)
{
    function_in_data[12] = 0x55;
    printf("%08x\n", ((uint32_t (*)())function_in_data)());
}

Also I have not studied the commit in question, I just searched for the commit responsible for the break.