[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-dd7b6847670a84b7bb7c38f8e69b2f12059bca66@git.kernel.org>
Date: Tue, 9 Feb 2016 08:09:54 -0800
From: tip-bot for Matthew Wilcox <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: keescook@...omium.org, tglx@...utronix.de,
linux-kernel@...r.kernel.org, mingo@...nel.org,
luto@...capital.net, peterz@...radead.org, willy@...ux.intel.com,
luto@...nel.org, torvalds@...ux-foundation.org, hpa@...or.com,
akpm@...ux-foundation.org
Subject: [tip:x86/asm] x86/mm: Honour passed pgprot in track_pfn_insert()
and track_pfn_remap()
Commit-ID: dd7b6847670a84b7bb7c38f8e69b2f12059bca66
Gitweb: http://git.kernel.org/tip/dd7b6847670a84b7bb7c38f8e69b2f12059bca66
Author: Matthew Wilcox <willy@...ux.intel.com>
AuthorDate: Mon, 25 Jan 2016 12:25:15 -0500
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Tue, 9 Feb 2016 15:25:36 +0100
x86/mm: Honour passed pgprot in track_pfn_insert() and track_pfn_remap()
track_pfn_insert() overwrites the pgprot that is passed in with a value
based on the VMA's page_prot. This is a problem for people trying to
do clever things with the new vm_insert_pfn_prot() as it will simply
overwrite the passed protection flags. If we use the current value of
the pgprot as the base, then it will behave as people are expecting.
Also fix track_pfn_remap() in the same way.
Signed-off-by: Matthew Wilcox <willy@...ux.intel.com>
Acked-by: Andy Lutomirski <luto@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andy Lutomirski <luto@...capital.net>
Cc: Kees Cook <keescook@...omium.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-mm@...ck.org
Link: http://lkml.kernel.org/r/1453742717-10326-2-git-send-email-matthew.r.wilcox@intel.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
arch/x86/mm/pat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index f4ae536..04e2e71 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -943,7 +943,7 @@ int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
return -EINVAL;
}
- *prot = __pgprot((pgprot_val(vma->vm_page_prot) & (~_PAGE_CACHE_MASK)) |
+ *prot = __pgprot((pgprot_val(*prot) & (~_PAGE_CACHE_MASK)) |
cachemode2protval(pcm));
return 0;
@@ -959,7 +959,7 @@ int track_pfn_insert(struct vm_area_struct *vma, pgprot_t *prot,
/* Set prot based on lookup */
pcm = lookup_memtype(pfn_t_to_phys(pfn));
- *prot = __pgprot((pgprot_val(vma->vm_page_prot) & (~_PAGE_CACHE_MASK)) |
+ *prot = __pgprot((pgprot_val(*prot) & (~_PAGE_CACHE_MASK)) |
cachemode2protval(pcm));
return 0;
Powered by blists - more mailing lists