]> granicus.if.org Git - strace/blobdiff - prctl.c
Remove HAVE_STRUCT_TCB_EXT_ARG, ext_arg, and u_lrval
[strace] / prctl.c
diff --git a/prctl.c b/prctl.c
index e8dd4e819f2664ca8c834c26b96d2b1f8ad6b006..dede4c9dc32f5ef2b984dda5273b9adb19f85b14 100644 (file)
--- a/prctl.c
+++ b/prctl.c
@@ -34,6 +34,8 @@
 
 #include "xlat/prctl_options.h"
 #include "xlat/pr_cap_ambient.h"
+#include "xlat/pr_dumpable.h"
+#include "xlat/pr_fp_mode.h"
 #include "xlat/pr_mce_kill.h"
 #include "xlat/pr_mce_kill_policy.h"
 #include "xlat/pr_set_mm.h"
@@ -68,21 +70,21 @@ print_prctl_args(struct tcb *tcp, const unsigned int first)
        unsigned int i;
 
        for (i = first; i < tcp->s_ent->nargs; ++i)
-               tprintf(", %#llx", getarg_ull(tcp, i));
+               tprintf(", %#" PRI_klx, tcp->u_arg[i]);
 }
 
 SYS_FUNC(prctl)
 {
        const unsigned int option = tcp->u_arg[0];
-       const unsigned long long arg2 = getarg_ull(tcp, 1);
-       const unsigned long long arg3 = getarg_ull(tcp, 2);
+       const kernel_ulong_t arg2 = tcp->u_arg[1];
+       const kernel_ulong_t arg3 = tcp->u_arg[2];
        /*
         * PR_SET_VMA is the only command which actually uses these arguments
         * currently, and it is available only on Android for now.
         */
 #ifdef __ANDROID__
-       const unsigned long long arg4 = getarg_ull(tcp, 3);
-       const unsigned long long arg5 = getarg_ull(tcp, 4);
+       const kernel_ulong_t arg4 = tcp->u_arg[3];
+       const kernel_ulong_t arg5 = tcp->u_arg[4];
 #endif
        unsigned int i;
 
@@ -90,7 +92,6 @@ SYS_FUNC(prctl)
                printxval(prctl_options, option, "PR_???");
 
        switch (option) {
-       case PR_GET_DUMPABLE:
        case PR_GET_KEEPCAPS:
        case PR_GET_SECCOMP:
        case PR_GET_TIMERSLACK:
@@ -107,10 +108,18 @@ SYS_FUNC(prctl)
                        printnum_int(tcp, arg2, "%u");
                break;
 
-       case PR_GET_NAME:
+       case PR_GET_DUMPABLE:
                if (entering(tcp))
+                       break;
+               if (syserror(tcp))
+                       return 0;
+               tcp->auxstr = xlookup(pr_dumpable, (kernel_ulong_t) tcp->u_rval);
+               return RVAL_STR;
+
+       case PR_GET_NAME:
+               if (entering(tcp)) {
                        tprints(", ");
-               else {
+               else {
                        if (syserror(tcp))
                                printaddr(arg2);
                        else
@@ -120,9 +129,9 @@ SYS_FUNC(prctl)
                break;
 
        case PR_GET_PDEATHSIG:
-               if (entering(tcp))
+               if (entering(tcp)) {
                        tprints(", ");
-               else if (!umove_or_printaddr(tcp, arg2, &i)) {
+               else if (!umove_or_printaddr(tcp, arg2, &i)) {
                        tprints("[");
                        tprints(signame(i));
                        tprints("]");
@@ -135,7 +144,7 @@ SYS_FUNC(prctl)
                if (syserror(tcp) || tcp->u_rval == 0)
                        return 0;
                tcp->auxstr = sprintflags("", secbits,
-                                         (unsigned long) tcp->u_rval);
+                                         (kernel_ulong_t) tcp->u_rval);
                return RVAL_STR;
 
        case PR_GET_TID_ADDRESS:
@@ -146,9 +155,9 @@ SYS_FUNC(prctl)
                break;
 
        case PR_GET_TSC:
-               if (entering(tcp))
+               if (entering(tcp)) {
                        tprints(", ");
-               else if (!umove_or_printaddr(tcp, arg2, &i)) {
+               else if (!umove_or_printaddr(tcp, arg2, &i)) {
                        tprints("[");
                        printxval(pr_tsc, i, "PR_TSC_???");
                        tprints("]");
@@ -156,28 +165,41 @@ SYS_FUNC(prctl)
                break;
 
        case PR_GET_UNALIGN:
-               if (entering(tcp))
+               if (entering(tcp)) {
                        tprints(", ");
-               else if (!umove_or_printaddr(tcp, arg2, &i)) {
+               else if (!umove_or_printaddr(tcp, arg2, &i)) {
                        tprints("[");
                        printflags(pr_unalign_flags, i, "PR_UNALIGN_???");
                        tprints("]");
                }
                break;
 
+       case PR_GET_FP_MODE:
+               if (entering(tcp))
+                       break;
+               if (syserror(tcp) || tcp->u_rval == 0)
+                       return 0;
+               tcp->auxstr = sprintflags("", pr_fp_mode,
+                                         (kernel_ulong_t) tcp->u_rval);
+               return RVAL_STR;
+
        /* PR_TASK_PERF_EVENTS_* take no arguments. */
        case PR_TASK_PERF_EVENTS_DISABLE:
        case PR_TASK_PERF_EVENTS_ENABLE:
                return RVAL_DECODED;
 
        case PR_SET_CHILD_SUBREAPER:
-       case PR_SET_DUMPABLE:
        case PR_SET_ENDIAN:
        case PR_SET_FPEMU:
        case PR_SET_FPEXC:
        case PR_SET_KEEPCAPS:
        case PR_SET_TIMING:
-               tprintf(", %llu", arg2);
+               tprintf(", %" PRI_klu, arg2);
+               return RVAL_DECODED;
+
+       case PR_SET_DUMPABLE:
+               tprints(", ");
+               printxval64(pr_dumpable, arg2, "SUID_DUMP_???");
                return RVAL_DECODED;
 
        case PR_CAPBSET_DROP:
@@ -212,7 +234,7 @@ SYS_FUNC(prctl)
                        printxval64(pr_mce_kill_policy, arg3,
                                    "PR_MCE_KILL_???");
                else
-                       tprintf("%#llx", arg3);
+                       tprintf("%#" PRI_klx, arg3);
                print_prctl_args(tcp, 3);
                return RVAL_DECODED;
 
@@ -228,9 +250,9 @@ SYS_FUNC(prctl)
 # endif
        case PR_SET_VMA:
                if (arg2 == PR_SET_VMA_ANON_NAME) {
-                       tprintf(", PR_SET_VMA_ANON_NAME, %#llx", arg3);
-                       tprintf(", %llu, ", arg4);
-                       printstr(tcp, arg5, -1);
+                       tprintf(", PR_SET_VMA_ANON_NAME, %#" PRI_klx, arg3);
+                       tprintf(", %" PRI_klu ", ", arg4);
+                       printstr(tcp, arg5);
                } else {
                        /* There are no other sub-options now, but there
                         * might be in future... */
@@ -248,17 +270,17 @@ SYS_FUNC(prctl)
        case PR_SET_PDEATHSIG:
                tprints(", ");
                if (arg2 > 128)
-                       tprintf("%llu", arg2);
+                       tprintf("%" PRI_klu, arg2);
                else
                        tprints(signame(arg2));
                return RVAL_DECODED;
 
        case PR_SET_PTRACER:
                tprints(", ");
-               if (arg2 == -1)
+               if ((int) arg2 == -1)
                        tprints("PR_SET_PTRACER_ANY");
                else
-                       tprintf("%llu", arg2);
+                       tprintf("%" PRI_klu, arg2);
                return RVAL_DECODED;
 
        case PR_SET_SECCOMP:
@@ -281,7 +303,7 @@ SYS_FUNC(prctl)
                return RVAL_DECODED;
 
        case PR_SET_TIMERSLACK:
-               tprintf(", %lld", arg2);
+               tprintf(", %" PRI_kld, arg2);
                return RVAL_DECODED;
 
        case PR_SET_TSC:
@@ -296,7 +318,7 @@ SYS_FUNC(prctl)
 
        case PR_SET_NO_NEW_PRIVS:
        case PR_SET_THP_DISABLE:
-               tprintf(", %llu", arg2);
+               tprintf(", %" PRI_klu, arg2);
                print_prctl_args(tcp, 2);
                return RVAL_DECODED;
 
@@ -308,9 +330,14 @@ SYS_FUNC(prctl)
                if (syserror(tcp))
                        return 0;
                tcp->auxstr = xlookup(pr_mce_kill_policy,
-                                     (unsigned long) tcp->u_rval);
+                                     (kernel_ulong_t) tcp->u_rval);
                return tcp->auxstr ? RVAL_STR : RVAL_UDECIMAL;
 
+       case PR_SET_FP_MODE:
+               tprints(", ");
+               printflags(pr_fp_mode, arg2, "PR_FP_MODE_???");
+               return RVAL_DECODED;
+
        case PR_GET_NO_NEW_PRIVS:
        case PR_GET_THP_DISABLE:
        case PR_MPX_DISABLE_MANAGEMENT:
@@ -329,7 +356,7 @@ SYS_FUNC(prctl)
 SYS_FUNC(arch_prctl)
 {
        const unsigned int option = tcp->u_arg[0];
-       const unsigned long long addr = getarg_ull(tcp, 1);
+       const kernel_ulong_t addr = tcp->u_arg[1];
 
        if (entering(tcp))
                printxval(archvals, option, "ARCH_???");
@@ -344,7 +371,7 @@ SYS_FUNC(arch_prctl)
                return 0;
        }
 
-       tprintf(", %#llx", addr);
+       tprintf(", %#" PRI_klx, addr);
        return RVAL_DECODED;
 }
 #endif /* X86_64 || X32 */