From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753479AbbEHLbY (ORCPT ); Fri, 8 May 2015 07:31:24 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:47483 "EHLO e28smtp02.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752662AbbEHLbV (ORCPT ); Fri, 8 May 2015 07:31:21 -0400 Date: Fri, 8 May 2015 17:00:58 +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, Benjamin Herrenschmidt Subject: Re: [PATCH 07/10] uprobes/x86: Introduce arch_uretprobe_is_alive() Message-ID: <20150508113058.GA5757@linux.vnet.ibm.com> Reply-To: Srikar Dronamraju References: <20150504124835.GA22462@redhat.com> <20150504124914.GA22512@redhat.com> <20150507110852.GF30396@linux.vnet.ibm.com> <20150507171119.GC18652@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20150507171119.GC18652@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15050811-0005-0000-0000-0000052C7F42 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > Yes, and we can do this without changing arch_uretprobe_hijack_return_addr() > interface (which imo should be changed anyway, but this is off-topic). > > > and handle_trampoline() would call something like > > > > arch_uretprobe_is_alive(next->sp, regs); > > > > bool __weak arch_uretprobe_is_alive(unsigned long sp, struct pt_regs *regs) > > { > > return user_stack_pointer(regs) <= sp; > > } > > The problem is, I simply do not know if this is right on !x86. > > And. I wanted to ensure that if (say) arch/ppc needs something else to > save/check in hijack/alive, then this architecture can just add the new > members in arch_uretprobe and change the arch_ helpers. > The above weak function should work with ppc. Infact I see only 2 arch that define CONFIG_STACK_GROWSUP (metag and parisc) and both don't seem to have uprobes support for now. And even if they get uprobes support, then supporting arch that define CONFIG_STACK_GROWSUP within the weak function should be easy. Also the archs can also overload this function. (In which case we could even drop the weak notation for now). We even seem to use this assumption when kprobe_tracer/uprobe_tracer fetch arguments from stack. See fetch_kernel_stack_address() / fetch_user_stack_address() and get_user_stack_nth(). -- Thanks and Regards Srikar Dronamraju