mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
mprotect: prevent alteration of the PAT bits
There is a defect in mprotect, which lets the user change the page cache type bits by-passing the kernel reserve_memtype and free_memtype wrappers. Fix the problem by not letting mprotect change the PAT bits. Signed-off-by: Venkatesh Pallipadi <[email protected]> Signed-off-by: Suresh Siddha <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Hugh Dickins <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
44c81433e8
commit
1c12c4cf94
2 changed files with 23 additions and 4 deletions
|
|
@ -26,6 +26,13 @@
|
|||
#include <asm/cacheflush.h>
|
||||
#include <asm/tlbflush.h>
|
||||
|
||||
#ifndef pgprot_modify
|
||||
static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
|
||||
{
|
||||
return newprot;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void change_pte_range(struct mm_struct *mm, pmd_t *pmd,
|
||||
unsigned long addr, unsigned long end, pgprot_t newprot,
|
||||
int dirty_accountable)
|
||||
|
|
@ -192,7 +199,9 @@ success:
|
|||
* held in write mode.
|
||||
*/
|
||||
vma->vm_flags = newflags;
|
||||
vma->vm_page_prot = vm_get_page_prot(newflags);
|
||||
vma->vm_page_prot = pgprot_modify(vma->vm_page_prot,
|
||||
vm_get_page_prot(newflags));
|
||||
|
||||
if (vma_wants_writenotify(vma)) {
|
||||
vma->vm_page_prot = vm_get_page_prot(newflags & ~VM_SHARED);
|
||||
dirty_accountable = 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue