]> granicus.if.org Git - strace/commitdiff
prctl: implement decoding of SUID_DUMP_* constants in PR_[GS]ET_DUMPABLE
authorEugene Syromyatnikov <evgsyr@gmail.com>
Tue, 6 Dec 2016 19:14:48 +0000 (22:14 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 17 Dec 2016 11:40:03 +0000 (11:40 +0000)
* xlat/pr_dumpable.in: New file.
* prctl.c: Include "xlat/pr_dumpable.h".
(SYS_FUNC(prctl)): Decode returned value of PR_GET_DUMPABLE operation
and the second syscall argument of PR_SET_DUMPABLE operation
as SUID_DUMP_* constants.

prctl.c
xlat/pr_dumpable.in [new file with mode: 0644]

diff --git a/prctl.c b/prctl.c
index 32b79d780311d4d9e3ba07ed4a25bd99e2bd3ac8..bc15df810e6f7671646e370a0478e3137e984c2e 100644 (file)
--- a/prctl.c
+++ b/prctl.c
@@ -34,6 +34,7 @@
 
 #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"
@@ -91,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:
@@ -108,6 +108,14 @@ SYS_FUNC(prctl)
                        printnum_int(tcp, arg2, "%u");
                break;
 
+       case PR_GET_DUMPABLE:
+               if (entering(tcp))
+                       break;
+               if (syserror(tcp))
+                       return 0;
+               tcp->auxstr = xlookup(pr_dumpable, (unsigned long) tcp->u_rval);
+               return RVAL_STR;
+
        case PR_GET_NAME:
                if (entering(tcp)) {
                        tprints(", ");
@@ -181,7 +189,6 @@ SYS_FUNC(prctl)
                return RVAL_DECODED;
 
        case PR_SET_CHILD_SUBREAPER:
-       case PR_SET_DUMPABLE:
        case PR_SET_ENDIAN:
        case PR_SET_FPEMU:
        case PR_SET_FPEXC:
@@ -190,6 +197,11 @@ SYS_FUNC(prctl)
                tprintf(", %llu", arg2);
                return RVAL_DECODED;
 
+       case PR_SET_DUMPABLE:
+               tprints(", ");
+               printxval64(pr_dumpable, arg2, "SUID_DUMP_???");
+               return RVAL_DECODED;
+
        case PR_CAPBSET_DROP:
        case PR_CAPBSET_READ:
                tprints(", ");
diff --git a/xlat/pr_dumpable.in b/xlat/pr_dumpable.in
new file mode 100644 (file)
index 0000000..0334b0b
--- /dev/null
@@ -0,0 +1,4 @@
+/* Defined in include/linux/sched.h */
+SUID_DUMP_DISABLE      0       /* No setuid dumping */
+SUID_DUMP_USER         1       /* Dump as user of process */
+SUID_DUMP_ROOT         2       /* Dump as root */