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

Assertion error #4

Open
altostratous opened this issue Aug 3, 2021 · 4 comments
Open

Assertion error #4

altostratous opened this issue Aug 3, 2021 · 4 comments

Comments

@altostratous
Copy link

(venv) (base) ali@simon:~/Desktop/Code/trrespass/drama$ sudo make run
sudo obj/tester
tester: src/rev-mc.c:94: uint64_t get_phys_addr(uint64_t): Assertion `entry & (1ULL << 63)' failed.
make: *** [Makefile:58: run] Aborted

I'm compiling x86_64 (default build essentials on my system)
Seems the read value out of /proc/self/pagemap has not the correct bits set. How can I fix the problem.
Little bit of context:

(venv) (base) ali@simon:~/Desktop/Code/trrespass/drama$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
@kevinloughlin
Copy link

I ran into the same issue. I resolved it by switching out the implementation of get_phys_addr() with the implementation of virt_to_phys_user() from this post (where I just used "self" for the pid).

@bygo7
Copy link

bygo7 commented Jun 20, 2022

I ran into the same issue. I resolved it by switching out the implementation of get_phys_addr() with the implementation of virt_to_phys_user() from this post (where I just used "self" for the pid).

@kevinloughlin if sysconf(_SC_PAGE_SIZE) returns 4096, both codes seem to do same works except the virt_to_phys_user() doesn't have the assertion assert(entry & (1ULL << 63));
Does the entire code work well with you?

@bygo7
Copy link

bygo7 commented Jun 20, 2022

For this problem, insert a code that bypasses the assertion assert(entry & (1ULL << 63)); AND allocating the v_addr code at rev_mc if (entry & (1ULL << 63) == 0 and (entry & (1ULL << 62) == 1), which means the physical address of the virtual address is not located at main memory(DRAM). I don't know why this happens considering that we have already allocated the memory through mmap.

@stefan1wan
Copy link

I guess the reason that the physical address of the virtual address in not located at the main memory is due to Lazy binding. Simply access the memory at the begining of get_phys_addr could bypass, like volatile int a = *(int*)v_addr;.

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

4 participants