]> granicus.if.org Git - strace/blobdiff - signal.c
Robustify mpers.awk against invalid input
[strace] / signal.c
index e0f2a70baee34f17e07368846d62fe1f7b89b091..ec1684ef82ecd6623982ad584c6076e470555519 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -673,7 +673,16 @@ SYS_FUNC(rt_sigtimedwait)
                /* syscall exit, and u_arg[1] was NULL */
                return 0;
        }
+
+       /*
+        * Since the timeout parameter is read by the kernel
+        * on entering syscall, it has to be decoded the same way
+        * whether the syscall has failed or not.
+        */
+       temporarily_clear_syserror(tcp);
        print_timespec(tcp, tcp->u_arg[2]);
+       restore_cleared_syserror(tcp);
+
        tprintf(", %lu", tcp->u_arg[3]);
        return 0;
 };
@@ -685,29 +694,3 @@ SYS_FUNC(restart_syscall)
 
        return RVAL_DECODED;
 }
-
-static int
-do_signalfd(struct tcb *tcp, int flags_arg)
-{
-       /* NB: kernel requires arg[2] == NSIG / 8 */
-       printfd(tcp, tcp->u_arg[0]);
-       tprints(", ");
-       print_sigset_addr_len(tcp, tcp->u_arg[1], tcp->u_arg[2]);
-       tprintf(", %lu", tcp->u_arg[2]);
-       if (flags_arg >= 0) {
-               tprints(", ");
-               printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
-       }
-
-       return RVAL_DECODED;
-}
-
-SYS_FUNC(signalfd)
-{
-       return do_signalfd(tcp, -1);
-}
-
-SYS_FUNC(signalfd4)
-{
-       return do_signalfd(tcp, 3);
-}