<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 11, 2020 at 3:05 PM Petr Vorel <<a href="mailto:pvorel@suse.cz">pvorel@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Li,<br>
<br>
> From: pravin <<a href="mailto:pravinraghul@zilogic.com" target="_blank">pravinraghul@zilogic.com</a>><br>
<br>
> We assign the memory region allocated using MAP_GROWSDOWN to a thread,<br>
> as a stack, to test the effect of MAP_GROWSDOWN. This is because the<br>
> kernel only grows the memory region when the stack pointer, is within<br>
> guard page, when the guard page is touched.<br>
<br>
> 1. Map an anyonymous memory region of size X, and unmap it.<br>
> 2. Split the unmapped memory region into two.<br>
> 3. The lower memory region is left unmapped.<br>
> 4. The higher memory region is mapped for use as stack, using MAP_FIXED | MAP_GROWSDOWN.<br>
> 5. The higher memory region is provided as stack to a thread, where<br>
> a recursive function is invoked.<br>
> 6. The stack grows beyond the allocated region, into the lower memory area.<br>
> 7. If this results in the memory region being extended, into the<br>
> unmapped region, the test is considered to have passed.<br>
<br>
> Also, to verify that(Test2) the stack grows to within a page of the high<br>
> end of the next lower map‐ping will result in a SIGSEGV signal.<br>
<br>
> Resolves #300<br>
> Signed-off-by: Pravin Raghul S. <<a href="mailto:pravinraghul@zilogic.com" target="_blank">pravinraghul@zilogic.com</a>><br>
> Reviewed-by: Vijay Kumar B. <<a href="mailto:vijaykumar@zilogic.com" target="_blank">vijaykumar@zilogic.com</a>><br>
> Signed-off-by: Li Wang <<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a>><br>
> Cc: Cyril Hrubis <<a href="mailto:chrubis@suse.cz" target="_blank">chrubis@suse.cz</a>><br>
<br>
Reviewed-by: Petr Vorel <<a href="mailto:pvorel@suse.cz" target="_blank">pvorel@suse.cz</a>><br>
LGTM.<br>
<br>
Just please fix using spaces instead of tabs in check_stackgrow_up() and<br>
run_test() (I suppose your modifications to pravis's code):<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Sorry for the chaotic indent, I guess it was caused by my editor.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Anyway, thanks for the review, will fix it after getting Cyril's reviewing.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>