From patchwork Thu Dec 5 15:14:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jon Medhurst (Tixy)" X-Patchwork-Id: 3288921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A713E9F37A for ; Thu, 5 Dec 2013 15:16:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6D6E204AF for ; Thu, 5 Dec 2013 15:16:47 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 35C7220212 for ; Thu, 5 Dec 2013 15:16:43 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Voaez-00054t-0X; Thu, 05 Dec 2013 15:16:13 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Voaen-0003hL-U3; Thu, 05 Dec 2013 15:16:01 +0000 Received: from smarthost01d.mail.zen.net.uk ([212.23.1.7]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Voaek-0003gB-W1 for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2013 15:15:59 +0000 Received: from [82.69.122.217] (helo=[192.168.2.110]) by smarthost01d.mail.zen.net.uk with esmtpsa (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1VoaeP-000310-26; Thu, 05 Dec 2013 15:15:37 +0000 Message-ID: <1386256471.3525.13.camel@linaro1.home> Subject: Re: [GIT PULL] Cacheflush updates for 3.12 From: "Jon Medhurst (Tixy)" To: Will Deacon Date: Thu, 05 Dec 2013 15:14:31 +0000 In-Reply-To: <1386253407.3525.8.camel@linaro1.home> References: <20130812173155.GI25995@mudshark.cambridge.arm.com> <20131204161329.GA14145@mudshark.cambridge.arm.com> <1386253407.3525.8.camel@linaro1.home> X-Mailer: Evolution 3.4.4-3 Mime-Version: 1.0 X-Originating-smarthost01d-IP: [82.69.122.217] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131205_101559_128122_5FF72C10 X-CRM114-Status: GOOD ( 15.41 ) X-Spam-Score: -1.2 (-) Cc: Christian Gmeiner , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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 Tested-by: Christian Gmeiner --- 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();