Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1425425

[PATCH v2 03/13] x86/cpa: Warn if kernel_unmap_pages_in_pgd is used inappropriately

From Andy Lutomirski <luto@kernel.org>
Newsgroups linux.kernel
Subject [PATCH v2 03/13] x86/cpa: Warn if kernel_unmap_pages_in_pgd is used inappropriately
Date 2016-06-17 22:10 +0200
Message-ID <rL8fv-2Ds-17@gated-at.bofh.it> (permalink)
References <rL8fv-2Ds-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


It's currently only used in the EFI code, which is safe AFAICT.
Warn if anyone tries to use it on the normal kernel pgd.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 arch/x86/mm/pageattr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 6a8026918bf6..e9b9c5cedbb8 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -1996,6 +1996,9 @@ out:
 void kernel_unmap_pages_in_pgd(pgd_t *root, unsigned long address,
 			       unsigned numpages)
 {
+	/* Unmapping kernel entries from init_mm's pgd is not allowed. */
+	WARN_ON(root == init_mm.pgd);
+
 	unmap_pgd_range(root, address, address + (numpages << PAGE_SHIFT));
 }
 
-- 
2.5.5

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v2 03/13] x86/cpa: Warn if kernel_unmap_pages_in_pgd is used inappropriately Andy Lutomirski <luto@kernel.org> - 2016-06-17 22:10 +0200
  Re: [PATCH v2 03/13] x86/cpa: Warn if kernel_unmap_pages_in_pgd is  used inappropriately Borislav Petkov <bp@alien8.de> - 2016-06-17 22:40 +0200
    Re: [PATCH v2 03/13] x86/cpa: Warn if kernel_unmap_pages_in_pgd is  used inappropriately Andy Lutomirski <luto@amacapital.net> - 2016-06-18 12:30 +0200
      Re: [PATCH v2 03/13] x86/cpa: Warn if kernel_unmap_pages_in_pgd is  used inappropriately Borislav Petkov <bp@alien8.de> - 2016-06-18 12:40 +0200

csiph-web