<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>We are planning to add the following testcases for MAP_GROWSDOWN,
please let us know your thoughts on this.</p>
<p>We assign the memory region allocated using MAP_GROWSDOWN to a
thread, as a stack, to test the effect of MAP_GROWSDOWN. This is
because the kernel only grows the memory region when the stack
pointer, is within guard page, when the guard page is touched.</p>
<h3>Test Case 1: Grow into an unmapped region</h3>
<ol>
<li>Map an anyonymous memory region of size X, and unmap it.</li>
<li>Split the unmapped memory region into two.</li>
<li>The lower memory region is left unmapped.</li>
<li>The higher memory region is mapped for use as stack, using
MAP_FIXED | MAP_GROWSDOWN.</li>
<li>The higher memory region is provided as stack to a thread,
where a recursive function is invoked.</li>
<li>The stack grows beyond the allocated region, into the lower
memory area.</li>
<li>If this results in the memory region being extended, into the
unmapped region, the test is considered to have passed.</li>
</ol>
<h3>Test Case 2: Grow into a mapped region</h3>
<ol>
<li>Map an anonymous memory area.</li>
<li>Split the memory area into two by mapping them into two areas.</li>
<li>The lower memory area is mapped using MAP_FIXED.</li>
<li>The higher memory area is mapped for use as stack, using
MAP_FIXED | MAP_GROWSDOWN.</li>
<li>The higher memory area is provided as stack to a thread, where
a recursive function is invoked.</li>
<li>The stack grows beyond the allocated area, into the lower
memory area.</li>
<li>If this results in a segmentation fault, the test is
considered to have passed.</li>
</ol>
</body>
</html>