lkml.org 
[lkml]   [2006]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectmprotect() resets caching policy
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




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-01-27 13:28    [W:0.049 / U:0.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site