From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 25 20:23:00 2013 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8AB71D98 for ; Fri, 25 Jan 2013 20:23:00 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from shell0.rawbw.com (shell0.rawbw.com [198.144.192.45]) by mx1.freebsd.org (Postfix) with ESMTP id 699C8774 for ; Fri, 25 Jan 2013 20:23:00 +0000 (UTC) Received: from eagle.yuri.org (stunnel@localhost [127.0.0.1]) (authenticated bits=0) by shell0.rawbw.com (8.14.4/8.14.4) with ESMTP id r0PKMo36005811 for ; Fri, 25 Jan 2013 12:22:51 -0800 (PST) (envelope-from yuri@rawbw.com) Message-ID: <5102E99A.2070402@rawbw.com> Date: Fri, 25 Jan 2013 12:22:50 -0800 From: Yuri User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130112 Thunderbird/17.0.2 MIME-Version: 1.0 To: FreeBSD Hackers Subject: Calling ustack(); from DTrace script crashes the user process Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 20:23:00 -0000 I am calling ustack(); from the 'ioctl' handler called by Xorg process. My intention is to see the user stack. On the first few instances I got this error: dtrace: ERROR: open failed: No such file or directory -- no file name is mentioned, double-space is printed in the message After a while the same exact script began to crash Xorg process. Before crashes occurred I was able to get the truss log, showing that multiple dev-files failed to open: 5191: open("/dev/dtrace/dtrace",O_RDONLY,00) = 3 (0x3) 5191: open("/dev/dtrace/io",O_RDONLY,00) ERR#2 'No such file or directory' 5191: open("/dev/dtrace/dtmalloc",O_RDONLY,00) = 4 (0x4) 5191: open("/dev/dtrace/nfscl",O_RDONLY,00) ERR#2 'No such file or directory' 5191: open("/dev/dtrace/nfsclient",O_RDONLY,00) ERR#2 'No such file or directory' 5191: open("/dev/dtrace/fbt",O_RDONLY,00) = 5 (0x5) 5191: open("/dev/dtrace/lockstat",O_RDONLY,00) = 6 (0x6) 5191: open("/dev/dtrace/priv",O_RDONLY,00) ERR#2 'No such file or directory' 5191: open("/dev/dtrace/sched",O_RDONLY,00) ERR#2 'No such file or directory' 5191: open("/dev/dtrace/mac",O_RDONLY,00) ERR#2 'No such file or directory' 5191: open("/dev/dtrace/mac_framework",O_RDONLY,00) ERR#2 'No such file or directory' 5191: open("/dev/dtrace/cbb",O_RDONLY,00) ERR#2 'No such file or directory' 5191: open("/dev/dtrace/sctp",O_RDONLY,00) ERR#2 'No such file or directory' 5191: open("/dev/dtrace/callout_execute",O_RDONLY,00) ERR#2 'No such file or directory' 5191: open("/dev/dtrace/vfs",O_RDONLY,00) ERR#2 'No such file or directory' 5191: open("/dev/dtrace/proc",O_RDONLY,00) ERR#2 'No such file or directory' 5191: open("/dev/dtrace/syscall",O_RDONLY,00) ERR#2 'No such file or directory' 5191: open("/dev/dtrace/syscall",O_RDONLY,00) ERR#2 'No such file or directory' I satisfied all conditions mentioned in https://wiki.freebsd.org/DTrace on how to run DTrace on 9.0 (I am on 9.1-STABLE). kernel modules are loaded, see below. So: * Why/How ustack kills the user process? (amazing this is even possible) * Why files like /dev/dtrace/io don't exist? Maybe some extra-options are required for ustack() to work? If this is the case this should be mentioned in wiki. Yuri # kldstat Id Refs Address Size Name 3 16 0xffffffff81861000 84c0 opensolaris.ko 4 4 0xffffffff8186a000 53a00 linux.ko 10 1 0xffffffff82612000 9e50 linprocfs.ko 12 1 0xffffffff82627000 25b linux_adobe.ko 13 2 0xffffffff82628000 baa dtraceall.ko 14 1 0xffffffff82629000 4eca profile.ko 15 3 0xffffffff8262e000 4005 cyclic.ko 16 12 0xffffffff82633000 23baaf dtrace.ko 17 1 0xffffffff8286f000 fae8 systrace_freebsd32.ko 18 1 0xffffffff8287f000 109a5 systrace.ko 19 1 0xffffffff82890000 45a8 sdt.ko 20 1 0xffffffff82895000 4938 lockstat.ko 21 1 0xffffffff8289a000 be09 fasttrap.ko 22 1 0xffffffff828a6000 65e2 fbt.ko 23 1 0xffffffff828ad000 4ee4 dtnfsclient.ko 24 1 0xffffffff828b2000 1dbeb nfsclient.ko 25 1 0xffffffff828d0000 47da nfs_common.ko 26 1 0xffffffff828d5000 55ec dtnfscl.ko 27 1 0xffffffff828db000 4597 dtmalloc.ko 28 1 0xffffffff828e0000 44fd dtio.ko 29 1 0xffffffff828e5000 2466 dtrace_test.ko