Date: Thu, 7 Dec 2017 16:59:49 -0500 From: Ryan Stone <rysto32@gmail.com> To: freebsd-net <freebsd-net@freebsd.org> Subject: [PATCH] ifaddr leak when modifying a route Message-ID: <CAFMmRNxmpQKPz7CG8twXeQmyC_skkqA0UepQgf1XCDvOt8Hi2A@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFMmRNxmpQKPz7CG8twXeQmyC_skkqA0UepQgf1XCDvOt8Hi2A>