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

Write_virtual_memory function at memory_access.c failed #21

Open
u609 opened this issue Jan 20, 2019 · 2 comments
Open

Write_virtual_memory function at memory_access.c failed #21

u609 opened this issue Jan 20, 2019 · 2 comments

Comments

@u609
Copy link

u609 commented Jan 20, 2019

Hi Sergey and mxmssh ,
Thank you for the great tool & research!

I am trying to do fuzzing of kafl_vuln_test using kAFL but I have a problem. I managed to install everything (qemu, KVM and etc.) according with the guide provided in README.md step by step including installation of vulnerable driver. (Forgive me,mxmmsh)

But I got this error :
FAIL 1 0xxxxxxx;
After debugging, I found that the problem appeared here.
write_virtual_memory function at memory_access.c

    phys_addr = cpu_get_phys_page_attrs_debug(cpu, (address & x86_64_PAGE_MASK), &attrs);

    if (phys_addr == -1){
        printf("FAIL 1 (%lx)!\n", address);
        return false;
    }

Do you have any ideas how to fix that ?

Thank you in advance!

@u609
Copy link
Author

u609 commented Jan 21, 2019

error:
PANIC: ffffffff846870e3
FAIL 1 (ffffffff846870e3)!
Program: abcd0000

@timnewsham
Copy link

This looks like you called the hypercall to set the panic address, and it tried to write over the panic function with the panic handler, and found that it couldn't. It might be due to passing in the wrong address from your agent.

I ran across a problem like this and found that the assembly to generate the hypercall was causing some incorrect values to be passed in the hypercall registers. In my case the fix was to reformulate the hypercall function as:

static inline uint64_t kAFL_hypercall(uint64_t rbx, uint64_t rcx){
uint64_t ret;
register uint64_t rax asm("rax") = HYPERCALL_KAFL_RAX_ID;
asm volatile ("vmcall" : "=r"(ret) : "a"(rax), "b"(rbx), "c"(rcx));
return ret;
}

You should check if that is the real panic address you intended to pass in, and verify that it is correct. If its not the address you passed in, you might need to fix your hypercall function.

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