From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21410 invoked by alias); 9 Jul 2010 18:12:57 -0000 Received: (qmail 21402 invoked by uid 22791); 9 Jul 2010 18:12:56 -0000 X-SWARE-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SOURCES_REDHAT_COM,SPF_HELO_PASS,TW_BF,TW_XB,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Jul 2010 18:12:47 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o69ICkqJ024042 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 9 Jul 2010 14:12:46 -0400 Received: from [10.36.4.116] (vpn1-4-116.ams2.redhat.com [10.36.4.116]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o69ICjaF016823 for ; Fri, 9 Jul 2010 14:12:45 -0400 Subject: Re: user backtrace from kernel context status From: Mark Wielaard To: systemtap@sources.redhat.com In-Reply-To: <1278525755.4413.39.camel@springer.wildebeest.org> References: <1278525755.4413.39.camel@springer.wildebeest.org> Content-Type: text/plain; charset="UTF-8" Date: Fri, 09 Jul 2010 18:12:00 -0000 Message-ID: <1278699164.16260.63.camel@springer.wildebeest.org> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2010-q3/txt/msg00053.txt.bz2 On Wed, 2010-07-07 at 20:02 +0200, Mark Wielaard wrote: > Some status update on our ability to produce user backtraces from kernel > space context. It is now sometimes possible to get (a partial) user > space backtrace. For those architectures (i686 and x86_64) that use the > dwarf unwinder. There are some limitations though. > > Some examples: > > Syscalls. > > $ stap -d /bin/ls --ldd -e 'probe syscall.getdents > { log(pn()); print_ubacktrace(); }' -c /bin/ls > syscall.getdents > 0x000000384f0a2f65 : __getdents+0x15/0x90 [libc-2.12.so] > 0x000000384f0a2962 : readdir64+0x82/0xdf [libc-2.12.so] > 0x0000000000407f1f : print_dir+0x1df/0x6f0 [ls] > 0x000000000040898d : main+0x55d/0x1900 [ls] > 0x000000384f01ec5d : __libc_start_main+0xfd/0x1d0 [libc-2.12.so] > 0x0000000000402799 : _start+0x29/0x2c [ls] > > This example works for x86_64, but not for i686 because we don't track > the vdso yet (PR10080). This is now fixed and tada (on i686 f13): $ stap -d /bin/ls --ldd -e 'probe syscall.ioctl { log(pn() . ": " . argstr); print_ubacktrace(); }' -c '/bin/ls -d /' / syscall.ioctl: 1, 21505, 0xbff13718 0x00f80416 : __kernel_vsyscall+0x2/0x0 0x0096c710 : tcgetattr+0x30/0xd0 [libc-2.12.so] 0x00966de4 : isatty+0x24/0x40 [libc-2.12.so] 0x08050ba4 : main+0xe4/0x373 [ls] syscall.ioctl: 1, 21523, 0xbff13888 0x00f80416 : __kernel_vsyscall+0x2/0x0 0x0096d1f9 : ioctl+0x19/0x40 [libc-2.12.so] 0x08050d50 : main+0x290/0x373 [ls] Tracking the vdso is sadly also architecture specific. So if you like hacking on non-x86 then take a look at the new vma.c (_stp_vma_match_vdso) function. Cheers, Mark