Android kernels have an extra prctl that lets us set a name for an
anonymous VMA, which is useful for debugging. at the moment strace
shows it like this:

prctl(0x53564d41 /* PR_??? */, 0, 0x7f7ab0e000, 0x2000, 0x7f7aaf76d0) = 0
prctl(0x53564d41 /* PR_??? */, 0, 0x7f7ab0d000, 0x1000, 0x7f7aaf76e8) = 0

with this patch:

diff --git a/prctl.c b/prctl.c
index 4a6bd25..e43569c 100644
--- a/prctl.c
+++ b/prctl.c
@@ -94,6 +94,22 @@ prctl_enter(struct tcb *tcp)
                printstr(tcp, tcp->u_arg[1], TASK_COMM_LEN);
                break;

+#define PR_SET_VMA   0x53564d41
+#define PR_SET_VMA_ANON_NAME    0
+       case PR_SET_VMA:
+               if (tcp->u_arg[1] == PR_SET_VMA_ANON_NAME) {
+                       tprintf(", %lu", tcp->u_arg[1]);
+                       tprintf(", %#lx", tcp->u_arg[2]);
+                       tprintf(", %lu, ", tcp->u_arg[3]);
+                       printstr(tcp, tcp->u_arg[4], -1);
+               } else {
+                       // There are no other sub-options now, but there
+                       // might be in future...
+                       for (i = 1; i < tcp->s_ent->nargs; i++)
+                               tprintf(", %#lx", tcp->u_arg[i]);
+               }
+               break;
+
        case PR_SET_MM:
                tprints(", ");
                printxval(pr_set_mm, tcp->u_arg[1], "PR_SET_MM_???");

we get this instead:

prctl(0x53564d41 /* PR_??? */, 0, 0x7f7ffe0000, 8192, "thread signal stack") = 0
prctl(0x53564d41 /* PR_??? */, 0, 0x7f7ffdf000, 4096, "thread signal
stack guard page") = 0

obviously i could change the xlat prctl_options.in file to add
PR_SET_VMA, but this isn't in upstream kernels so that seems wrong.

i can easily keep the patch above and/or the one that touches the xlat
file in our tree, but i thought i'd ask what -- if anything -- of this
you'd be interested in having in upstream strace.

-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.

------------------------------------------------------------------------------
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to