https://bugs.kde.org/show_bug.cgi?id=514297

--- Comment #13 from Mark Wielaard <[email protected]> ---
(In reply to mcermak from comment #8)
> Created attachment 190007 [details]
> try to use mincore() instead of /proc/pid/pagemap
> 
> Hello Mark, thank-you for your comments!  I see that access to
> /proc/pid/pagemap is gated via PTRACE_MODE_READ_FSCREDS.  Looking for
> alternative ways to detect a guard page, independent of reading
> /proc/pid/pagemap:
> 
> Seems like rv = mincore(page_start_aligned, page_size, &vec) could help?  In
> case (rv == 0 && vec == 0)  (It is a valid address, but page not resident in
> RAM), that seems to match the /proc/pid/pagemap info for my testcase.  The
> second arg can even get automatically rounded up to the page size, which
> saves the sysconf(_SC_PAGESIZE) call.  But it may probably misbehave with
> swapped off pages.  Thoughts?

Interesting. Maybe mincore be used as fallback. But like you say it would have
the issue
of false positives on swapped out pages. Lets for now assume we can access
/proc/self/pagemap. If we cannot then maybe just don't allow madvise
MADV_GUARD_INSTALL as we do now.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to