[GIT PULL] Cacheflush updates for 3.12

Jon Medhurst (Tixy) tixy at linaro.org
Thu Dec 5 10:14:31 EST 2013


On Thu, 2013-12-05 at 14:23 +0000, Jon Medhurst (Tixy) wrote:
> On Wed, 2013-12-04 at 16:13 +0000, Will Deacon wrote:
> > took another look at that patch and can't see anything obviously wrong
> > with it. 
> 
> If the memory region isn't guaranteed to be page aligned then doesn't it
> flush up to PAGE_SIZE-1 more bytes than requested and so exceed the
> bounds check in do_cache_op? Fixing this as below _appears_ to stop the
> Browser crashes I'm seeing (still doing some more testing)...

Actually, a smaller patch and one which avoids the possibility of
arithmetic owerflow is... 

From: Jon Medhurst <tixy at linaro.org>
Date: Thu, 5 Dec 2013 14:29:24 +0000
Subject: [PATCH] ARM: cacheflush: correctly limit range of memory region
 being flushed

The __do_cache_op function operates with a 'chunk' size of one page
but fails to limit the size of the final chunk so as to not exceed
the specified memory region. Fix this.

Signed-off-by: Jon Medhurst <tixy at linaro.org>
---
 arch/arm/kernel/traps.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index dbf0923..7940241 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -509,9 +509,10 @@ static inline int
 __do_cache_op(unsigned long start, unsigned long end)
 {
 	int ret;
-	unsigned long chunk = PAGE_SIZE;
 
 	do {
+		unsigned long chunk = min(PAGE_SIZE, end - start);
+
 		if (signal_pending(current)) {
 			struct thread_info *ti = current_thread_info();
 
-- 
1.7.10.4





More information about the linux-arm-kernel mailing list