<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Liam, Petr,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Liam Howlett <<a href="mailto:liam.howlett@oracle.com">liam.howlett@oracle.com</a>> wrote:<br></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">
<span class="gmail_default" style="font-size:small">...</span><br>
+ if (mprotect(addr - page_size, page_size,<br>
+ PROT_READ|PROT_WRITE|PROT_EXEC)) {<br>
+ tst_res(TFAIL, "Cannot mprotect new VMA.");<br>
+ return;<br>
+ }<br></blockquote><div><br></div>We got permission denied<span class="gmail_default" style="font-size:small"> here while performing the brk02 on</span></div><div class="gmail_quote"><span class="gmail_default" style="font-size:small">x86_64/s390x(kernel-4.18~). </span>After looking at the manual page of</div><div class="gmail_quote">mprotect(), seems the access issue caused by<span class="gmail_default" style="font-size:small"> </span>PROT_EXEC.</div><div class="gmail_default" style="font-size:small"><br></div>"<div>POSIX says that the behavior of mprotect() is unspecified if it is applied<div>to a region of memory that was not obtained via mmap(2).<br>...<br>Whether PROT_EXEC has any effect different from PROT_READ </div><div>depends on processor architecture, kernel version, and process state. </div><div>If READ_IMPLIES_EXEC is set in the process's personality flags</div><div>(see personality(2)), specifying PROT_READ will<span class="gmail_default" style="font-size:small"> </span>implicitly add PROT_EXEC.<br>"</div><div><br></div><div><div class="gmail_default" style="font-size:small"># ./brk02</div>tst_test.c:1291: TINFO: Timeout per run is 0h 05m 00s<br>brk02.c:41: TFAIL: Cannot mprotect new VMA<br><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">After removing the PROT_EXEC:</div><div class="gmail_default" style="font-size:small"><br></div># ./brk02 <br>tst_test.c:1291: TINFO: Timeout per run is 0h 05m 00s<br>brk02.c:56: TPASS: munmap at least two VMAs of brk() passed<br><div class="gmail_default" style="font-size:small"><br></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></div></div>