From: Dmitry V. Levin Date: Mon, 16 May 2016 22:19:31 +0000 (+0000) Subject: Fix decoding of prctl/arch_prctl operation argument X-Git-Tag: v4.12~143 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b8eec608faee56727da2d4b81317064a0f6851f3;p=strace Fix decoding of prctl/arch_prctl operation argument 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. --- diff --git a/prctl.c b/prctl.c index a0b4e96c..29e00b09 100644 --- 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))