Skip to contentSkip to conversation

fix i386 get_gate_vma oops

PATCH In review Hugh Dickins 2 participants 2 messages Apr 13, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix i386 get_gate_vma oops

Fix oops from i386-make-compat_vdso-runtime-selectable.patch.

Even mingetty at system startup finds it easy to trigger an oops while reading /proc/PID/maps: though it has a good hold on the mm itself, that cannot stop exit_mm() from resetting tsk->mm to NULL.

(It is usually show_map()'s call to get_gate_vma() which oopses, and I expect we could change that to check priv->tail_vma instead; but no matter, even m_start()'s call just after get_task_mm() is racy.)

arch/i386/kernel/sysenter.c +3 -1
@@ -326,8 +326,10 @@ const char *arch_vma_name(struct vm_area
 
 struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
 {
+	struct mm_struct *mm = tsk->mm;
+
 	/* Check to see if this task was created in compat vdso mode */
-	if (tsk->mm->context.vdso == (void *)VDSO_HIGH_BASE)
+	if (mm && mm->context.vdso == (void *)VDSO_HIGH_BASE)
 		return &gate_vma;
 	return NULL;
 }
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Hugh Dickins

Fix oops from i386-make-compat_vdso-runtime-selectable.patch.

Even mingetty at system startup finds it easy to trigger an oops while reading /proc/PID/maps: though it has a good hold on the mm itself, that cannot stop exit_mm() from resetting tsk->mm to NULL.

Quoted 6 lines

(It is usually show_map()'s call to get_gate_vma() which oopses, and I expect we could change that to check priv->tail_vma instead; but no matter, even m_start()'s call just after get_task_mm() is racy.)

Hm, OK.

J