All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: mm: avoid attempting to flush the gate_vma with VIVT caches
@ 2012-07-16 16:23 Will Deacon
  2012-07-19 12:28 ` Will Deacon
  0 siblings, 1 reply; 14+ messages in thread
From: Will Deacon @ 2012-07-16 16:23 UTC (permalink / raw)
  To: linux-arm-kernel

The vivt_flush_cache_{range,page} functions check that the mm_struct
of the VMA being flushed has been active on the current CPU before
performing the cache maintenance.

The gate_vma has a NULL mm_struct pointer and, as such, will cause a
kernel fault if we try to flush it with the above operations. This
happens during ELF core dumps, which include the gate_vma as it may be
useful for debugging purposes.

This patch adds checks to the VIVT cache flushing functions so that VMAs
with a NULL mm_struct are ignored.

Cc: Uros Bizjak <ubizjak@gmail.com>
Reported-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/include/asm/cacheflush.h |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index 004c1bc..8cf828e 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -215,7 +215,9 @@ static inline void vivt_flush_cache_mm(struct mm_struct *mm)
 static inline void
 vivt_flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
 {
-	if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm)))
+	struct mm_struct *mm = vma->vm_mm;
+
+	if (mm && cpumask_test_cpu(smp_processor_id(), mm_cpumask(mm)))
 		__cpuc_flush_user_range(start & PAGE_MASK, PAGE_ALIGN(end),
 					vma->vm_flags);
 }
@@ -223,7 +225,9 @@ vivt_flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned
 static inline void
 vivt_flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn)
 {
-	if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm))) {
+	struct mm_struct *mm = vma->vm_mm;
+
+	if (mm && cpumask_test_cpu(smp_processor_id(), mm_cpumask(mm))) {
 		unsigned long addr = user_addr & PAGE_MASK;
 		__cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags);
 	}
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-07-22 16:57 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-16 16:23 [PATCH] ARM: mm: avoid attempting to flush the gate_vma with VIVT caches Will Deacon
2012-07-19 12:28 ` Will Deacon
2012-07-19 13:03   ` Uros Bizjak
2012-07-19 16:37     ` Will Deacon
2012-07-20 20:41   ` Gilles Chanteperdrix
2012-07-21 13:18     ` Gilles Chanteperdrix
2012-07-21 14:35       ` Will Deacon
2012-07-21 14:40         ` Gilles Chanteperdrix
2012-07-21 14:47           ` Gilles Chanteperdrix
2012-07-22 13:03             ` Will Deacon
2012-07-22 13:26               ` Gilles Chanteperdrix
2012-07-22 15:09                 ` Will Deacon
2012-07-22 15:35                   ` Gilles Chanteperdrix
2012-07-22 16:57                   ` Uros Bizjak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.