IntelLabs / kAFL

A fuzzer for full VM kernel/driver targets
https://intellabs.github.io/kAFL/
MIT License
659 stars 92 forks source link

AddVectoredExceptionHandler() + selffuzz_test.c(win-user) unexpected behavior #274

Closed bjloed closed 8 months ago

bjloed commented 8 months ago

Hi. I'm currently testing selffuzz_test.c and the exc_handle function. Currently, panic() has been replaced with (int )1 = 0x41; in the if statement of selffuzz_test.c.

static inline void panic(void){
    hprintf("pid: %d\n", GetCurrentProcessId());
    hprintf("PANIC PANIC PANIC PANIC\n");
    kAFL_hypercall(HYPERCALL_KAFL_PANIC, (uintptr_t)0x1);
    while(1){

    }; /* halt */
}

And if I add exc_handle, the fuzzing result is as follows:

pid: 2068
PANIC PANIC PANIC PANIC
[QEMU-NYX] hypercall called!
00:00:30: Got    9 from    8: exit=C, 10/ 0 bits,  0 favs, 0.65msec, 0.0KB (redq_mutate)
pid: 2068
PANIC PANIC PANIC PANIC
[QEMU-NYX] hypercall called!
pid: 2068
PANIC PANIC PANIC PANIC
[QEMU-NYX] hypercall called!
pid: 2068
PANIC PANIC PANIC PANIC
[QEMU-NYX] hypercall called!
pid: 2068
PANIC PANIC PANIC PANIC
[QEMU-NYX] hypercall called!
pid: 2068
PANIC PANIC PANIC PANIC
[QEMU-NYX] hypercall called!
pid: 2068
PANIC PANIC PANIC PANIC
[QEMU-NYX] hypercall called!
pid: 2068
PANIC PANIC PANIC PANIC
[QEMU-NYX] hypercall called!
pid: 2068
PANIC PANIC PANIC PANIC
[QEMU-NYX] hypercall called!
pid: 2068
PANIC PANIC PANIC PANIC
[QEMU-NYX] hypercall called!
pid: 2068
PANIC PANIC PANIC PANIC
[QEMU-NYX] hypercall called!
pid: 2068
PANIC PANIC PANIC PANIC
[QEMU-NYX] hypercall called!
pid: 2068
PANIC PANIC PANIC PANIC
[QEMU-NYX] hypercall called!

And in kafl gui, only 1 crash appears. Why does this situation repeat itself? Thanks.

Wenzel commented 8 months ago

Hi @bjloed

thanks for opening an issue. I see you already closed it as completed, did you find a solution or workaround ? Was it a bug in kAFL that deserves to be fixed ?

Thanks

bjloed commented 8 months ago

@Wenzel Ah, I solved it because harness was a 32 bit or 64 bit problem. It's not a kAFL code problem. Thanks!