markj fb0c576172 Plug a race between fd table teardown and several loops
To export information from fd tables we have several loops which do
this:

FILDESC_SLOCK(fdp);
for (i = 0; fdp->fd_refcount > 0 && i <= lastfile; i++)
	<export info for fd i>;
FILDESC_SUNLOCK(fdp);

Before r367777, fdescfree() acquired the fd table exclusive lock between
decrementing fdp->fd_refcount and freeing table entries.  This
serialized with the loop above, so the file at descriptor i would remain
valid until the lock is dropped.  Now there is no serialization, so the
loops may race with teardown of file descriptor tables.

Acquire the exclusive fdtable lock after releasing the final table
reference to provide a barrier synchronizing with these loops.

Reported by:	pho
Reviewed by:	kib (previous version), mjg
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27513
2020-12-09 14:05:08 +00:00
..
2020-02-26 16:22:28 +00:00
2020-09-25 10:05:38 +00:00
2020-10-05 15:54:19 +00:00
2020-11-19 02:50:48 +00:00
2020-12-04 18:56:44 +00:00
2020-11-19 04:28:39 +00:00
2020-10-19 16:57:59 +00:00
2020-11-05 15:08:56 +00:00
2020-11-09 00:34:23 +00:00
2020-05-09 15:56:02 +00:00
2020-08-13 20:48:14 +00:00
2020-12-01 16:06:31 +00:00
2020-01-12 23:52:16 +00:00
2020-11-25 22:53:21 +00:00
2020-10-22 09:28:11 +00:00
2020-08-27 05:11:15 +00:00
2020-12-05 05:56:23 +00:00