If a page is locked in main memory with an mlock()[note 1] system call, is there a practical way to get the physical address of the page in main memory?

The /proc/mem mechanism used to provide the content of physical memory if the process was privileged, but is now disabled by default. As far as I know, the physical address of a logical memory page was not available, except indirectly by spying on the kernel's page tables.

If there is an existing mechanism to get the physical address, it may work for any memory page, but of course is not reliable unless the page is locked.

Note 1: An mmap() call with a locking option will probably work the same.

  • How about using a debugger to get a core dump of the process?
    – Xen2050
    Feb 7, 2019 at 9:22
  • @Xen2050 I'm interested in runnning a memory test program like memtester, and identifying the actual RAM chip address, not the program's (virtual) address. I know there is a kernel table with the virtual-to-physical mapping, but I was hoping there is an existing mechanism for getting it without a new system call. Portability would be nice too, but is likely to be somewhat limited.
    – Bit Chaser
    Feb 7, 2019 at 23:06


You must log in to answer this question.

Browse other questions tagged .