From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 24 18:33:57 2013 Return-Path: Delivered-To: hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 5BA925EA for ; Wed, 24 Jul 2013 18:33:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id A35662449 for ; Wed, 24 Jul 2013 18:33:56 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id VAA25370; Wed, 24 Jul 2013 21:33:46 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1V23sg-0008mY-2y; Wed, 24 Jul 2013 21:33:46 +0300 Message-ID: <51F01DD2.6060308@FreeBSD.org> Date: Wed, 24 Jul 2013 21:32:50 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130708 Thunderbird/17.0.7 MIME-Version: 1.0 To: Yuri Subject: Re: DTrace copyin with struct doesn't work? References: <51F01940.2020402@rawbw.com> In-Reply-To: <51F01940.2020402@rawbw.com> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: FreeBSD Hackers 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: Wed, 24 Jul 2013 18:33:57 -0000 on 24/07/2013 21:13 Yuri said the following: > This simple .d script fails: > > ---script begin--- > #!/usr/sbin/dtrace -s > > struct my_args { > int ii; > }; > > fbt::sys_select:entry > { > printf("sys_select %i", ((struct my_args*)copyin(arg1, sizeof (struct > my_args)))->ii); > } > ---script end--- > > dtrace: error on enabled probe ID 1 (ID 33598: fbt:kernel:sys_select:entry): > invalid address (0xffffff82ff0799d8) in action #1 at DIF offset 40 > dtrace: error on enabled probe ID 1 (ID 33598: fbt:kernel:sys_select:entry): > invalid address (0xffffff82fefb19d8) in action #1 at DIF offset 40 > > Function sys_select is defined in kern/sys_generic.c: > int > sys_select(struct thread *td, struct select_args *uap) >From sys_select code it is clear that uap points to something that is already copied in. Unlike some fields within select_args. > arg1 in DTrace script should correspond to uap argument of sys_select, and > dereferencing should always produce an int. -- Andriy Gapon