From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755157AbbEGKj6 (ORCPT ); Thu, 7 May 2015 06:39:58 -0400 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:34340 "EHLO e23smtp09.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755132AbbEGKj4 (ORCPT ); Thu, 7 May 2015 06:39:56 -0400 Date: Thu, 7 May 2015 16:08:49 +0530 From: Srikar Dronamraju To: Oleg Nesterov Cc: Ananth N Mavinakayanahalli , Anton Arapov , David Long , Denys Vlasenko , "Frank Ch. Eigler" , Ingo Molnar , Jan Willeke , Jim Keniston , Mark Wielaard , Pratyush Anand , linux-kernel@vger.kernel.org Subject: Re: [PATCH 08/10] uprobes: Change handle_trampoline() to flush the frames invalidated by longjmp() Message-ID: <20150507103849.GE30396@linux.vnet.ibm.com> Reply-To: Srikar Dronamraju References: <20150504124835.GA22462@redhat.com> <20150504124918.GA22519@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20150504124918.GA22519@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15050710-0033-0000-0000-00000172C06B Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Oleg Nesterov [2015-05-04 14:49:18]: > > fails if you probe func_1() and func_2() because handle_trampoline() > assumes that the probed function should must return and hit the bp > installed be prepare_uretprobe(). But in this case func_2() does not > return, so when func_1() returns the kernel uses the no longer valid > return_instance of func_2(). > > Change handle_trampoline() to unwind ->return_instances until we know > that the next chain is alive or NULL, this ensures that the current > chain is the last we need to report and free. > > Alternatively, every return_instance could use unique trampoline_vaddr, > in this case we could use it as a key. And this could solve the problem > with sigaltstack() automatically. > > But this approach needs more changes, and it puts the "hard" limit on > MAX_URETPROBE_DEPTH. Plus it can not solve another problem partially > fixed by the next patch. > > Note: this change has no effect on !x86, the arch-agnostic version of > arch_uretprobe_is_alive() just returns "true". > > TODO: as documented by the previous change, arch_uretprobe_is_alive() > can be fooled by sigaltstack/etc. > > Signed-off-by: Oleg Nesterov > --- Looks good to me. Acked-by: Srikar Dronamraju -- Thanks and Regards Srikar Dronamraju