From: Eugene Syromyatnikov Date: Tue, 6 Dec 2016 19:14:48 +0000 (+0300) Subject: prctl: implement decoding of SUID_DUMP_* constants in PR_[GS]ET_DUMPABLE X-Git-Tag: v4.16~353 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ea01cb0e5be9c5584279b0e315aa95c683801296;p=strace prctl: implement decoding of SUID_DUMP_* constants in PR_[GS]ET_DUMPABLE * 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. --- diff --git a/prctl.c b/prctl.c index 32b79d78..bc15df81 100644 --- 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 index 00000000..0334b0b9 --- /dev/null +++ b/xlat/pr_dumpable.in @@ -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 */