freebsd-dev/sys
Mark Johnston 8776669b53 FreeBSD's DTrace implementation has a few problems with respect to handling
probes declared in a kernel module when that module is unloaded. In
particular,

* Unloading a module with active SDT probes will cause a panic. [1]
* A module's (FBT/SDT) probes aren't destroyed when the module is unloaded;
  trying to use them after the fact will generally cause a panic.

This change fixes both problems by porting the DTrace module load/unload
handlers from illumos and registering them with the corresponding
EVENTHANDLER(9) handlers. This allows the DTrace framework to destroy all
probes defined in a module when that module is unloaded, and to prevent a
module unload from proceeding if some of its probes are active. The latter
problem has already been fixed for FBT probes by checking lf->nenabled in
kern_kldunload(), but moving the check into the DTrace framework generalizes
it to all kernel providers and also fixes a race in the current
implementation (since a probe may be activated between the check and the
call to linker_file_unload()).

Additionally, the SDT implementation has been reworked to define SDT
providers/probes/argtypes in linker sets rather than using SYSINIT/SYSUNINIT
to create and destroy SDT probes when a module is loaded or unloaded. This
simplifies things quite a bit since it means that pretty much all of the SDT
code can live in sdt.ko, and since it becomes easier to integrate SDT with
the DTrace framework. Furthermore, this allows FreeBSD to be quite flexible
in that SDT providers spanning multiple modules can be created on the fly
when a module is loaded; at the moment it looks like illumos' SDT
implementation requires all SDT probes to be statically defined in a single
kernel table.

PR:		166927, 166926, 166928
Reported by:	davide [1]
Reviewed by:	avg, trociny (earlier version)
MFC after:	1 month
2013-08-13 03:10:39 +00:00
..
amd64 Different consumers of the struct vm_page abuse pageq member to keep 2013-08-10 17:36:42 +00:00
arm Only allocate 2 bounce pages for maps that can only use them for buffers that 2013-08-11 21:21:02 +00:00
boot Add optional support for default override of standard setup; but only if 2013-08-12 03:52:23 +00:00
bsm
cam Remove droping topology mutex after iterating 100 periphs in CAMGETPASSTHRU. 2013-08-07 11:34:20 +00:00
cddl FreeBSD's DTrace implementation has a few problems with respect to handling 2013-08-13 03:10:39 +00:00
compat Replace kernel virtual address space allocation with vmem. This provides 2013-08-07 06:21:20 +00:00
conf Add read-only support for extents in ext2fs. 2013-08-12 21:34:48 +00:00
contrib Add firmware for the Intel 2030 and variants. 2013-08-11 01:09:16 +00:00
crypto Fix const propagation issues to make GCC happy. 2013-07-11 16:27:11 +00:00
ddb
dev Alter the mq_start routine to do a TRYLOCK and call to the locked routine 2013-08-13 00:25:39 +00:00
fs Add read-only support for extents in ext2fs. 2013-08-12 21:34:48 +00:00
gdb rename scheduler->swapper and SI_SUB_RUN_SCHEDULER->SI_SUB_LAST 2013-07-24 09:45:31 +00:00
geom Fix the formatting of the error message. 2013-08-12 18:17:45 +00:00
gnu/fs/reiserfs
i386 Different consumers of the struct vm_page abuse pageq member to keep 2013-08-10 17:36:42 +00:00
ia64 The soft and hard busy mechanism rely on the vm object lock to work. 2013-08-09 11:11:11 +00:00
isa
kern FreeBSD's DTrace implementation has a few problems with respect to handling 2013-08-13 03:10:39 +00:00
kgssapi Add support for host-based (Kerberos 5 service principal) initiator 2013-07-09 01:05:28 +00:00
libkern Fix watchdog pretimeout. 2013-07-27 20:47:01 +00:00
mips Add a missing break. 2013-08-12 00:38:47 +00:00
modules Add read-only support for extents in ext2fs. 2013-08-12 21:34:48 +00:00
net Add a missing module version declaration to if_tun(4). 2013-08-07 01:32:08 +00:00
net80211 Blank m_nextpkt before passing it up. 2013-08-12 22:27:53 +00:00
netatalk Add const qualifier to the dst parameter of the ifnet if_output method. 2013-04-26 12:50:32 +00:00
netgraph Add constant for PPP-Max-PayLoad tag. 2013-07-23 10:25:34 +00:00
netinet Make the features a 64-bit value instead of 32-bit. 2013-08-12 13:52:15 +00:00
netinet6 Fix incompatibility in ICMPV6CTL_ND6_PRLIST sysctl, and SIOCGPRLST_IN6, 2013-08-06 17:10:52 +00:00
netipsec Remove the large part of struct ipsecstat. Only few fields of this 2013-07-23 14:14:24 +00:00
netipx
netnatm
netpfil Fix a possible NULL-pointer dereference on the pfsync(4) reconfiguration. 2013-07-29 13:17:18 +00:00
netsmb Remove a reference to LK_DRAIN now that lockmgr(9) is gone from this 2013-06-28 20:21:13 +00:00
nfs Changes to allow using BOOTP_NFSROOT and mounting an nfs root filesystem 2013-07-31 19:14:00 +00:00
nfsclient A problem with the old NFS client where large writes to large files 2013-07-04 00:54:23 +00:00
nfsserver - Convert the bufobj lock to rwlock. 2013-05-31 00:43:41 +00:00
nlm
ofed - Reserve a special AF for SDP. The one we were incorrectly using before 2013-08-09 03:26:17 +00:00
opencrypto
pc98 Replace kernel virtual address space allocation with vmem. This provides 2013-08-07 06:21:20 +00:00
pci Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCI 2013-08-12 23:30:01 +00:00
powerpc The soft and hard busy mechanism rely on the vm object lock to work. 2013-08-09 11:11:11 +00:00
rpc Add support for host-based (Kerberos 5 service principal) initiator 2013-07-09 01:05:28 +00:00
security audit_proc_coredump: check return value of audit_new 2013-07-09 09:03:01 +00:00
sparc64 The soft and hard busy mechanism rely on the vm object lock to work. 2013-08-09 11:11:11 +00:00
sys FreeBSD's DTrace implementation has a few problems with respect to handling 2013-08-13 03:10:39 +00:00
teken
tools
ufs This bug fix is in a code path in rename taken when there is a 2013-08-06 16:50:05 +00:00
vm Correct the recovery logic in vm_page_alloc_contig: 2013-08-11 21:15:04 +00:00
x86 Split the pagequeues per NUMA domains, and split pageademon process 2013-08-07 16:36:38 +00:00
xdr
xen Replace kernel virtual address space allocation with vmem. This provides 2013-08-07 06:21:20 +00:00
Makefile