Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashing PANDA for 64-bit Windows guests when using -icount #1506

Open
meatballmaestro opened this issue Jun 27, 2024 · 2 comments
Open

Crashing PANDA for 64-bit Windows guests when using -icount #1506

meatballmaestro opened this issue Jun 27, 2024 · 2 comments

Comments

@meatballmaestro
Copy link

When running PANDA using the -icount option, with any shift value whatsoever, I get the emulator eventually terminating with the message "Raised interrupt while not in I/O function" while working with 64-bit Windows images (Windows 7 and 10). This behavior does not arise with the version of QEMU that I have on hand (version 4.2.1).

I tracked this down to the following in translate-common.c, beginning at line 48 [1].

        if (!cpu->can_do_io
            && (mask & ~old_mask) != 0) {
            cpu_abort(cpu, "Raised interrupt while not in I/O function");
        }

Rather than go to the trouble of modifying PANDA's source and rebuilding on an isolated machine, I just found the code in libpanda-x86_64.so corresponding to the offending lines and nopped it out. The patched result runs reliably so far.

[1]

if (!cpu->can_do_io

@lacraig2
Copy link
Member

Can you elaborate on the reasoning for using -icount?

I don't quite see how these are related, but I think it's possible we could give you an alternative that doesn't conflict with something built for PANDA.

@meatballmaestro
Copy link
Author

meatballmaestro commented Jun 27, 2024

Because marking the time is a venerable basis for anti-debugging. Without the -icount usage,

rdtsc
mov ebx, eax
rdtsc
sub eax, ebx

produces a noticeably higher value in eax, such as 166, versus the 2 I get when I use

-icount shift=0,align=off,sleep=off -rtc clock=vm

That difference is more than sufficient for the simplest time-based anti-debugging checks to trigger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants