svn commit: r332139 - head/tests/sys/netpfil/pf/ioctl
Kristof Provost
kp at FreeBSD.org
Fri Apr 6 19:22:22 UTC 2018
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();
}
More information about the svn-src-head
mailing list