From: "Thomas Hellström" <thomas@tungstengraphics.com>
To: linux-kernel@vger.kernel.org
Subject: mprotect() resets caching policy
Date: Fri, 27 Jan 2006 13:26:14 +0100 [thread overview]
Message-ID: <43DA1166.4040700@tungstengraphics.com> (raw)
Hi!
I'm working on an infrastructure to allow drm clients to flip arbitrary
pages in and out of the AGP aperture (or any similar device). In order
to avoid conflicting mappings for those pages, the caching attribute of
both the kernel mapping and all VMA's is changed when binding / unbinding.
However, I noticed that mprotect() will, when run on a non-cached VMA,
reset the caching policy. The line in mm/mprotect.c causing this problem is
newprot = protection_map[newflags & 0xf];
So a user could potentially run mprotect() and create a conflicting
mapping which presumably is bad for stability on some architectures.
Since mprotect() only deals with rwx protection. I figure replacing the
above with something like
newprot = (vm_page_prot & ~MPROT_MASK) | (protection_map[newflags & 0xf]
& MPROT_MASK)
Where MPROT_MASK is a arch-dependent mask identifying the bits available
to mprotect().
Alternatively, is there a way to disable mprotect() for a VMA?
Finally, is there a chance to get protection_map[] exported to modules?
Any comments would be appreciated. Please CC me since I'm not on the list.
Regards,
Thomas Hellström
next reply other threads:[~2006-01-27 12:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-27 12:26 Thomas Hellström [this message]
2006-02-02 16:51 ` mprotect() resets caching policy Hugh Dickins
2006-02-02 18:03 ` Thomas Hellström
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43DA1166.4040700@tungstengraphics.com \
--to=thomas@tungstengraphics.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox