Date: Tue, 13 Jun 2006 00:56:57 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 99102 for review Message-ID: <200606130056.k5D0uvWD053146@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99102 Change 99102 by jb@jb_freebsd2 on 2006/06/13 00:55:58 Save the invop address in a global variable for ease of access from kdb when system go kaboom gracefully. Ungraceful kabooms cause a reboot. Grumble. Also check a flag to see if a probe is already in progress and save the address just in case we have a chance to look at it before the system go kaboom. This shouldn't happen, but until the port is complete on FreeBSD and the functions called from the probe context meet Sun's design, it can happen. At the moment I think that it is witness in something that makes a bunch of functions uninstrumentable (is that a word?) by fbt reliably. Affected files ... .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/i386/dtrace_subr.c#2 edit Differences ... ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/i386/dtrace_subr.c#2 (text+ko) ==== @@ -36,7 +36,9 @@ #include <sys/dtrace_impl.h> #include <machine/dtrace.h> -extern uintptr_t kernelbase; +extern uintptr_t kernelbase; +extern uintptr_t dtrace_in_probe_addr; +extern int dtrace_in_probe; int dtrace_invop(uintptr_t, uintptr_t *, uintptr_t); @@ -47,7 +49,8 @@ struct dtrace_invop_hdlr *dtih_next; } dtrace_invop_hdlr_t; -dtrace_invop_hdlr_t *dtrace_invop_hdlr; +dtrace_invop_hdlr_t *dtrace_invop_hdlr; +uintptr_t dtrace_invop_addr; int dtrace_invop(uintptr_t addr, uintptr_t *stack, uintptr_t eax) @@ -55,6 +58,31 @@ dtrace_invop_hdlr_t *hdlr; int rval; + /* + * Save the address in a global variable which can be + * read via the kernel debugger in the event that a + * double fault occurs. + * + * From kdb: p *dtrace_invop_addr + * + * Then look up the value in an objdump of the kernel. + */ + dtrace_invop_addr = addr; + + /* + * An invalid opcode fault should not occur while executing + * a probe because only dtrace_ functions are supposed to + * be called by design. Check here if dtrace_probe() is + * in-progress. If so, that's very bad. Very, very bad. We + * can't call any non-dtrace functions to report this, so + * just save the invalid opcode address and hope that the + * dtrace_ioctl will report it. If the DTrace port is + * working according to Sun's design, this should never + * occur. + */ + if (dtrace_in_probe) + dtrace_in_probe_addr = addr; + for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) { if ((rval = hdlr->dtih_func(addr, stack, eax)) != 0) return (rval);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606130056.k5D0uvWD053146>