From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751053AbdGZSZy (ORCPT ); Wed, 26 Jul 2017 14:25:54 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:42538 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750867AbdGZSZx (ORCPT ); Wed, 26 Jul 2017 14:25:53 -0400 Date: Wed, 26 Jul 2017 19:25:34 +0100 From: Russell King - ARM Linux To: Thomas Garnier Cc: Will Deacon , Leonard Crestez , Thomas Gleixner , Catalin Marinas , Dave Martin , Chris Metcalf , Pratyush Anand , linux-arm-kernel@lists.infradead.org, LKML , Kernel Hardening Subject: Re: [PATCH 1/3] arm/syscalls: Move address limit check in loop Message-ID: <20170726182534.GQ31807@n2100.armlinux.org.uk> References: <20170719175900.124074-1-thgarnie@google.com> <1500978481.30745.10.camel@nxp.com> <20170725103828.GJ31807@n2100.armlinux.org.uk> <20170726120208.GB2115@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 26, 2017 at 07:20:22AM -0700, Thomas Garnier wrote: > On Wed, Jul 26, 2017 at 5:02 AM, Will Deacon wrote: > > I looked to see what you've done for x86, but it looks like you check/clear > > the flag before the work pending loop (exit_to_usermode_loop), which > > subsequently re-enables interrupts and exits when > > EXIT_TO_USERMODE_LOOP_FLAGS are all clear. Since TIF_FSCHECK isn't included > > in those flags, what stops it being set again by an irq and remaining set > > for the return to userspace? > > Nothing, I plan to improve the x86 logic later. I focused on ARM/ARM64 > right now based on Leonard report. Hmm. In this case, I'd suggest concentrating on x86 and getting the implementation correct there before porting it to other architectures. If x86 were to check TIF_FSCHECK in the loop, and repeat until clear, would x86 also end up in these infinite loops that have been reported on ARM as well? I strongly suggest testing the behaviour with kprobes/tracing enabled for a function called from the work pending loop, and checking how that behaves. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.