Skip to content

Commit 7fd1304

Browse files
Frank RowandSebastian Andrzej Siewior
authored andcommitted
ARM: Initialize split page table locks for vector page
Without this patch, ARM can not use SPLIT_PTLOCK_CPUS if PREEMPT_RT_FULL=y because vectors_user_mapping() creates a VM_ALWAYSDUMP mapping of the vector page (address 0xffff0000), but no ptl->lock has been allocated for the page. An attempt to coredump that page will result in a kernel NULL pointer dereference when follow_page() attempts to lock the page. The call tree to the NULL pointer dereference is: do_notify_resume() get_signal_to_deliver() do_coredump() elf_core_dump() get_dump_page() __get_user_pages() follow_page() pte_offset_map_lock() <----- a #define ... rt_spin_lock() The underlying problem is exposed by mm-shrink-the-page-frame-to-rt-size.patch. Signed-off-by: Frank Rowand <[email protected]> Cc: Frank <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
1 parent 2dda1a4 commit 7fd1304

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

arch/arm/kernel/process.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,30 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
324324
}
325325

326326
#ifdef CONFIG_MMU
327+
/*
328+
* CONFIG_SPLIT_PTLOCK_CPUS results in a page->ptl lock. If the lock is not
329+
* initialized by pgtable_page_ctor() then a coredump of the vector page will
330+
* fail.
331+
*/
332+
static int __init vectors_user_mapping_init_page(void)
333+
{
334+
struct page *page;
335+
unsigned long addr = 0xffff0000;
336+
pgd_t *pgd;
337+
pud_t *pud;
338+
pmd_t *pmd;
339+
340+
pgd = pgd_offset_k(addr);
341+
pud = pud_offset(pgd, addr);
342+
pmd = pmd_offset(pud, addr);
343+
page = pmd_page(*(pmd));
344+
345+
pgtable_page_ctor(page);
346+
347+
return 0;
348+
}
349+
late_initcall(vectors_user_mapping_init_page);
350+
327351
#ifdef CONFIG_KUSER_HELPERS
328352
/*
329353
* The vectors page is always readable from user space for the

0 commit comments

Comments
 (0)