<p></p>
<p>Bundled <code>linux/prctl.h</code> in version 5.13 is missing the <code>PR_SET_VMA</code> macro needed for Android, and thus building strace for Android is broken.</p>
<pre><code>aarch64-linux-android21-clang -DHAVE_CONFIG_H -I./linux/aarch64 -I./linux/aarch64 -I./linux/generic -I./linux/generic -I. -I. -I../bundled/linux/arch/arm64/include/uapi -I ../bundled/linux/include/uapi -DIN_STRACE=1 -Isrc/linux/generic -I./bundled/linux/arch/arm64/include/uapi -I./bundled/linux/include/uapi -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wformat-security -Winit-self -Winitializer-overrides -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wundef -Wwrite-strings -g -O2 -MT libstrace_a-prctl.o -MD -MP -MF .deps/libstrace_a-prctl.Tpo -c -o libstrace_a-prctl.o `test -f 'prctl.c' || echo './'`prctl.c
In file included from prctl.c:18:
./xlat/prctl_options.h:190:7: error: use of undeclared identifier 'PR_SET_VMA'
XLAT(PR_SET_VMA),
^
./xlat/prctl_options.h:201:10: error: invalid application of 'sizeof' to an incomplete type 'const struct xlat_data []'
.size = ARRAY_SIZE(prctl_options_xdata),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./macros.h:17:32: note: expanded from macro 'ARRAY_SIZE'
# define ARRAY_SIZE(a_) (sizeof(a_) / sizeof((a_)[0]) + MUST_BE_ARRAY(a_))
^~~~
</code></pre>
<p>The steps to reproduce are the same as <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="810781844" data-permission-text="Title is private" data-url="https://github.com/strace/strace/issues/174" data-hovercard-type="issue" data-hovercard-url="/strace/strace/issues/174/hovercard" href="https://github.com/strace/strace/issues/174">#174</a>, just with strace 5.13 instead of 5.11. This issue exists on both aarch64 and x86_64. Full logs can be found at <a href="https://build.archlinuxcn.org/~imlonghao/log/android-aarch64-strace/2021-07-19T12%3A17%3A02.html" rel="nofollow">https://build.archlinuxcn.org/~imlonghao/log/android-aarch64-strace/2021-07-19T12%3A17%3A02.html</a> and <a href="https://build.archlinuxcn.org/~imlonghao/log/android-x86-64-strace/2021-07-19T12%3A17%3A02.html" rel="nofollow">https://build.archlinuxcn.org/~imlonghao/log/android-x86-64-strace/2021-07-19T12%3A17%3A02.html</a>, respectively.</p>
<p>If I add that macro from <a href="https://android.googlesource.com/kernel/common/+/refs/tags/5.10-android12-9/include/uapi/linux/prctl.h#251" rel="nofollow">Google's kernel sources</a> to the bundled one, building is fine. Here is my test:</p>
<div class="highlight highlight-source-diff"><pre><span class="pl-c1">diff --git a/bundled/linux/include/uapi/linux/prctl.h b/bundled/linux/include/uapi/linux/prctl.h</span>
index 18a9f59dc..763a7dcd6 100644
<span class="pl-md">--- a/bundled/linux/include/uapi/linux/prctl.h</span>
<span class="pl-mi1">+++ b/bundled/linux/include/uapi/linux/prctl.h</span>
<span class="pl-mdr">@@ -255,6 +255,9 @@</span> struct prctl_mm_map {
# define SYSCALL_DISPATCH_FILTER_ALLOW 0
# define SYSCALL_DISPATCH_FILTER_BLOCK 1
<span class="pl-mi1"><span class="pl-mi1">+</span>#define PR_SET_VMA 0x53564d41</span>
<span class="pl-mi1"><span class="pl-mi1">+</span># define PR_SET_VMA_ANON_NAME 0</span>
<span class="pl-mi1"><span class="pl-mi1">+</span></span>
/* Set/get enabled arm64 pointer authentication keys */
#define PR_PAC_SET_ENABLED_KEYS 60
#define PR_PAC_GET_ENABLED_KEYS 61</pre></div>
<p>Running seems fine, too:</p>
<pre><code>$ ./strace ./strace 2>&1 | grep PR_SET_VMA | head
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x72d6943000, 20480, "bionic TLS guard") = 0
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x72d6944000, 12288, "bionic TLS") = 0
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x72d6942000, 1104, "arc4random data") = 0
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x72d693e000, 16384, "thread signal stack") = 0
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x72d693d000, 4096, "thread signal stack guard") = 0
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x72d693c000, 4096, "atexit handlers") = 0
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x72d693b000, 4096, "linker_alloc_small_objects") = 0
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x72d693a000, 24, "linker_alloc_vector") = 0
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x72d6939000, 4096, "linker_alloc_small_objects") = 0
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x72d6938000, 24, "linker_alloc_vector") = 0
</code></pre>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/strace/strace/issues/189">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AOVBTR6DXYCUVZLWLQA36DTTYQQ23ANCNFSM5ATWAAHQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AOVBTRZEI5KJUIAF3NT5T2TTYQQ23A5CNFSM5ATWAAH2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4OD35RVQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/strace/strace/issues/189",
"url": "https://github.com/strace/strace/issues/189",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>