]> granicus.if.org Git - strace/commitdiff
Implement proper decoding of rt_sigreturn syscall
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 12 Mar 2017 22:01:09 +0000 (22:01 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 13 Mar 2017 15:22:50 +0000 (15:22 +0000)
* rt_sigreturn.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_rt_sigreturn): Remove.
* linux/64/syscallent.h (rt_sigreturn): Change sys_func to rt_sigreturn.
* linux/hppa/syscallent.h (rt_sigreturn): Likewise.
* linux/ia64/syscallent.h (rt_sigreturn): Likewise.
* linux/s390/syscallent.h (rt_sigreturn): Likewise.
* linux/s390x/syscallent.h (rt_sigreturn): Likewise.
* linux/x86_64/syscallent.h (rt_sigreturn): Likewise.
* linux/x32/syscallent.h (rt_sigreturn, 64:rt_sigreturn): Likewise.
* NEWS: Mention this change.

Makefile.am
NEWS
linux/64/syscallent.h
linux/dummy.h
linux/hppa/syscallent.h
linux/ia64/syscallent.h
linux/s390/syscallent.h
linux/s390x/syscallent.h
linux/x32/syscallent.h
linux/x86_64/syscallent.h
rt_sigreturn.c [new file with mode: 0644]

index 31682d4d8c3b212603f9c1d12e2b1d879a882e58..e5a9447460537753275ccc4386e59c63fa9d9c0e 100644 (file)
@@ -210,6 +210,7 @@ strace_SOURCES =    \
        renameat.c      \
        resource.c      \
        rt_sigframe.c   \
+       rt_sigreturn.c  \
        rtc.c           \
        sched.c         \
        sched_attr.h    \
diff --git a/NEWS b/NEWS
index 77b667822b6c873d547d703b96fdf5c76648e806..2a701c2ada69b5dd0e5a698434838c12f8b94229 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,10 @@ Noteworthy changes in release ?.?? (????-??-??)
 * Improvements
   * Enhanced decoding of sched_setattr syscall.
   * Added -e trace=%sched option for tracing sched_* syscalls.
+  * Implemented decoding of signal mask in rt_sigreturn syscall on alpha, arc,
+    arm, avr32, bfin, cris, hppa, m68k, metag, microblaze, mips, nios2, or1k,
+    powerpc, powerpc64, riscv, sh, sh64, sparc, sparc64, tile, x86, and xtensa
+    architectures.
 
 * Bug fixes
   * Fixed decoding of flags argument of preadv2 and pwritev2 syscalls on x32.
index a705eae9dd46a2550e0de08571729f72980cd4da..b5a09d4f111f493fe32808b1d5fa3a29c32de8ae 100644 (file)
 [136] = { 2,   TS,             SEN(rt_sigpending),             "rt_sigpending"         },
 [137] = { 4,   TS,             SEN(rt_sigtimedwait),           "rt_sigtimedwait"       },
 [138] = { 3,   TS,             SEN(rt_sigqueueinfo),           "rt_sigqueueinfo"       },
-[139] = { 0,   TS,             SEN(sigreturn),                 "rt_sigreturn"          },
+[139] = { 0,   TS,             SEN(rt_sigreturn),              "rt_sigreturn"          },
 [140] = { 3,   0,              SEN(setpriority),               "setpriority"           },
 [141] = { 2,   0,              SEN(getpriority),               "getpriority"           },
 [142] = { 4,   0,              SEN(reboot),                    "reboot"                },
index 2758cfb2978bd2b0a1a9d6c4400ca2d8c088df73..06fd3695de27c312c4a414b21be202f021cd1609 100644 (file)
 #define        sys_munlockall          printargs
 #define        sys_pause               printargs
 #define        sys_printargs           printargs
-#define        sys_rt_sigreturn        printargs
 #define        sys_sched_yield         printargs
 #define        sys_setsid              printargs
 #define        sys_set_tid_address     printargs
index 647a2dc59275bb36b61a5730143ebf754639481c..f59ea57145a6ec03955de210b1c18e51148e3de7 100644 (file)
 [170] = { 3,   0,              SEN(setresgid),                 "setresgid"             },
 [171] = { 3,   0,              SEN(getresgid),                 "getresgid"             },
 [172] = { 5,   0,              SEN(prctl),                     "prctl"                 },
-[173] = { 0,   TS,             SEN(sigreturn),                 "rt_sigreturn"          },
+[173] = { 0,   TS,             SEN(rt_sigreturn),              "rt_sigreturn"          },
 [174] = { 4,   TS,             SEN(rt_sigaction),              "rt_sigaction"          },
 [175] = { 4,   TS,             SEN(rt_sigprocmask),            "rt_sigprocmask"        },
 [176] = { 2,   TS,             SEN(rt_sigpending),             "rt_sigpending"         },
index 895e7aecee2bbbbbaa363574f566c1df1e98010f..47b71d6ade56add0d157b39d56eaf94a68873a68 100644 (file)
 [1178] = { 2,  TS,             SEN(rt_sigpending),             "rt_sigpending"         },
 [1179] = { 4,  TS,             SEN(rt_sigprocmask),            "rt_sigprocmask"        },
 [1180] = { 3,  TS,             SEN(rt_sigqueueinfo),           "rt_sigqueueinfo"       },
-[1181] = { 0,  TS,             SEN(sigreturn),                 "rt_sigreturn"          },
+[1181] = { 0,  TS,             SEN(rt_sigreturn),              "rt_sigreturn"          },
 [1182] = { 2,  TS,             SEN(rt_sigsuspend),             "rt_sigsuspend"         },
 [1183] = { 4,  TS,             SEN(rt_sigtimedwait),           "rt_sigtimedwait"       },
 [1184] = { 2,  TF,             SEN(getcwd),                    "getcwd"                },
