Skip to contentSkip to conversation

Critical ARC Fix for 3.12

PATCH In review Vineet Gupta 3 participants 5 messages Nov 2, 2013 – Nov 9, 2013

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 1/1 ARC: Incorrect mm reference used in vmalloc fault handler

In reply to Vineet Gupta

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 20bafb3d23d108bc "n_tty: Move buffers into n_tty_data"

Cc Gilad Ben-Yossef <[email protected]>
Cc Noam Camus <[email protected]>
Cc [email protected] #3.10 and 3.11
Cc Peter Hurley <[email protected]>
---
 arch/arc/mm/fault.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arc/mm/fault.c +3 -3
index 81554ded1260..9c69552350c4 100644
@@ -17,7 +17,7 @@
 #include <asm/pgalloc.h>
 #include <asm/mmu.h>
 
-static int handle_vmalloc_fault(struct mm_struct *mm, unsigned long address)
+static int handle_vmalloc_fault(unsigned long address)
 {
 	/*
 	 * Synchronize this task's top level page-table
@@ -27,7 +27,7 @@ static int handle_vmalloc_fault(struct mm_struct *mm, unsigned long address)
 	pud_t *pud, *pud_k;
 	pmd_t *pmd, *pmd_k;
 
-	pgd = pgd_offset_fast(mm, address);
+	pgd = pgd_offset_fast(current->active_mm, address);
 	pgd_k = pgd_offset_k(address);
 
 	if (!pgd_present(*pgd_k))
@@ -72,7 +72,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)
 	 * nothing more.
 	 */
 	if (address >= VMALLOC_START && address <= VMALLOC_END) {
-		ret = handle_vmalloc_fault(mm, address);
+		ret = handle_vmalloc_fault(address);
 		if (unlikely(ret))
 			goto bad_area_nosemaphore;
 		else
Signature · 1 line
1.8.1.2
#0 lore raw

PATCH 1/1 Critical ARC Fix for 3.12

Hi Linus,

Sorry for this extemely late patch for 3.12 but it causes a SMP build of ARC to panic in boot.

Greg, the patch as it is doesn't apply to 3.10 (but does to 3.11). So can you please queue it up for 3.11 and I'll send a fixup for 3.10.

Thx,
-Vineet

Vineet Gupta (1):
ARC: Incorrect mm reference used in vmalloc fault handler

 arch/arc/mm/fault.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.1.2
#2 lore raw

Added CC stable, so Greg will see it.
Added commit 9c41f4eeb9d51f3ece20428d35a3ea32cf3b5622, so Greg knows what to cherry-pick.

Quoted 12 lines · Vineet Gupta

Hi Linus,

Sorry for this extemely late patch for 3.12 but it causes a SMP build of ARC to panic in boot.

Greg, the patch as it is doesn't apply to 3.10 (but does to 3.11). So can you please queue it up for 3.11 and I'll send a fixup for 3.10.

Thx,
-Vineet

Quoted 5 lines

Vineet Gupta (1):
ARC: Incorrect mm reference used in vmalloc fault handler

 arch/arc/mm/fault.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw
Quoted 3 lines · Geert Uytterhoeven

Added CC stable, so Greg will see it.
Added commit 9c41f4eeb9d51f3ece20428d35a3ea32cf3b5622, so Greg knows what to cherry-pick.

Thanks Geert. While cover-letter was not, the patch itself was CC'ed to stable - this cover letter, with PATCH prefix has caused enough confusion already :-(

Greg, I have verified that patch builds fine with 3.10 and 3.11. Please take it.

-Vineet

maintainer
#4 lore raw
In reply to Geert Uytterhoeven
Quoted 3 lines · Geert Uytterhoeven

Added CC stable, so Greg will see it.
Added commit 9c41f4eeb9d51f3ece20428d35a3ea32cf3b5622, so Greg knows what to cherry-pick.

It was already tagged with a cc: stable marking, so all is good.

thanks,

greg k-h