NetBSD Problem Report #58692

From www@netbsd.org  Tue Sep 24 15:38:52 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id CA6501A923B
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 24 Sep 2024 15:38:52 +0000 (UTC)
Message-Id: <20240924153851.3488B1A923D@mollari.NetBSD.org>
Date: Tue, 24 Sep 2024 15:38:51 +0000 (UTC)
From: nmingotti@gmail.com
Reply-To: nmingotti@gmail.com
To: gnats-bugs@NetBSD.org
Subject: opensnoop fails -- dtrace fails printing arg0
X-Send-Pr-Version: www-1.0

>Number:         58692
>Category:       bin
>Synopsis:       opensnoop fails -- dtrace fails printing arg0
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 24 15:40:00 +0000 2024
>Last-Modified:  Wed Sep 25 00:00:02 +0000 2024
>Originator:     Dr. Nicola Mingotti
>Release:        10.0
>Organization:
Borghi SRL
>Environment:
NetBSD netb1.borghi.lan 10.0 NetBSD 10.0 (GENERIC) #0: Thu Mar 28 08:33:33 UTC 2024  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64

>Description:

. /usr/sbin/opensnoop fails giving (as soon as a file is open) a lot of errors

. The problem appears to be related to dtrace printing arg0

>How-To-Repeat:

$> doas /usr/sbin/opensnoop
---------- output --------------
dtrace: error on enabled probe ID 3 (ID 371: syscall::open:return): invalid address (0x7f7fffbd9ee0) in action #10 at DIF offset 12
: No such file or directory
dtrace: error on enabled probe ID 3 (ID 371: syscall::open:return): invalid address (0x7992e579394b) in action #10 at DIF offset 12
: No such file or directory
....
--------------------------------

. I used a bit DTrace  in the past, the problem appears to be related to the print of "arg0". Indeed:
. this works:
$> doas /usr/sbin/dtrace -n 'syscall::open:entry { printf(". open file - %s", execname); } '

. but this fails 
doas /usr/sbin/dtrace -n 'syscall::open:entry { printf("%s %s", execname, copyinstr(arg0)); } ' 
---- output ----------------------
dtrace: error on enabled probe ID 1 (ID 370: syscall::open:entry): invalid address (0x7f7ffffbaeb0) in action #2 at DIF offset 12
: No such file or directory
dtrace: error on enabled probe ID 1 (ID 370: syscall::open:entry): invalid address (0x7f7ffffba5e0) in action #2 at DIF offset 12
: No such file or directory
...
-----------------------------------






>Fix:

>Audit-Trail:
From: RVP <rvp@SDF.ORG>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/58692: opensnoop fails -- dtrace fails printing arg0
Date: Tue, 24 Sep 2024 23:59:07 +0000 (UTC)

 On Tue, 24 Sep 2024, nmingotti@gmail.com wrote:

 >> Description:
 >
 > . /usr/sbin/opensnoop fails giving (as soon as a file is open) a lot of errors
 >
 > . The problem appears to be related to dtrace printing arg0
 >
 >> How-To-Repeat:
 >
 > $> doas /usr/sbin/opensnoop
 > ---------- output --------------
 > dtrace: error on enabled probe ID 3 (ID 371: syscall::open:return): invalid address (0x7f7fffbd9ee0) in action #10 at DIF offset 12
 > : No such file or directory
 > dtrace: error on enabled probe ID 3 (ID 371: syscall::open:return): invalid address (0x7992e579394b) in action #10 at DIF offset 12
 > : No such file or directory
 > ....
 > --------------------------------
 >
 > . I used a bit DTrace  in the past, the problem appears to be related to the print of "arg0". Indeed:
 > . this works:
 > $> doas /usr/sbin/dtrace -n 'syscall::open:entry { printf(". open file - %s", execname); } '
 >
 > . but this fails
 > doas /usr/sbin/dtrace -n 'syscall::open:entry { printf("%s %s", execname, copyinstr(arg0)); } '
 > ---- output ----------------------
 > dtrace: error on enabled probe ID 1 (ID 370: syscall::open:entry): invalid address (0x7f7ffffbaeb0) in action #2 at DIF offset 12
 > : No such file or directory
 > dtrace: error on enabled probe ID 1 (ID 370: syscall::open:entry): invalid address (0x7f7ffffba5e0) in action #2 at DIF offset 12
 > : No such file or directory
 > ...
 > -----------------------------------
 >

 This was fixed in -HEAD last year, and I had thought it had been pulled up
 to 10.0:

 https://github.com/NetBSD/src/commit/feabd72f0cb81bd667c516878fdcc23c4f5dd736

 but, evidently not. Please request it.

 -RVP

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.