Date: Fri, 6 Apr 2018 19:22:22 +0000 (UTC) From: Kristof Provost <kp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332139 - head/tests/sys/netpfil/pf/ioctl Message-ID: <201804061922.w36JMMWA027549@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kp Date: Fri Apr 6 19:22:22 2018 New Revision: 332139 URL: https://svnweb.freebsd.org/changeset/base/332139 Log: pf tests: Try to provoke a memory leak There was a memory leak in the DIOCRADDTABLES ioctl() code which could be triggered by trying to add tables with the same name. Try to provoke this memory leak. It was fixed in r331225. MFC after: 1 week Modified: head/tests/sys/netpfil/pf/ioctl/validation.c Modified: head/tests/sys/netpfil/pf/ioctl/validation.c ============================================================================== --- head/tests/sys/netpfil/pf/ioctl/validation.c Fri Apr 6 19:21:36 2018 (r332138) +++ head/tests/sys/netpfil/pf/ioctl/validation.c Fri Apr 6 19:22:22 2018 (r332139) @@ -66,6 +66,7 @@ ATF_TC_BODY(addtables, tc) { struct pfioc_table io; struct pfr_table tbl; + struct pfr_table tbls[4]; int flags; COMMON_HEAD(); @@ -92,6 +93,14 @@ ATF_TC_BODY(addtables, tc) io.pfrio_buffer = NULL; if (ioctl(dev, DIOCRADDTABLES, &io) == 0) atf_tc_fail("Request with NULL buffer succeeded"); + + /* This can provoke a memory leak, see r331225. */ + io.pfrio_size = 4; + for (int i = 0; i < io.pfrio_size; i++) + common_init_tbl(&tbls[i]); + + io.pfrio_buffer = &tbls; + ioctl(dev, DIOCRADDTABLES, &io); COMMON_CLEANUP(); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804061922.w36JMMWA027549>