Having overcommit pages makes the heap-overflow test fail, this patch
uses the function introduces earlier to set the overcommit pool to 0.
This forces this test to be run as root only.
Signed-off-by: Eric B Munson <[EMAIL PROTECTED]>
---
tests/heap-overflow.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/tests/heap-overflow.c b/tests/heap-overflow.c
index 0f1029c..63c5f18 100644
--- a/tests/heap-overflow.c
+++ b/tests/heap-overflow.c
@@ -26,9 +26,17 @@
#include <hugetlbfs.h>
#include "hugetests.h"
+long pool_size = -1;
+long hpagesize;
+
+void cleanup(void)
+{
+ if (pool_size >= 0)
+ restore_overcommit_pages(hpagesize, pool_size);
+}
+
int main(int argc, char **argv)
{
- long hpagesize;
int freepages;
long size1, size2;
void *p1, *p2;
@@ -41,6 +49,12 @@ int main(int argc, char **argv)
hpagesize = check_hugepagesize();
+ /* Must be root because this test modifies the overcommit pool */
+ check_must_be_root();
+
+ pool_size = read_nr_overcommit(hpagesize);
+ set_nr_overcommit_hugepages(hpagesize, 0);
+
freepages = get_huge_page_counter(hpagesize, HUGEPAGES_FREE);
if (freepages < 3)
CONFIG("Must have at least 3 free hugepages");
--
1.6.0.3
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel