public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* mprotect() resets caching policy
@ 2006-01-27 12:26 Thomas Hellström
  2006-02-02 16:51 ` Hugh Dickins
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Hellström @ 2006-01-27 12:26 UTC (permalink / raw)
  To: linux-kernel

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-02-02 18:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-27 12:26 mprotect() resets caching policy Thomas Hellström
2006-02-02 16:51 ` Hugh Dickins
2006-02-02 18:03   ` Thomas Hellström

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox