Skip to content
This repository was archived by the owner on Jun 9, 2020. It is now read-only.

Failing to run a program due to: reason: eat_violation #81

Open
angerman opened this issue Dec 23, 2018 · 3 comments
Open

Failing to run a program due to: reason: eat_violation #81

angerman opened this issue Dec 23, 2018 · 3 comments

Comments

@angerman
Copy link

So I'm trying to run a haskell program compiled against muslc through noah. Using --output, I see the following repeating forever:

[48232:36034161] reason: ept_violation
[48232:36034161] guest-physical address = 0x7fc0000000
[48232:36034161] exit qualification = 0x83
[48232:36034161] guest linear address = 0x22c039e
[48232:36034161] reason: ept_violation
[48232:36034161] guest-physical address = 0x7fc0000000
[48232:36034161] exit qualification = 0x83
[48232:36034161] guest linear address = 0x22c039e
[48232:36034161] reason: ept_violation
[48232:36034161] guest-physical address = 0x7fc0000000
[48232:36034161] exit qualification = 0x83
[48232:36034161] guest linear address = 0x22c039e
[48232:36034161] reason: ept_violation
[48232:36034161] guest-physical address = 0x7fc0000000
[48232:36034161] exit qualification = 0x83
[48232:36034161] guest linear address = 0x22c039e
[48232:36034161] reason: ept_violation
[48232:36034161] guest-physical address = 0x7fc0000000
[48232:36034161] exit qualification = 0x83
[48232:36034161] guest linear address = 0x22c039e

I don't mind getting into this and fixing it. What am I looking for?

@angerman
Copy link
Author

Looking at the VM EXITS (27-10 Vol. 3C), Table 27-7. Exit Qualification for EPT Violations, we find:
that 0x83 which is

12 11 10  9  8    7  6  5  4  3  2  1  0
 0  0  0  0  0    1  0  0  0  0  0  1  1 

tells us that we have should probably look at note 1, which states:

If accessed and dirty flags for EPT are enabled, processor accesses to guest paging-structure entries are treated as writes with regard to EPT violations (see Section 28.2.3.2). If such an access causes an EPT violation, the processor sets both bit 0 and bit 1 of the exit qualification.

Looking at

noah/src/main.c

Lines 335 to 347 in b61c85c

int verify = 0;
if (qual & (1 << 0)) {
verify = VERIFY_READ;
} else if (qual & (1 << 1)) {
verify = VERIFY_WRITE;
} else if (qual & (1 << 2)) {
verify = VERIFY_EXEC;
}
if (!addr_ok(gladdr, verify)) {
printk("page fault: caused by guest linear address 0x%llx\n", gladdr);
send_signal(getpid(), LINUX_SIGSEGV);
}

it seems as if we assume that either bits 0, 1 or 2 are set. At least one is set and never more than two.

@angerman
Copy link
Author

Upon further investigation I believe this might actually be the right approach, to verify READ, and silently ignore/discard the WRITE flag.

However a comment might be helpful. Also I wonder if one could simply set the dirty flag to off and thus reduce the number of times this code is called.

@roolebo
Copy link

roolebo commented Jul 23, 2019

@angerman What's the status of rflags immediately after VMLAUNCH/VMRESUME?

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

No branches or pull requests

2 participants