NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/51866: [PATCH] tests/lib/libc/sys/t_mincore: fix leak and release limit on memory to prevent false positives with mlock/mmap
The following reply was made to PR bin/51866; it has been noted by GNATS.
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/51866: [PATCH] tests/lib/libc/sys/t_mincore: fix leak and
release limit on memory to prevent false positives with mlock/mmap
Date: Fri, 13 Jan 2017 17:55:44 -0800
--Apple-Mail=_B9ED467B-9D2B-4B52-9F23-C61EF3E9F623
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Patch attached.
-Ngie
--Apple-Mail=_B9ED467B-9D2B-4B52-9F23-C61EF3E9F623
Content-Disposition: attachment;
filename=t_mincore-various-fixes.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="t_mincore-various-fixes.patch"
Content-Transfer-Encoding: 7bit
Index: lib/libc/sys/t_mincore.c
===================================================================
RCS file: /cvsroot/src/tests/lib/libc/sys/t_mincore.c,v
retrieving revision 1.9
diff -u -r1.9 t_mincore.c
--- lib/libc/sys/t_mincore.c 10 Jan 2017 22:36:29 -0000 1.9
+++ lib/libc/sys/t_mincore.c 13 Jan 2017 06:15:41 -0000
@@ -139,6 +139,7 @@
ATF_TC_HEAD(mincore_resid, tc)
{
atf_tc_set_md_var(tc, "descr", "Test page residency with mincore(2)");
+ atf_tc_set_md_var(tc, "require.user", "root");
}
ATF_TC_BODY(mincore_resid, tc)
@@ -150,6 +151,11 @@
struct rlimit rlim;
ATF_REQUIRE(getrlimit(RLIMIT_MEMLOCK, &rlim) == 0);
+ /*
+ * Bump the mlock limit to unlimited so the rest of the testcase
+ * passes instead of failing on the mlock call.
+ */
+ rlim.rlim_max = RLIM_INFINITY;
rlim.rlim_cur = rlim.rlim_max;
ATF_REQUIRE(setrlimit(RLIMIT_MEMLOCK, &rlim) == 0);
@@ -250,6 +256,7 @@
(void)munmap(addr2, npgs * page);
(void)munmap(addr3, npgs * page);
(void)unlink(path);
+ free(buf);
}
ATF_TC_CLEANUP(mincore_resid, tc)
--Apple-Mail=_B9ED467B-9D2B-4B52-9F23-C61EF3E9F623--
Home |
Main Index |
Thread Index |
Old Index