From owner-svn-src-head@freebsd.org Fri Apr 6 19:22:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B88B6FA0C0B; Fri, 6 Apr 2018 19:22:22 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9026D713E4; Fri, 6 Apr 2018 19:22:22 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B2941619D; Fri, 6 Apr 2018 19:22:22 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36JMM0R027550; Fri, 6 Apr 2018 19:22:22 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36JMMWA027549; Fri, 6 Apr 2018 19:22:22 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201804061922.w36JMMWA027549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Fri, 6 Apr 2018 19:22:22 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/pf/ioctl X-SVN-Commit-Revision: 332139 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 19:22:22 -0000 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(); }