[PATCH] ifaddr leak when modifying a route
Ryan Stone
rysto32 at gmail.com
Thu Dec 7 21:59:51 UTC 2017
I've put this phab review up that patches an ifaddr refcount leak in
the routing code. When a route is modified in a way that modifies
rt->rt_ifa, in most cases we don't release the reference on the old
one, which can cause it to leak. I have a simple script here that I
wrote to demonstrate the issue:
https://people.freebsd.org/~rstone/route-change-leak
If I run it on a stock -head system, I see 100 ifaddrs leak every time it's run:
# sh route-change-leak
Type InUse MemUse HighUse Requests Size(s)
ifaddr 53 17K - 564 32,64,128,256,512,2048,4096
ifaddr 153 42K - 664 32,64,128,256,512,2048,4096
# sh route-change-leak
Type InUse MemUse HighUse Requests Size(s)
ifaddr 153 42K - 665 32,64,128,256,512,2048,4096
ifaddr 253 67K - 765 32,64,128,256,512,2048,4096
# sh route-change-leak
Type InUse MemUse HighUse Requests Size(s)
ifaddr 253 67K - 766 32,64,128,256,512,2048,4096
ifaddr 353 92K - 866 32,64,128,256,512,2048,4096
With my fix, the leak is gone:
# sh route-change-leak
Type InUse MemUse HighUse Requests Size(s)
ifaddr 46 15K - 47 16,32,64,128,256,512,2048,4096
ifaddr 46 15K - 147 16,32,64,128,256,512,2048,4096
# sh route-change-leak
Type InUse MemUse HighUse Requests Size(s)
ifaddr 46 15K - 148 16,32,64,128,256,512,2048,4096
ifaddr 46 15K - 248 16,32,64,128,256,512,2048,4096
The review is here. I didn't subscribe freebsd-net to the review to
try to reduce the noise on the mailing list, so if you would like to
review this change please subscribe yourself to the review. Thanks.
https://reviews.freebsd.org/D13417
More information about the freebsd-net
mailing list