index c04353cce6347a9a99b3f92fd0cc96d384be902b..105e511e56811dc1025ef94c82b8f5d6b270f7fe 100644 (file)
 [170] = { 3,   0,              SEN(setresgid16),               "setresgid"             },
 [171] = { 3,   0,              SEN(getresgid16),               "getresgid"             },
 [172] = { 5,   0,              SEN(prctl),                     "prctl"                 },
-[173] = { 0,   TS,             SEN(sigreturn),                 "rt_sigreturn"          },
+[173] = { 0,   TS,             SEN(rt_sigreturn),              "rt_sigreturn"          },
 [174] = { 4,   TS,             SEN(rt_sigaction),              "rt_sigaction"          },
 [175] = { 4,   TS,             SEN(rt_sigprocmask),            "rt_sigprocmask"        },
 [176] = { 2,   TS,             SEN(rt_sigpending),             "rt_sigpending"         },
index ab8a5d8644c7fb62fabde54ec8d0e9dcb96b3f94..d5b54590011f0e250f6129c7073abebd12f384c0 100644 (file)
 [169] = { 3,   0,              SEN(nfsservctl),                "nfsservctl"            },
 [170 ... 171] = { },
 [172] = { 5,   0,              SEN(prctl),                     "prctl"                 },
-[173] = { 0,   TS,             SEN(sigreturn),                 "rt_sigreturn"          },
+[173] = { 0,   TS,             SEN(rt_sigreturn),              "rt_sigreturn"          },
 [174] = { 4,   TS,             SEN(rt_sigaction),              "rt_sigaction"          },
 [175] = { 4,   TS,             SEN(rt_sigprocmask),            "rt_sigprocmask"        },
 [176] = { 2,   TS,             SEN(rt_sigpending),             "rt_sigpending"         },
index 2699bc0416f3bfd84ca621f6286d1807fa4bb47b..30a684a858c790e210b2d783fc0b1d25487da7e6 100644 (file)
@@ -13,7 +13,7 @@
 [ 12] = { 1,   TM|SI,          SEN(brk),                       "brk"                   },
 [ 13] = { 4,   TS,             SEN(printargs),                 "64:rt_sigaction"       },
 [ 14] = { 4,   TS,             SEN(rt_sigprocmask),            "rt_sigprocmask"        },
-[ 15] = { 0,   TS,             SEN(printargs),                 "64:rt_sigreturn"       },
+[ 15] = { 0,   TS,             SEN(rt_sigreturn),              "64:rt_sigreturn"       },
 [ 16] = { 3,   TD,             SEN(printargs),                 "64:ioctl"              },
 [ 17] = { 4,   TD,             SEN(pread),                     "pread64"               },
 [ 18] = { 4,   TD,             SEN(pwrite),                    "pwrite64"              },
  * for native 64-bit operation.
  */
 [512] = { 4,   CST|TS,         SEN(rt_sigaction),              "rt_sigaction"          },
-[513] = { 0,   CST|TS,         SEN(sigreturn),                 "rt_sigreturn"          },
+[513] = { 0,   CST|TS,         SEN(rt_sigreturn),              "rt_sigreturn"          },
 [514] = { 3,   CST|TD,         SEN(ioctl),                     "ioctl"                 },
 [515] = { 3,   CST|TD,         SEN(readv),                     "readv"                 },
 [516] = { 3,   CST|TD,         SEN(writev),                    "writev"                },
index a1a268ecbb30f6ff43adc0e3dbbc8d6730e43b09..62960d21991bb62902517a049cf528220790ecd8 100644 (file)
@@ -13,7 +13,7 @@
 [ 12] = { 1,   TM|SI,          SEN(brk),                       "brk"                   },
 [ 13] = { 4,   TS,             SEN(rt_sigaction),              "rt_sigaction"          },
 [ 14] = { 4,   TS,             SEN(rt_sigprocmask),            "rt_sigprocmask"        },
-[ 15] = { 0,   TS,             SEN(sigreturn),                 "rt_sigreturn"          },
+[ 15] = { 0,   TS,             SEN(rt_sigreturn),              "rt_sigreturn"          },
 [ 16] = { 3,   TD,             SEN(ioctl),                     "ioctl"                 },
 [ 17] = { 4,   TD,             SEN(pread),                     "pread64"               },
 [ 18] = { 4,   TD,             SEN(pwrite),                    "pwrite64"              },
diff --git a/rt_sigreturn.c b/rt_sigreturn.c
new file mode 100644 (file)
index 0000000..af705c3
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+
+#include DEF_MPERS_TYPE(struct_rt_sigframe)
+
+#include "rt_sigframe.h"
+
+#include MPERS_DEFS
+
+#ifndef OFFSETOF_SIGMASK_IN_RT_SIGFRAME
+# define OFFSETOF_SIGMASK_IN_RT_SIGFRAME       \
+               offsetof(struct_rt_sigframe, uc.uc_sigmask)
+#endif
+
+SYS_FUNC(rt_sigreturn)
+{
+       const kernel_ulong_t sf_addr = get_rt_sigframe_addr(tcp);
+
+       if (sf_addr) {
+               const kernel_ulong_t sm_addr =
+                       sf_addr + OFFSETOF_SIGMASK_IN_RT_SIGFRAME;
+               tprints("{mask=");
+               print_sigset_addr(tcp, sm_addr);
+               tprints("}");
+       }
+
+       return RVAL_DECODED;
+}