0

i was reading a page that told:

"My microbenchmark begins by allocating one memory page, then creates two virtual address aliases pointing to it"

First Question. i want to know how can i create two virtual address that pointing to same memory page in linux with c?

again on that page he told that:

"One of the virtual pages (which we’ll call the “setup” pointer) is set to allow access from user mode. The second virtual page (“test” pointer) is set to varying permissions, then used to perform a load."

Second Question. can we change permission bit of a virtual address in virtual page table of my programe? as he did with second pointer.

  • 2
    You are aware that it is talking about kernel mode, not user mode, right? – Eugene Sh. Oct 23 '19 at 15:08
  • @Eugene_Sh i am beginner in linux, so excuse me. but i could not understand why it should be on kernel mode? author did not indicated that. – alireza sadeghpour Oct 23 '19 at 22:08
  • Even in user mode, one can set two virtual addresses to point to the same physical memory. The `shmat` routine and related routines map shared memory segments. A process can map the same shared memory segment to different addresses, and it can request various permissions for it when attaching it or by calling `mprotect`. – Eric Postpischil Oct 24 '19 at 00:29

0 Answers0