freebsd-skq/sys
Ruslan Ermilov 36fea5de60 rn_walktree*() compute the next leaf before applying a function
to current leaves because function may vanish the current node.

If parent RTA_GENMASK route has a clone (a "cloning clone"), an
rn_walktree_from() starting from parent will cause another walk
starting from clone.  If a function is either rt_fixdelete() or
rt_fixchange(), this recursive walk may vanish the leaf that is
remembered by an outer walk (the "next leaf" above), panicing a
system when it resumes with an outer walk.

The following script paniced my single-user mode booted system:

: sysctl net.inet.ip.forwarding=1
: ipfw add 1 allow ip from any to any
: ifconfig lo0 127.1
: route add -net 10 -genmask 255.255.255.0 127.1
: telnet 10.1			# rt_fixchange() panic
: telnet 10.2
: telnet 10.1
: route delete -net 10		# rt_fixdelete() panic

For the time being, avoid these races by disallowing recursive
walks in rt_fixchange() and rt_fixdelete().

Also, make a slight optimization in the rtrequest(RTM_RESOLVE)
case: there is no reason to call rt_fixchange() in this case.

PR:		kern/37606
MFC after:	5 days
2002-12-23 13:12:41 +00:00
..
alpha MB_LEN_MAX is not MD, move it to the MI limits.h. 2002-12-22 06:38:45 +00:00
amd64 MB_LEN_MAX is not MD, move it to the MI limits.h. 2002-12-22 06:38:45 +00:00
arm MB_LEN_MAX is not MD, move it to the MI limits.h. 2002-12-22 06:38:45 +00:00
boot -mno-align-long-strings can make things smaller, so lets use it in hopes 2002-12-21 02:03:31 +00:00
cam Quirk for Memorybird pen drive 2002-12-18 21:47:52 +00:00
coda Back our kernel support for reliable signal queues. 2002-10-01 17:15:53 +00:00
compat SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
conf Move the amd(4) driver to it's own directory in preparation for it growing 2002-12-13 22:59:18 +00:00
contrib SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
crypto Make this compilable from userland as well. 2002-11-01 08:56:39 +00:00
ddb - Rename the DDB specific %z printf format to %y. 2002-10-25 19:41:32 +00:00
dev Fix a De Morgan bug: If we only expect a memory range OR an 2002-12-23 03:48:59 +00:00
fs Remove redundant check for negative or zero v_usecount; vrele() already 2002-12-15 04:32:41 +00:00
geom Don't forget our topology lock in the MBREXT case. 2002-12-19 12:01:19 +00:00
gnu MFufs 1.33: 2002-10-18 21:41:41 +00:00
i4b network interface and link layer changes: 2002-11-15 00:00:15 +00:00
i386 MB_LEN_MAX is not MD, move it to the MI limits.h. 2002-12-22 06:38:45 +00:00
ia64 MB_LEN_MAX is not MD, move it to the MI limits.h. 2002-12-22 06:38:45 +00:00
isa Use the correct value when writing the Day Of Week byte in the CMOS. 2002-12-04 13:46:49 +00:00
isofs/cd9660 Unbreak MNT_UPDATE when running with cd as root. Detect mountroot by 2002-11-02 20:16:55 +00:00
kern - Add a spin lock to single thread cache invalidation and tlb flush ipis, 2002-12-22 20:50:23 +00:00
libkern Fix instances of macros with improperly parenthasized arguments. 2002-11-09 12:55:07 +00:00
modules libmchain no longer exports m_fixhdr(); remove it from EXPORT_SYMS. 2002-12-14 00:01:51 +00:00
net rn_walktree*() compute the next leaf before applying a function 2002-12-23 13:12:41 +00:00
netatalk Lock up ifaddr reference counts. 2002-12-18 11:46:59 +00:00
netatm SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
netgraph SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
netinet Remove forgotten INP_UNLOCK(inp) in my previous commit. 2002-12-22 13:04:08 +00:00
netinet6 SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
netipsec SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
netipx Fix a sizeof(int) != sizeof(void *) warning. 2002-11-08 21:16:27 +00:00
netkey o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} and 2002-12-19 22:58:27 +00:00
netnatm Be consistent about functions being static. 2002-10-16 09:19:17 +00:00
netncp - Change mb_copy_t to take a size_t as the length argument instead of an 2002-11-08 21:26:32 +00:00
netns Use m_length() instead of home-rolled versions. 2002-09-18 19:44:14 +00:00
netsmb o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} and 2002-12-19 22:58:27 +00:00
nfs Change iov_base's type from char *' to the standard void *'. All 2002-10-11 14:58:34 +00:00
nfsclient Avoid holding the vnode interlock around malloc() or free() to prevent a 2002-12-23 06:20:41 +00:00
nfsserver In the NFSv3 `fsinfo' procedure reply, don't claim that we support 2002-12-05 16:58:11 +00:00
opencrypto correct minor # in make_dev call 2002-11-08 23:07:41 +00:00
pc98 Unspam some experimental changes which should not have been committed. 2002-12-17 13:37:08 +00:00
pccard MFp4: 2002-11-27 06:04:49 +00:00
pci Fix bug with 3c90xB cards and newer. We weren't trying to 2002-12-18 23:16:22 +00:00
posix4 Rework the sysconf(3) interaction with aio: 2002-11-17 04:15:34 +00:00
powerpc MB_LEN_MAX is not MD, move it to the MI limits.h. 2002-12-22 06:38:45 +00:00
rpc
security SCARGS removal take II. 2002-12-14 01:56:26 +00:00
sparc64 - Fix a bug where the faulting address for an mmu miss could sometimes be 2002-12-23 02:18:45 +00:00
sys Add suseconds_t and useconds_t for storing microseconds. 2002-12-22 22:02:41 +00:00
tools - Move ASSERT_VOP_*LOCK* functionality into functions in vfs_subr.c 2002-09-26 04:48:44 +00:00
ufs Fix corruption introduced in previous delta. 2002-12-18 19:50:28 +00:00
vm Eliminate some dead code. (Any possible use for this code died with 2002-12-23 04:35:38 +00:00
Makefile