From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932947Ab1JXPRX (ORCPT ); Mon, 24 Oct 2011 11:17:23 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:48926 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932904Ab1JXPRT (ORCPT ); Mon, 24 Oct 2011 11:17:19 -0400 Date: Mon, 24 Oct 2011 20:46:14 +0530 From: Ananth N Mavinakayanahalli To: Oleg Nesterov Cc: Srikar Dronamraju , Peter Zijlstra , Ingo Molnar , Steven Rostedt , Linux-mm , Arnaldo Carvalho de Melo , Linus Torvalds , Jonathan Corbet , Masami Hiramatsu , Hugh Dickins , Christoph Hellwig , Thomas Gleixner , Andi Kleen , Andrew Morton , Jim Keniston , Roland McGrath , LKML Subject: Re: [PATCH 13/X] uprobes: introduce UTASK_SSTEP_TRAPPED logic Message-ID: <20111024151614.GA6034@in.ibm.com> Reply-To: ananth@in.ibm.com References: <20110920115938.25326.93059.sendpatchset@srdronam.in.ibm.com> <20111015190007.GA30243@redhat.com> <20111019215139.GA16395@redhat.com> <20111019215344.GG16395@redhat.com> <20111022072030.GB24475@in.ibm.com> <20111024144127.GA14975@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111024144127.GA14975@redhat.com> User-Agent: Mutt/1.5.17 (2007-11-01) x-cbid: 11102415-2398-0000-0000-0000014A7D8D Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 24, 2011 at 04:41:27PM +0200, Oleg Nesterov wrote: > On 10/22, Ananth N Mavinakayanahalli wrote: > > > > On Wed, Oct 19, 2011 at 11:53:44PM +0200, Oleg Nesterov wrote: > > > Finally, add UTASK_SSTEP_TRAPPED state/code to handle the case when > > > xol insn itself triggers the signal. > > > > > > In this case we should restart the original insn even if the task is > > > already SIGKILL'ed (say, the coredump should report the correct ip). > > > This is even more important if the task has a handler for SIGSEGV/etc, > > > The _same_ instruction should be repeated again after return from the > > > signal handler, and SSTEP can never finish in this case. > > > > Oleg, > > > > Not sure I understand this completely... > > I hope you do not think I do ;) I think you understand it better than you think you do :-) > > When you say 'correct ip' you mean the original vaddr where we now have > > a uprobe breakpoint and not the xol copy, right? > > Yes, > > > Coredump needs to report the correct ip, but should it also not report > > correctly the instruction that caused the signal? Ergo, shouldn't we > > put the original instruction back at the uprobed vaddr? > > OK, now I see what you mean. I was confused by the "restore the original > instruction before _restart_" suggestion. > > Agreed! it would be nice to "hide" these int3's if we dump the core, but > I think this is a bit off-topic. It makes sense to do this in any case, > even if the core-dumping was triggered by another thread/insn. It makes > sense to remove all int3's, not only at regs->ip location. But how can > we do this? This is nontrivial. I don't think that is a problem.. see below... > And. Even worse. Suppose that you do "gdb probed_application". Now you > see int3's in the disassemble output. What can we do? In this case, nothing. > I think we can do nothing, at least currently. This just reflects the > fact that uprobe connects to inode, not to process/mm/etc. > > What do you think? Thinking further on this, in the normal 'running gdb on a core' case, we won't have this problem, as the binary that we point gdb to, will be a pristine one, without the uprobe int3s, right? Ananth