7#ifndef CXXUTILS_PAGEACCESSCONTROL_H
8#define CXXUTILS_PAGEACCESSCONTROL_H 1
70 bool protectPage(
const void* addr,
size_t objSize,
int prot);
77 Entry(
const void*
a,
size_t l,
int p,
void* pl);
99 bool accessed(
const void* address)
const;
bool operator<(const PageAccessControl::Entry &lhs, const PageAccessControl::Entry &rhs)
FIXME Access to the underlying protect/restore page access.
bool forbidPage(const void *addr)
FIXME this will not work well for objects spanning across pages.
procmaps m_pmaps
the content of /proc/self/maps
bool accessed(const void *address) const
was the page containing address accessed?
bool restorePageProt(const void *addr)
bool forbidPage(const T *addr)
forbid access to the page containing addr, setting its prot to PROT_NONE
PageAccessControl(size_t reservedSize=65535)
const_iterator beginProtectedPtrs() const
bool protectPage(T *addr, int prot)
protect the page containing addr, record the amount of memory we protected NOTE To avoid SEGV,...
PageAccessControl(procmaps &pmaps, size_t reservedSize=65535)
std::vector< Entry > protected_t
the list of protected pages
bool forbidPage(const void *addr, size_t objSize)
forbid access to the page containing addr, setting its prot to PROT_NONE
protected_t::const_iterator const_iterator
const protected_t & protectedPtrs() const
const_iterator endProtectedPtrs() const
On stopMonitoring/finalize the handler is uninstalled.
protection of a memory region (see mprotect(2))
void * leak
pointer to the heap fragment we leaked before protecting the page
size_t lenProt
length of the protected region, from page addr to end of protected obj
const void * addr
address of page for which protection was requested. Used as key
Entry(const void *a, size_t l, int p, void *pl)