NetBSD Problem Report #54387
From www@netbsd.org Sat Jul 20 13:10:40 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 992247A173
for <gnats-bugs@gnats.NetBSD.org>; Sat, 20 Jul 2019 13:10:39 +0000 (UTC)
Message-Id: <20190720131038.B5A417A1D2@mollari.NetBSD.org>
Date: Sat, 20 Jul 2019 13:10:38 +0000 (UTC)
From: venture37@geeklan.co.uk
Reply-To: venture37@geeklan.co.uk
To: gnats-bugs@NetBSD.org
Subject: DTrace Kernel module does not autoload on first use with GENERIC kernel
X-Send-Pr-Version: www-1.0
>Number: 54387
>Category: kern
>Synopsis: DTrace Kernel module does not autoload on first use with GENERIC kernel
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jul 20 13:15:00 +0000 2019
>Closed-Date: Mon Aug 05 19:05:45 +0000 2019
>Last-Modified: Mon Aug 05 19:05:45 +0000 2019
>Originator: Sevan Janiyan
>Release: HEAD
>Organization:
>Environment:
NetBSD 8.99.51 (GENERIC) #0: Fri Jul 19 12:14:15 UTC 2019 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/i386/compile/GENERIC i386
>Description:
Attempting to run DTrace results in "WARNING: module error: incompatible module class for `dtrace' (3 != 1)"
Tested on NetBSD/i386 & amd64
One has to modload solaris & modload dtrace
From there, dtrace is able to load subsequent dtrace_* modules
$ modstat |grep dtrace
dtrace misc filesys - 2 - solaris
dtrace_sdt misc filesys a 0 - dtrace
dtrace_syscall misc filesys a 0 - dtrace
>How-To-Repeat:
Try running 'dtruss ls' or "dtrace -n 'BEGIN'"
Dtrace will not work until you have modload solaris; modload dtrace manually.
>Fix:
I suspect the change of the default value of WARNS for modules may be related but I'm not sure if the value should be reduced or this has highlighted a bug a in the module code.
Commit which changed the default WARNS value:
http://mail-index.netbsd.org/source-changes/2019/02/17/msg103560.html
>Release-Note:
>Audit-Trail:
From: "J. Hannken-Illjes" <hannken@eis.cs.tu-bs.de>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/54387: DTrace Kernel module does not autoload on first use
with GENERIC kernel
Date: Sat, 20 Jul 2019 16:20:22 +0200
On Sat, Jul 20, 2019 at 01:15:00PM +0000, venture37@geeklan.co.uk wrote:
,snip>
> I suspect the change of the default value of WARNS for modules may be related but I'm not sure if the value should be reduced or this has highlighted a bug a in the module code.
It was the change to external/cddl/osnet/dist/uts/common/dtrace/dtrace.c,
Rev 1.39: Change module type to "MODULE_CLASS_MISC" to allow preloading.
It should be sufficient to try to load module "dtrace" before we open
the device, please try the diff attached.
--
J. Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig
diff -r 34ade923a39d external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c
--- external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c Sat Jul 20 15:54:37 2019 +0200
+++ external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c Sat Jul 20 16:11:40 2019 +0200
@@ -1140,6 +1140,16 @@ dt_vopen(int version, int flags, int *er
*/
dt_provmod_open(&provmod, &df);
+#ifdef __NetBSD__
+ modctl_load_t cmdargs;
+
+ cmdargs.ml_filename = "dtrace";
+ cmdargs.ml_flags = MODCTL_NO_PROP;
+ cmdargs.ml_props = NULL;
+ cmdargs.ml_propslen = 0;
+
+ (void)modctl(MODCTL_LOAD, &cmdargs);
+#endif
dtfd = open("/dev/dtrace/dtrace", O_RDWR);
err = errno; /* save errno from opening dtfd */
#if defined(__FreeBSD__)
From: Sevan Janiyan <venture37@geeklan.co.uk>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/54387: DTrace Kernel module does not autoload on first use
with GENERIC kernel
Date: Sat, 20 Jul 2019 16:20:10 +0100
On 20/07/2019 15:25, J. Hannken-Illjes wrote:
> please try the diff attached.
Applied the diff & rebuilt libdtrace. dtrace module autoloads as
expected now.
Thank you.
Sevan
From: "Juergen Hannken-Illjes" <hannken@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54387 CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common
Date: Sun, 21 Jul 2019 15:37:27 +0000
Module Name: src
Committed By: hannken
Date: Sun Jul 21 15:37:27 UTC 2019
Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_open.c
Log Message:
Try to load module "dtrace" before opening "/dev/dtrace/dtrace".
Fixes PR kern/54387: DTrace Kernel module does not autoload on first use ...
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Mon, 05 Aug 2019 19:05:45 +0000
State-Changed-Why:
Confirmed fixed. Thanks for the report, and thanks hannken for fixing all of the bugs :)
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.