From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754793AbcB2LmR (ORCPT ); Mon, 29 Feb 2016 06:42:17 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:51615 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752030AbcB2LmO (ORCPT ); Mon, 29 Feb 2016 06:42:14 -0500 Date: Mon, 29 Feb 2016 12:42:10 +0100 From: Peter Zijlstra To: Oleg Nesterov Cc: Andy Lutomirski , Ingo Molnar , Jiri Olsa , Pratyush Anand , linux-kernel@vger.kernel.org Subject: Re: [PATCH tip/x86/asm] uprobes: __create_xol_area() must nullify xol_mapping.fault Message-ID: <20160229114210.GK6356@twins.programming.kicks-ass.net> References: <20160227221128.GA29565@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160227221128.GA29565@redhat.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 27, 2016 at 11:11:28PM +0100, Oleg Nesterov wrote: > As Jiri pointed out, the recent commit f872f5400cc0 "mm: Add a > vm_special_mapping.fault() method" breaks uprobes. __create_xol_area() > doesn't initialize the new ->fault() method and this obviously leads to > kernel crash when the application tries to execute the probed insn after > bp hit. > > We probably want to add uprobes_special_mapping_fault(), this allows to > turn xol_area->xol_mapping into a single instance of vm_special_mapping. > But we need a simple fix, so lets change __create_xol() to nullify the > new member as Jiri suggests. > > Reported-by: Jiri Olsa > Suggested-by: Jiri Olsa > Signed-off-by: Oleg Nesterov > --- > kernel/events/uprobes.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c > index 0167679..5f6ce93 100644 > --- a/kernel/events/uprobes.c > +++ b/kernel/events/uprobes.c > @@ -1178,6 +1178,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr) > goto free_area; > > area->xol_mapping.name = "[uprobes]"; > + area->xol_mapping.fault = NULL; > area->xol_mapping.pages = area->pages; Would not something like: area->xol_mapping = (struct vm_special_mapping){ .name = "[uprobes]", .pages = area->pages, }; Be a more robust approach? That way, if someone adds more fields, they at least get initialized (to 0). > area->pages[0] = alloc_page(GFP_HIGHUSER); > if (!area->pages[0])