<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 Thu, Sep 24, 2020 at 10:43 PM Martin Doucha <<a href="mailto:mdoucha@suse.cz" target="_blank">mdoucha@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">The first testcase keeps segfaulting on older kernels with only 4KB initial<br>
stack mapping<br>
<br>
Signed-off-by: Martin Doucha <<a href="mailto:mdoucha@suse.cz" target="_blank">mdoucha@suse.cz</a>><br></blockquote><div><span class="gmail_default" style="font-size:small"></span>Reviewed-by: Li Wang <<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a>></div><div><span class="gmail_default"></span> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
<br>
Note: Increasing initial stack size to 8KB fixes the segfaults but I'm not<br>
entirely sure whether we shouldn't use PTHREAD_STACK_MIN as the minimal size<br>
instead. Pthread man page isn't entirely clear whether <span class="gmail_default" style="font-size:small"></span><span class="gmail_default" style="font-size:small"></span>PTHREAD_STACK_MIN is<br>
the minimal value for stack size after it grows to the limit, or the minimal<br>
size of the initial stack mapping (before it starts growing).<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I slightly think the latter, which means <span class="gmail_default"></span>PTHREAD_STACK_MIN is the minimal</div><div class="gmail_default" style="font-size:small">size of the initial stack mapping. So maybe better to use the PTHREAD_STACK_MIN</div><div class="gmail_default" style="font-size:small">as mmaped_size, we even don't need to have a MAX() there.</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
On x86_64, PTHREAD_STACK_MIN is 4 pages (16KB). On PPC64, it's 2 pages<br>
(128KB).</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
testcases/kernel/syscalls/mmap/mmap18.c | 5 +++--<br>
1 file changed, 3 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/testcases/kernel/syscalls/mmap/mmap18.c b/testcases/kernel/syscalls/mmap/mmap18.c<br>
index 966bf673e..8b149fb93 100644<br>
--- a/testcases/kernel/syscalls/mmap/mmap18.c<br>
+++ b/testcases/kernel/syscalls/mmap/mmap18.c<br>
@@ -201,10 +201,11 @@ static void grow_stack_fail(size_t stack_size, size_t mapped_size)<br>
static void run_test(void)<br>
{<br>
size_t stack_size = 8 * PTHREAD_STACK_MIN;<br>
+ size_t minsize = MAX(page_size, 8192);<br>
<br>
- grow_stack_success(stack_size, page_size);<br>
+ grow_stack_success(stack_size, minsize);<br>
grow_stack_success(stack_size, stack_size/2);<br>
- grow_stack_fail(stack_size, page_size);<br>
+ grow_stack_fail(stack_size, minsize);<br>
grow_stack_fail(stack_size, stack_size/2);<br>
}<br>
<br>
-- <br>
2.28.0<br>
<br>
<br>
-- <br>
Mailing list info: <a href="https://lists.linux.it/listinfo/ltp" rel="noreferrer" target="_blank">https://lists.linux.it/listinfo/ltp</a><br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>