Physical Addresses

The memory access tracing client gathers virtual addresses. On Linux, if the kernel allows user-mode applications access to the /proc/self/pagemap file or the application can be run with root privileges, information to translate virtual addresses to physical addresses may be included in the trace. This can be requested via the -use_physical runtime option (see Simulator Parameters). On older kernels the pagemap file was readable without privileges: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ab676b7d6fbf4b294bf198fb27ade5b0e865c7ce.

When -use_physical is enabled, the regular trace entries remain virtual, with a pair of markers of types dynamorio::drmemtrace::TRACE_MARKER_TYPE_PHYSICAL_ADDRESS and dynamorio::drmemtrace::TRACE_MARKER_TYPE_VIRTUAL_ADDRESS inserted at some prior point for each new page mapping to show the corresponding physical addresses. If translation fails, a dynamorio::drmemtrace::TRACE_MARKER_TYPE_PHYSICAL_ADDRESS_NOT_AVAILABLE is inserted. Limited support for detecting changes in page mappings is provided via the -virt2phys_freq option to periodically clear cached translations.

Each analysis tool must decide whether to use this translation information. The cache and TLB simulators provided are equipped to read these markers and they use the marker data when -use_physical is specified.