<div dir="ltr"><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 Mon, Sep 14, 2020 at 11:06 AM Li Wang <<a href="mailto:liwang@redhat.com">liwang@redhat.com</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"><div dir="ltr"><div dir="ltr"><div style="font-size:small"><br></div></div><div class="gmail_default" style="font-size:small">...</div><div class="gmail_quote"><div dir="ltr" class="gmail_attr"> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
But still the code wasn't exactly right, because the lowest address of<br>
the stack in the previous code was stack - stack_size, which would be<br>
start of the unmapped region and the size of the stack would be 2 *<br>
stack_size, as we expected the mapping to grow.<br></blockquote><div><br></div><div><div style="font-size:small">No, I don't think so, the lowest address of the stack in the previous code is:</div><div style="font-size:small"> stack = start + total_size - size;</div></div><div style="font-size:small">and we pass this stack pointer to ptrehad_attr_setstack() is correct here,</div><div style="font-size:small">indeed the stack really starts at stack + stack_size, that's internal steps.</div></div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Here print debug info to verify that stack grows down from 'stack + size' address:</div><div class="gmail_default" style="font-size:small"><br></div>mmap18.c:99: INFO: start = 0x7f4831293000, stack - size = 0x7f4831393000, stack = 0x7f48313b3000, stack + size = 0x7f48313d3000<br>mmap18.c:110: INFO: &limit = 0x7f48313d1ee8, limit = 0x7f4831397000<br>mmap18.c:110: INFO: &limit = 0x7f48313d1ec8, limit = 0x7f4831397000<br>mmap18.c:110: INFO: &limit = 0x7f48313d1ea8, limit = 0x7f4831397000<br>mmap18.c:110: INFO: &limit = 0x7f48313d1e88, limit = 0x7f4831397000<br>mmap18.c:110: INFO: &limit = 0x7f48313d1e68, limit = 0x7f4831397000<br>mmap18.c:110: INFO: &limit = 0x7f48313d1e48, limit = 0x7f4831397000<br>mmap18.c:110: INFO: &limit = 0x7f48313d1e28, limit = 0x7f4831397000<br>mmap18.c:110: INFO: &limit = 0x7f48313d1e08, limit = 0x7f4831397000<br>mmap18.c:110: INFO: &limit = 0x7f48313d1de8, limit = 0x7f4831397000<br><div class="gmail_default" style="font-size:small">...</div><div> </div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div></div>