62 size_t lenProt = (size_t)addr - (
size_t)(pageAddr) + objSize;
63 size_t nextProt = (size_t)addr + objSize;
65 int pageProt(PROT_NONE);
66 if (e->readable) pageProt |= PROT_READ;
67 if (e->writable) pageProt |= PROT_WRITE;
68 if (e->executable) pageProt |= PROT_EXEC;
69 if (pageProt != prot) {
99 if (0 == (
rc = mprotect( pageAddr_nc,
105 printf(
"PageAccessControl::protectPage DEBUG: set protection %i for page range %p - 0x%lx containing address range=%p - 0x%lx\n",
108 (
long unsigned int)(nextUnprot - 1),
110 (
long unsigned int)(nextProt -1) );
114 }
else printf(
"PageAccessControl::protectPage WARNING: no entry in procmap for addr=%p, page protection not restored \n",addr);
const void * page_address(const void *addr)
void * next_page_address(void *addr)
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)
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,...
protected_t::const_iterator const_iterator
const_iterator endProtectedPtrs() const
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)