1 From 9ce14e569bf60237f5962e264e049bda37dcebf2 Mon Sep 17 00:00:00 2001
2 From: Frank Rowand <frank.rowand@am.sony.com>
3 Date: Sat, 1 Oct 2011 18:58:13 -0700
4 Subject: [PATCH 063/366] ARM: Initialize split page table locks for vector
7 Without this patch, ARM can not use SPLIT_PTLOCK_CPUS if
8 PREEMPT_RT_FULL=y because vectors_user_mapping() creates a
9 VM_ALWAYSDUMP mapping of the vector page (address 0xffff0000), but no
10 ptl->lock has been allocated for the page. An attempt to coredump
11 that page will result in a kernel NULL pointer dereference when
12 follow_page() attempts to lock the page.
14 The call tree to the NULL pointer dereference is:
17 get_signal_to_deliver()
23 pte_offset_map_lock() <----- a #define
27 The underlying problem is exposed by mm-shrink-the-page-frame-to-rt-size.patch.
29 Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
30 Cc: Frank <Frank_Rowand@sonyusa.com>
31 Cc: Peter Zijlstra <peterz@infradead.org>
32 Link: http://lkml.kernel.org/r/4E87C535.2030907@am.sony.com
33 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
35 arch/arm/kernel/process.c | 24 ++++++++++++++++++++++++
36 1 file changed, 24 insertions(+)
38 diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
39 index 0017b3e..0b670cf 100644
40 --- a/arch/arm/kernel/process.c
41 +++ b/arch/arm/kernel/process.c
42 @@ -394,6 +394,30 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
47 + * CONFIG_SPLIT_PTLOCK_CPUS results in a page->ptl lock. If the lock is not
48 + * initialized by pgtable_page_ctor() then a coredump of the vector page will
51 +static int __init vectors_user_mapping_init_page(void)
54 + unsigned long addr = 0xffff0000;
59 + pgd = pgd_offset_k(addr);
60 + pud = pud_offset(pgd, addr);
61 + pmd = pmd_offset(pud, addr);
62 + page = pmd_page(*(pmd));
64 + pgtable_page_ctor(page);
68 +late_initcall(vectors_user_mapping_init_page);
70 #ifdef CONFIG_KUSER_HELPERS
72 * The vectors page is always readable from user space for the