1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00
freebsd/sys
Kenneth D. Merry 43ab9660c5 Fix a bug in the device pager code that can trigger an assertion
in devfs if a particular race condition is hit in the device pager
code.

This was a side effect of change 227530 which changed the device
pager interface to call a new destructor routine for the cdev.
That destructor routine, old_dev_pager_dtor(), takes a VM object
handle.

The object handle is cast to a struct cdev *, and passed into
dev_rel().

That works in most cases, except the case in cdev_pager_allocate()
where there is a race condition between two threads allocating an
object backed by the same device.  The loser of the race
deallocates its object at the end of the function.

The problem is that before inserting the object into the
dev_pager_object_list, the object's handle is changed from the
struct cdev pointer to the object's own address.  This is to avoid
conflicts with the winner of the race, which already inserted an
object in the list with a handle that is a pointer to the same cdev
structure.

The object is then passed to vm_object_deallocate(), and eventually
makes its way down to old_dev_pager_dtor().  That function passes
the handle pointer (which is actually a VM object, not a struct
cdev as usual) into dev_rel().  dev_rel() decrements the reference
count in the assumed struct cdev (which happens to be 0), and
that triggers the assertion in dev_rel() that the reference count
is greater than or equal to 0.

The fix is to add a cdev pointer to the VM object, and use that
pointer when calling the cdev_pg_dtor() routine.

vm_object.h:	Add a struct cdev pointer to the VM object
		structure.

device_pager.c:	In cdev_pager_allocate(), populate the new cdev
		pointer.

		In dev_pager_dealloc(), use the new cdev pointer
		when calling the object's cdev_pg_dtor() routine.

Reviewed by:	kib
Sponsored by:	Spectra Logic Corporation
MFC after:	1 week
2013-01-09 16:48:38 +00:00
..
amd64 Add a "pause" to busy wait loops in the cpu reset path. 2013-01-09 02:11:16 +00:00
arm Define IPI_IRQ_START and IPI_IRQ_END. 2013-01-09 01:54:17 +00:00
boot Bring in some userboot changes from the bhyve branch to reduce diffs. 2013-01-08 03:27:37 +00:00
bsm Merge OpenBSM 1.2-alpha2 changes from contrib/openbsm to 2012-12-01 13:46:37 +00:00
cam Make SES driver to not fall out on some errors in Additional Status page. 2012-12-20 19:51:32 +00:00
cddl zfs: solaris doesn't have KM_ZERO, kmem_zalloc should be used instead 2012-12-23 19:58:41 +00:00
compat Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
conf Add basic support for the Ubiquiti EdgeRouter Lite. 2013-01-02 23:17:50 +00:00
contrib Use the right USB clock type on the EdgeRouter Lite. This fixes USB. 2013-01-02 23:29:54 +00:00
crypto Revert previous commit... 2012-10-10 08:36:38 +00:00
ddb Small textdump enhancements. 2012-11-01 04:07:08 +00:00
dev Fix format size. 2013-01-08 22:42:15 +00:00
fs Add support for IO_APPEND flag in fuse 2013-01-08 12:21:50 +00:00
gdb
geom Reset provider-specific fields when resending I/O request in low memory 2012-12-26 20:07:47 +00:00
gnu/fs r16312 is not any longer real since many years (likely since when VFS 2012-11-19 22:43:45 +00:00
i386 Enable the UFS quotas for big-iron GENERIC kernels. 2013-01-03 19:03:41 +00:00
ia64 Remove firewire devices missed in r244992. 2013-01-04 15:29:50 +00:00
isa
kern lockmgr: unlock interlock (if requested) when dealing with upgrade/downgrade 2013-01-06 21:47:59 +00:00
kgssapi Piete.Brooks at cl.cam.ac.uk reported via email a crash which was 2012-12-18 00:25:48 +00:00
libkern Sync strlcpy with userland version. 2012-11-03 04:29:24 +00:00
mips Mips Atheros AR71XX: make PCI base slot configurable through hints. 2013-01-06 20:50:31 +00:00
modules Link if_ath_spectral.c into the build. 2013-01-02 04:00:54 +00:00
net - Add dashes before copyright notices. 2013-01-07 19:36:11 +00:00
net80211 Add in the missing radiotap definitions from the sipsolutions.net 2013-01-08 06:59:21 +00:00
netatalk Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
netgraph Use DEVMETHOD_END, as suggested by hselasky@. 2012-12-26 19:14:21 +00:00
netinet Temporarily revert rev 244678. This is causing loopback problems with 2013-01-03 10:21:28 +00:00
netinet6 The in6_setscope() function determines the scope zone id of an address 2013-01-09 00:36:06 +00:00
netipsec Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
netipx Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
netnatm Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
netncp Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
netpfil In netpfil/pf: 2012-12-28 09:19:49 +00:00
netsmb Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
nfs Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
nfsclient Move the NFSv4.1 client patches over from projects/nfsv4.1-client 2012-12-08 22:52:39 +00:00
nfsserver Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
nlm Remove the support for using non-mpsafe filesystem modules. 2012-10-22 17:50:54 +00:00
ofed Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
opencrypto Revert previous commit... 2012-10-10 08:36:38 +00:00
pc98 MFi386: r232521 2013-01-04 09:52:09 +00:00
pci Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
powerpc Enable the UFS quotas for big-iron GENERIC kernels. 2013-01-03 19:03:41 +00:00
rpc Add support for backchannels to the kernel RPC. Backchannels 2012-12-08 00:29:16 +00:00
security Four .c files from OpenBSM are used, in modified form, by the kernel to 2012-12-15 15:21:09 +00:00
sparc64 Revert bogus part of r241740. 2013-01-03 23:12:08 +00:00
sys Change function argument type instead of casting. 2013-01-09 09:29:22 +00:00
teken
tools Fix build on ARM (and probably other platforms) 2012-12-28 06:52:53 +00:00
ufs The process_deferred_inactive() function locks the vnodes of the ufs 2013-01-01 16:14:48 +00:00
vm Fix a bug in the device pager code that can trigger an assertion 2013-01-09 16:48:38 +00:00
x86 Add macros required to enable VMX operation on Intel processors. 2013-01-05 04:20:14 +00:00
xdr
xen Move the corresponding MTX_SYSINIT() next to their struct mtx declaration 2012-10-26 17:31:35 +00:00
Makefile Run cscope with the -v parameter to make it more user-friendly. 2012-12-02 20:51:24 +00:00