<p></p>
<blockquote>
<p dir="auto">I wonder whether the new code could be tested?</p>
</blockquote>
<p dir="auto">Behavior is different on different platforms. On platforms that have <code>pku</code> and <code>ospke</code>  in <code>/proc/cpuinfo</code> this code would crash with <code>SIGSEGV</code> (and <code>si_pkey=1</code>) :</p>
<pre><code>#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/prctl.h>

int main(void) {
   prctl(PR_SET_DUMPABLE, 0);
   int *buf = mmap(NULL, getpagesize(), PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);

   if (buf == MAP_FAILED) {
       perror("mmap");
       exit(EXIT_FAILURE);
   }
   if (*buf) {
       asm volatile("":::"memory");
   }
   puts("PKU disabled, so it isn't crashed");
}
</code></pre>
<p dir="auto">while on other platforms it will succeed (since these allow read access to <code>PROT_EXEC</code> regions).</p>
<p dir="auto">I can try to make conditional test, that would be executed only of <code>pku</code> is present in <code>/proc/cpuinfo</code>.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/strace/strace/pull/210#issuecomment-1029361480">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AOVBTR37WVFQLGP5FPOOD6TUZLOZVANCNFSM5NL4DJ6Q">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AOVBTRZVEGTLFG6LDPDXJFTUZLOZVA5CNFSM5NL4DJ62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHVNM6SA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><strace/strace/pull/210/c1029361480</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/strace/strace/pull/210#issuecomment-1029361480",
"url": "https://github.com/strace/strace/pull/210#issuecomment-1029361480",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>