Implement proper decoding of rt_sigreturn syscall

* 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.
This commit is contained in:
Дмитрий Левин 2017-03-12 22:01:09 +00:00
parent c57cf9acf5
commit 31601155c4
11 changed files with 67 additions and 9 deletions

View File

@ -210,6 +210,7 @@ strace_SOURCES = \
renameat.c \
resource.c \
rt_sigframe.c \
rt_sigreturn.c \
rtc.c \
sched.c \
sched_attr.h \

4
NEWS
View File

@ -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.

View File

@ -137,7 +137,7 @@
[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" },

View File

@ -113,7 +113,6 @@
#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

View File

@ -175,7 +175,7 @@
[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" },

View File

@ -198,7 +198,7 @@
[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" },

View File

@ -201,7 +201,7 @@
[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" },

View File

@ -190,7 +190,7 @@
[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" },

View 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" },
@ -336,7 +336,7 @@
* 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" },

View 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" },

54
rt_sigreturn.c Normal file
View File

@ -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;
}