Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756239AbcKVTh3 (ORCPT ); Tue, 22 Nov 2016 14:37:29 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:47761 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755448AbcKVTh2 (ORCPT ); Tue, 22 Nov 2016 14:37:28 -0500 Date: Tue, 22 Nov 2016 20:37:20 +0100 From: Peter Zijlstra To: Andy Lutomirski Cc: Linus Torvalds , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , "linux-kernel@vger.kernel.org" Subject: Re: [RFC][PATCH] x86: Verify access_ok() context Message-ID: <20161122193720.GA3045@worktop.programming.kicks-ass.net> References: <20161122095715.GN3092@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 865 Lines: 20 On Tue, Nov 22, 2016 at 09:28:01AM -0800, Andy Lutomirski wrote: > On Tue, Nov 22, 2016 at 1:57 AM, Peter Zijlstra wrote: > > +#define access_ok(type, addr, size) \ > > +({ \ > > + WARN_ON_ONCE(!in_task()); \ > > Should this be guarded by some debug option? This may hurt > performance on production systems quite a bit. I suspected something like that; any suitable CONFIG come to mind? I'm somewhat reluctant to create yet another one for this. CONFIG_DEBUG_VM seems somehow inappropriate. > For what it's worth, I think ARM recently started saving the address > limit and resetting it to USER_DS on NMI entry. Up to them of course, but doing less on interrupt entry/exit seems better.