From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7879 invoked by alias); 13 Aug 2012 11:35:28 -0000 Received: (qmail 7741 invoked by uid 22791); 13 Aug 2012 11:35:27 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from casper.infradead.org (HELO casper.infradead.org) (85.118.1.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 13 Aug 2012 11:35:10 +0000 Received: from dhcp-089-099-019-018.chello.nl ([89.99.19.18] helo=twins) by casper.infradead.org with esmtpsa (Exim 4.76 #1 (Red Hat Linux)) id 1T0sv5-0005fk-At; Mon, 13 Aug 2012 11:34:51 +0000 Received: by twins (Postfix, from userid 1000) id 5C736837275B; Mon, 13 Aug 2012 13:34:46 +0200 (CEST) Message-ID: <1344857686.31459.25.camel@twins> Subject: Re: [RFC 5/5] uprobes: add global breakpoints From: Peter Zijlstra To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Arnaldo Carvalho de Melo , Roland McGrath , Oleg Nesterov , Srikar Dronamraju , Ananth N Mavinakaynahalli , stan_shebs@mentor.com, gdb-patches@sourceware.org Date: Mon, 13 Aug 2012 11:35:00 -0000 In-Reply-To: <1344355952-2382-6-git-send-email-bigeasy@linutronix.de> References: <1344355952-2382-1-git-send-email-bigeasy@linutronix.de> <1344355952-2382-6-git-send-email-bigeasy@linutronix.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-08/txt/msg00357.txt.bz2 On Tue, 2012-08-07 at 18:12 +0200, Sebastian Andrzej Siewior wrote: > By setting an uprobe tracepoint, one learns whenever a certain point > within a program is reached / passed. This is recorded and the > application continues. > This patch adds the ability to hold the program once this point has been > passed and the user may attach to the program via ptrace. > First, setup a global breakpoint which is very similar to a uprobe trace > point: >=20 > |echo 'g /home/bigeasy/sample:0x0000044d %ip %ax' > uprobe_events >=20 > This is exactly what uprobe does except that it starts with the letter > 'g' instead of 'p'. >=20 > Step two is to enable it: > |echo 1 > events/uprobes/enable >=20 > Lets assume you execute ./sample and the breakpoint is hit. In ps you will > see: > |1938 pts/1 t+ 0:00 ./sample This seems particularly dangerous.. suppose you tag a frequent function (say malloc) and the entire userspace freezes, including your shell. > Now you can attach gdb via 'gdb -p 1938'. The gdb can now interact with > the tracee and inspect its registers, its stack, single step, let it > run=E2=80=A6 > In case the process is not of great interest, the user may continue > without gdb by writting its pid into the uprobe_gp_wakeup file >=20 > |echo 1938 > uprobe_gp_wakeup >=20 > What I miss right now is an interface to tell the user/gdb that there is a > program that hit a global breakpoint and is waiting for further instructi= ons. > A "tail -f trace" does not work and may contain also a lot of other > informations. I've been thinking about a poll()able file which returns pi= ds of > tasks which are put on hold. Other suggestions?=20 I'm not really happy with any of this. I would suggest limiting this stuff much further, like say only have it affect ptraced processes/tasks. That way you cannot accidentally freeze the entire system into oblivion. GDB (and assorted stuff) can already track an entire process hierarchy with fork follow stuffs.