Date: Sun, 23 Feb 2014 22:08:37 -0500 From: Mark Johnston <markj@freebsd.org> To: freebsd-dtrace@freebsd.org Subject: [patch] enable interrupts before calling fasttrap handlers Message-ID: <20140224030837.GA2720@raichu>
next in thread | raw e-mail | index | archive | help
Hello, The patch here fixes a problem I've run into while doing some work on fasttrap: http://people.freebsd.org/~markj/patches/breakpoint_intr_enable.diff Specifically, we currently call fasttrap_pid_probe() with interrupts disabled because FreeBSD handles breakpoints through an interrupt gate and doesn't enable interrupts before calling trap(). The patch changes trap() on i386 and amd64 to enable interrupts after hitting a breakpoint if the trap came from usermode. fasttrap should only handle traps from user mode anyway, and the user mode handler for breakpoints already enables interrupts immediately, so the change shouldn't have any effect for breakpoints unrelated to DTrace. The problem with leaving interrupts disabled is that some pid provider probes require DTrace to modify userland memory in fasttrap_pid_probe(), i.e. by calling proc_rwmem() or copyout(). It turns out that this can cause nasty deadlocks if another thread attempts a TLB shootdown with the same pmap as that of the traced process. There are probably other issues as well, but this is the one that I've run into. Would anyone be able to review and/or test this diff? Thanks, -Mark
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140224030837.GA2720>