From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751643AbdATIue (ORCPT ); Fri, 20 Jan 2017 03:50:34 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:59730 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751476AbdATIuc (ORCPT ); Fri, 20 Jan 2017 03:50:32 -0500 Date: Fri, 20 Jan 2017 09:50:00 +0100 (CET) From: Thomas Gleixner To: Peter Zijlstra cc: Andy Lutomirski , David Smith , Linus Torvalds , Ingo Molnar , "H. Peter Anvin" , "linux-kernel@vger.kernel.org" , "Frank Ch. Eigler" Subject: Re: [RFC][PATCH] x86: Verify access_ok() context In-Reply-To: <20170120082406.GJ6515@twins.programming.kicks-ass.net> 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> <20170120082406.GJ6515@twins.programming.kicks-ass.net> 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 Fri, 20 Jan 2017, Peter Zijlstra wrote: > On Wed, Jan 18, 2017 at 04:19:47PM -0800, Andy Lutomirski wrote: > > ISTM even with pagefault_disable() in play, using access_ok() from, > > say, interrupt context is dangerous unless you've first checked that > > you're in a task. But I guess that in_task() would still return > > false, e.g. in perf. > > The test was created exactly because perf was using access_ok() > _wrongly_. See commit: ae31fe51a3cc ("perf/x86: Restore TASK_SIZE check > on frame pointer"). If you validate a user space address against current outside the task context, then what guarantees that this user space address belongs to current? Nothing! Sure, there are interrupts like breakpoints, etc. where we exactly know that the address which we are looking at belongs to current, because the code accesses soemthing which belongs exactly to that breakpoint. And in these cases we need a check which is designed specifically for that case. Thanks, tglx