misc/171678: [dtrace] dtrace -h doesn't work when io.d is installed

Mark Johnston markjdb at gmail.com
Sun Sep 16 06:00:30 UTC 2012


>Number:         171678
>Category:       misc
>Synopsis:       [dtrace] dtrace -h doesn't work when io.d is installed
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 16 06:00:27 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Mark Johnston
>Release:        CURRENT
>Organization:
>Environment:
FreeBSD oddish.laptop 10.0-CURRENT FreeBSD 10.0-CURRENT #13 r240519+3cc2dea-dirty: Sat Sep 15 22:29:45 EDT 2012     mark at oddish.laptop:/usr/obj/usr/home/mark/src/freebsd/sys/GENERIC  amd64
>Description:
When running dtrace -h, I get the following unintuitive error message:

$ dtrace -h -s perldtrace.d
dtrace: failed to compile script perldtrace.d: "/usr/lib/dtrace/regs_x86.d", line 2: type redeclared: struct devinfo

This error doesn't occur if I run it without -h, which doesn't make much sense since the scripts in /usr/lib/dtrace/ are processed regardless.
>How-To-Repeat:

>Fix:
The root of the problem is the "#pragma D depends_on provider" in /usr/lib/dtrace/io.d. When dtrace sees that directive, it calls a DTRACEIOC_PROVIDER ioctl on /dev/dtrace/dtrace with the appropriate provider argument ("io" in this case) to verify that that provider really is available.

Turns out that the -h (and -G) option sets the DTRACE_O_NODEV flag, which basically means "don't open /dev/dtrace/dtrace or /dev/dtrace/fasttrap." This allows dtrace -h to be used without needing root privileges. But obviously we need to open /dev/dtrace/dtrace for the reason mentioned above, and dtrace aborts because it can't call the ioctl.

For now, I'm working around this by just removing /usr/lib/dtrace/io.d - I don't need it at the moment. I'm not sure what the right fix is. Probably the error message could also be improved in this case, but I haven't really looked into that.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list