]> granicus.if.org Git - strace/commitdiff
Fix decoding of prctl/arch_prctl operation argument
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 16 May 2016 22:19:31 +0000 (22:19 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 16 May 2016 22:41:20 +0000 (22:41 +0000)
Consistently treat operation argument of prctl/arch_prctl syscalls
as int to match the kernel behaviour.

* prctl.c (SYS_FUNC(prctl), SYS_FUNC(arch_prctl)): Assign 1st argument
of syscalls to a variable of type unsigned int and use it in all
subsequent checks and lookups.

prctl.c

diff --git a/prctl.c b/prctl.c
index a0b4e96cd8f4cd784336697778535124bcf5ddea..29e00b097bd69f77285bc581fed0c74be545ade5 100644 (file)
--- a/prctl.c
+++ b/prctl.c
@@ -73,12 +73,13 @@ print_prctl_args(struct tcb *tcp, const unsigned int first)
 
 SYS_FUNC(prctl)
 {
+       const unsigned int option = tcp->u_arg[0];
        unsigned int i;
 
        if (entering(tcp))
-               printxval(prctl_options, tcp->u_arg[0], "PR_???");
+               printxval(prctl_options, option, "PR_???");
 
-       switch (tcp->u_arg[0]) {
+       switch (option) {
        case PR_GET_DUMPABLE:
        case PR_GET_KEEPCAPS:
        case PR_GET_SECCOMP:
@@ -314,10 +315,12 @@ SYS_FUNC(prctl)
 
 SYS_FUNC(arch_prctl)
 {
+       const unsigned int option = tcp->u_arg[0];
+
        if (entering(tcp))
-               printxval(archvals, tcp->u_arg[0], "ARCH_???");
+               printxval(archvals, option, "ARCH_???");
 
-       switch (tcp->u_arg[0]) {
+       switch (option) {
        case ARCH_GET_GS:
        case ARCH_GET_FS:
                if (entering(tcp))