project-dune / dune

MIT License
192 stars 61 forks source link

exit due to EPT violation. #18

Open coderkaka opened 6 years ago

coderkaka commented 6 years ago

Hello, I get into trouble with dune. When I have built it , the bench_dune program ran with the error :
exit due to EPT violation.

dmesg output: [12233.353617] vmx: created VCPU (VPID 1) [12233.353625] ept: failed to get user page 7fcd40993000 [12233.353626] vmx: page fault failure GPA: 0x993000, GVA: 0x403054 [12233.353627] vmx: --- Begin VCPU Dump --- [12233.353628] vmx: CPU 2 VPID 1 [12233.353630] vmx: RIP 0x0000000000403054 RFLAGS 0x00010002 [12233.353631] vmx: RAX 0x00000000006daca8 RCX 0x0000000000992bc0 [12233.353632] vmx: RDX 0x0000000000000000 RBX 0x0000000000992bc0 [12233.353633] vmx: RSP 0x00007ffd6f15bd50 RBP 0x0000000000000000 [12233.353634] vmx: RSI 0x0000000000000000 RDI 0x0000000000000000 [12233.353635] vmx: R8 0x0000000000000000 R9 0x0000000000000000 [12233.353636] vmx: R10 0x0000000000000000 R11 0x0000000000000000 [12233.353637] vmx: R12 0x00000000006da0c0 R13 0x00000000ffffffff [12233.353638] vmx: R14 0x0000000000000000 R15 0x0000000000000000 [12233.353639] vmx: FS.base 0x0000000000990880 GS.base 0x0000000000000000 [12233.353640] vmx: Dumping Stack Contents... [12233.353641] vmx: RSP+0 0x0000000000000003 [12233.353642] vmx: RSP+8 0x0000000000992bd0 [12233.353643] vmx: RSP+16 0x0000000000993000 [12233.353644] vmx: RSP+24 0x00000000006da860 [12233.353645] vmx: RSP+32 0x0000000000992cb0 [12233.353646] vmx: RSP+40 0x00000000006da8b8 [12233.353647] vmx: RSP+48 0x0000000000000000 [12233.353648] vmx: RSP+56 0x0000000000000201 [12233.353649] vmx: RSP+64 0x00007fdccf4d8000 [12233.353650] vmx: RSP+72 0x00007fdccf4d8000 [12233.353651] vmx: RSP+80 0x0000000000000000 [12233.353652] vmx: RSP+88 0x0000000000411a70 [12233.353653] vmx: --- End VCPU Dump --- [12233.353654] vmx: stopping VCPU (VPID 1) [12233.353815] vmx: destroying VCPU (VPID 1)

During the debug, I found the error happens once dune is launched . It seems that ept_set_epte function is failed . Dune failed to map GPA address to a HVA address. (ubuntu 14.04 kernel 4.4.0)

int vmx_do_ept_fault(struct vmx_vcpu *vcpu, unsigned long gpa,
                     unsigned long gva, int fault_flags)
{
        int ret;
        unsigned long hva = gpa_to_hva(vcpu, current->mm, gpa);
        int make_write = (fault_flags & VMX_EPT_FAULT_WRITE) ? 1 : 0;

        if (unlikely(hva == ADDR_INVAL)) {
                printk(KERN_ERR "ept: gpa 0x%lx is out of range\n", gpa);
                return -EINVAL;
        }

        pr_debug("ept: GPA: 0x%lx, GVA: 0x%lx, HVA: 0x%lx, flags: %x\n",
                 gpa, gva, hva, fault_flags);

        ret = ept_set_epte(vcpu, make_write, gpa, hva);

        return ret;
}