diff options
author | Nicolas Pitre <nico@fluxnic.net> | 2010-06-07 16:28:55 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-06-08 14:25:50 -0400 |
commit | 17ebba1fe4da4b5d62782be8743e0e8231812af9 (patch) | |
tree | aef818d66f5dbe04817b88b8d0351035740118ba | |
parent | b394eebdd3d436f1796e53b97799554c5aa77431 (diff) |
ARM: 6165/1: trap overflows on highmem pages from kmap_atomic when debugging
When CONFIG_DEBUG_HIGHMEM is used, the fixmap entry used for a highmem page
by kmap_atomic() is always cleared by kunmap_atomic(). This helps find
bad usages such as dereferences after the unmap, or overflow into the
adjacent fixmap areas.
But this debugging aid is completely bypassed when a kmap for the same
page already exists as the kmap is reused instead. ON VIVT systems we
have no choice but to reuse that kmap due to cache coherency issues,
but on non VIVT systems we should always force the fixmap usage when
debugging is active.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mm/highmem.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c index 77b030f5ec09..086816b205b8 100644 --- a/arch/arm/mm/highmem.c +++ b/arch/arm/mm/highmem.c | |||
@@ -48,7 +48,16 @@ void *kmap_atomic(struct page *page, enum km_type type) | |||
48 | 48 | ||
49 | debug_kmap_atomic(type); | 49 | debug_kmap_atomic(type); |
50 | 50 | ||
51 | kmap = kmap_high_get(page); | 51 | #ifdef CONFIG_DEBUG_HIGHMEM |
52 | /* | ||
53 | * There is no cache coherency issue when non VIVT, so force the | ||
54 | * dedicated kmap usage for better debugging purposes in that case. | ||
55 | */ | ||
56 | if (!cache_is_vivt()) | ||
57 | kmap = NULL; | ||
58 | else | ||
59 | #endif | ||
60 | kmap = kmap_high_get(page); | ||
52 | if (kmap) | 61 | if (kmap) |
53 | return kmap; | 62 | return kmap; |
54 | 63 | ||