Sunday 24 April 2011

Dtrace bugs

Hm. Dtrace has a lot of bugs in it...as I try to ensure dtrace
cannot crash the linux kernel, I am stumbling on to some "thinko"
errors in dtrace.

Try the following on a Mac:


$ dtrace -l >/dev/null & dtrace -l >/dev/null & dtrace -l >/dev/null & dtrace -l >/dev/null &


We get interrupted system calls and issues on the major/minor numbers
(see 'dmesg' after it fails).

Next up is DTRACE_ENABLEIOC. This calls dtrace_copyin_dof() which validates
the main dtrace mutex is not asserted. Normally it isnt, unless someone
else is running a heavy handed probe trace, in which case a nasty race
condition exists. Unless a VFS lock is applied, this could spell out
danger or kernel panic (on Solaris, FreeBSD and MacOS).

dtrace_xcall is another area of potential for kernel deadlock if
multiple dtraces are firing on multiple cpus.

I have nearly finished my "safety" checks in dtrace, having written
my own dtrace_xcall, and am checking that kernels dont deadlock on you.

But its uncovering some nasty race conditions in dtrace as a whole.


Post created by CRiSP v10.0.5a-b5971


1 comment:

  1. Anyone get dtrace to build on Ubuntu 10.04 ?
    I'm using kernel 2.6.32-21-generic.
    dtrace versions 110414 and above.
    Here are the errors I'm getting : (posting partly, because of 4K character limit).

    cd cmd/ctfconvert ; make --no-print-directory
    gcc -g -I. -I../../ -I../../libctf -I../../common -I../../uts/common -I../../linux -I/usr/include/libdwarf -c ctfconvert.c
    In file included from ../../linux/elf.h:14,
    from /usr/include/libelf.h:56,
    from ctftools.h:38,
    from ctfconvert.c:43:
    ../../linux/sys/elf.h:92: error: expected specifier-qualifier-list before ‘Elf64_Half’
    ../../linux/sys/elf.h:307: error: expected specifier-qualifier-list before ‘Elf64_Word’
    ../../linux/sys/elf.h:381: error: expected specifier-qualifier-list before ‘Elf64_Word’
    ../../linux/sys/elf.h:494: error: expected specifier-qualifier-list before ‘Elf64_Word’
    ../../linux/sys/elf.h:577: error: expected specifier-qualifier-list before ‘Elf64_Addr’
    ../../linux/sys/elf.h:582: error: expected specifier-qualifier-list before ‘Elf64_Addr’
    ../../linux/sys/elf.h:637: error: expected specifier-qualifier-list before ‘Elf64_Word’
    ../../linux/sys/elf.h:648: error: expected specifier-qualifier-list before ‘Elf32_Lword’
    ../../linux/sys/elf.h:667: error: expected specifier-qualifier-list before ‘Elf64_Lword’
    ../../linux/sys/elf.h:694: error: expected specifier-qualifier-list before ‘Elf64_Xword’
    In file included from ../../linux/link.h:4,
    from ../../linux/elf.h:15,
    from /usr/include/libelf.h:56,
    from ctftools.h:38,
    from ctfconvert.c:43:

    make[3]: *** [all] Error 2
    make[2]: *** [do_cmds] Error 2
    tools/bug.sh
    make[1]: *** [all] Error 1


    Any help appreciated, much obliged, thanks.
    Krishna

    ReplyDelete