Skip to content

Commit 9c41f4e

Browse files
Vineet Guptatorvalds
authored andcommitted
ARC: Incorrect mm reference used in vmalloc fault handler
A vmalloc fault needs to sync up PGD/PTE entry from init_mm to current task's "active_mm". ARC vmalloc fault handler however was using mm. A vmalloc fault for non user task context (actually pre-userland, from init thread's open for /dev/console) caused the handler to deref NULL mm (for mm->pgd) The reasons it worked so far is amazing: 1. By default (!SMP), vmalloc fault handler uses a cached value of PGD. In SMP that MMU register is repurposed hence need for mm pointer deref. 2. In pre-3.12 SMP kernel, the problem triggering vmalloc didn't exist in pre-userland code path - it was introduced with commit 20bafb3 "n_tty: Move buffers into n_tty_data" Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Gilad Ben-Yossef <gilad@benyossef.com> Cc: Noam Camus <noamc@ezchip.com> Cc: stable@vger.kernel.org raspberrypi#3.10 and 3.11 Cc: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9581b7d commit 9c41f4e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎arch/arc/mm/fault.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <asm/pgalloc.h>
1818
#include <asm/mmu.h>
1919

20-
static int handle_vmalloc_fault(struct mm_struct *mm, unsigned long address)
20+
static int handle_vmalloc_fault(unsigned long address)
2121
{
2222
/*
2323
* Synchronize this task's top level page-table
@@ -27,7 +27,7 @@ static int handle_vmalloc_fault(struct mm_struct *mm, unsigned long address)
2727
pud_t *pud, *pud_k;
2828
pmd_t *pmd, *pmd_k;
2929

30-
pgd = pgd_offset_fast(mm, address);
30+
pgd = pgd_offset_fast(current->active_mm, address);
3131
pgd_k = pgd_offset_k(address);
3232

3333
if (!pgd_present(*pgd_k))
@@ -72,7 +72,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address)
7272
* nothing more.
7373
*/
7474
if (address >= VMALLOC_START && address <= VMALLOC_END) {
75-
ret = handle_vmalloc_fault(mm, address);
75+
ret = handle_vmalloc_fault(address);
7676
if (unlikely(ret))
7777
goto bad_area_nosemaphore;
7878
else

0 commit comments

Comments
 (0)