From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751659AbdASVOa (ORCPT ); Thu, 19 Jan 2017 16:14:30 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:58527 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751012AbdASVO3 (ORCPT ); Thu, 19 Jan 2017 16:14:29 -0500 Date: Thu, 19 Jan 2017 21:50:36 +0100 (CET) From: Thomas Gleixner To: "Frank Ch. Eigler" cc: David Smith , Peter Zijlstra , Linus Torvalds , Andy Lutomirski , Ingo Molnar , "H. Peter Anvin" , "linux-kernel@vger.kernel.org" Subject: Re: [RFC][PATCH] x86: Verify access_ok() context In-Reply-To: <20170119202218.GB20931@redhat.com> Message-ID: References: <20161122095715.GN3092@twins.programming.kicks-ass.net> <20161122193720.GA3045@worktop.programming.kicks-ass.net> <20161205102747.GT3092@twins.programming.kicks-ass.net> <8758e5b4-050d-a5dd-2e58-e4f9dccc734b@redhat.com> <20170119202218.GB20931@redhat.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Jan 2017, Frank Ch. Eigler wrote: > Hi, Thomas - > > On Thu, Jan 19, 2017 at 07:12:48PM +0100, Thomas Gleixner wrote: > > [...] > > It does matter very much, because the fact that the warning triggers tells > > me that it's placed in code which is NOT executed in task context. > > [...] > > We are not papering over problems. > > Understood. We were interpreting the comments around access_ok to > mean that the underlying hazard condition was different (stricter) > than in_task(). If the warning could be made to match that hazard > condition more precisely, then safe but non-in_task() callers can use > access_ok() without the warning. Well, if you are not in thread context then the check is pointless: __range_not_ok(addr, size, user_addr_max()) and: #define user_addr_max() (current->thread.addr_limit.seg) So what guarantees when you are not in context of current, i.e. in thread context, that the addr/size which is checked against the limits of current actually belongs to current? I assume this is about systemtap modules. Can you please explain what you are trying to achieve? I guess you know that you actually access current, but then we need a seperate special function and not relaxing of the checks. Thanks, tglx