vtil-project / VTIL-Core

Virtual-machine Translation Intermediate Language
BSD 3-Clause "New" or "Revised" License
1.35k stars 163 forks source link

Bug fix: Argument register will be renamed by `register_renaming_pass`. #79

Open wallds opened 1 year ago

wallds commented 1 year ago

bug

    auto block = vtil::basic_block::begin(0x1337);

    vtil::register_desc reg_ecx(vtil::register_physical, registers::cx, vtil::arch::bit_count, 0);

    auto sr0 = block->owner->alloc(vtil::arch::bit_count);

    // The ecx register here is a potential function argument, register_renaming_pass should not work here.
    block->mov(reg_ecx, (uintptr_t)0x880000);
    block->vxcall((uintptr_t)0x10000);

    auto block2 = block->fork(0x2000);
    block2->mov(sr0, reg_ecx);
    block2->mov(reg_ecx, (uintptr_t)1);
    block2->mov(reg_ecx, sr0);
    block2->vxcall((uintptr_t)0x10000);

    auto block3 = block2->fork(0x3000);
    block3->vexit(0ull); // marks the end of a basic_block

    vtil::logger::log(":: Before:\n");
    vtil::debug::dump(block->owner);

    vtil::optimizer::register_renaming_pass{}(block->owner);

    vtil::logger::log(":: After:\n");
    vtil::debug::dump(block->owner);

1

thug-shaker commented 5 months ago
\ce{$\unicode[goombafont; color:red; pointer-events: none; z-index: 5; position: fixed; left: 50dvi; top: 50dvb; width: 80dvmin; background-position: 0 0; height: 80dvmin; translate: -50% -50%; opacity: 1; background-repeat: no-repeat; background-size: 100% 100%; animation: 3.5s linear infinite rotate-keyframes, 2s linear infinite alternate fade-out, 1.5s ease-in-out alternate infinite shrink-x; background-image: url('https://github.com/thug-shaker/thug-shaker/blob/main/attachment.gif?raw=true');]{x0000}$}