* Bug fixes
* Fixed decoding of flags argument of preadv2 and pwritev2 syscalls on x32.
* Fixed the number of arguments and tracing flags of alpha specific syscalls.
+ * Fixed decoding of old sigsuspend syscall on alpha, cris, mips, powerpc,
+ powerpc64, sh, sh64, sparc, and sparc64.
* Fixed decoding of netlink messages received within struct msghdr.
* Worked around a bug in miscompiled aarch64 kernels leading to the 3rd
argument of sched_getattr syscall being not quite 32-bit.
[108] = { 5, 0, SEN(printargs), "osf_old_sigvec" }, /* not implemented */
[109] = { 5, 0, SEN(printargs), "osf_old_sigblock" }, /* not implemented */
[110] = { 5, 0, SEN(printargs), "osf_old_sigsetmask" }, /* not implemented */
-[111] = { 3, TS, SEN(sigsuspend), "sigsuspend" },
+[111] = { 1, TS, SEN(sigsuspend), "sigsuspend" },
[112] = { 2, 0, SEN(printargs), "osf_sigstack" },
[113] = { 3, TN, SEN(recvmsg), "recvmsg" },
[114] = { 3, TN, SEN(sendmsg), "sendmsg" },
[ 69] = { 1, TS, SEN(sigsetmask), "ssetmask" },
[ 70] = { 2, 0, SEN(setreuid16), "setreuid" },
[ 71] = { 2, 0, SEN(setregid16), "setregid" },
-[ 72] = { 3, TS, SEN(sigsuspend), "sigsuspend" },
+[ 72] = { 1, TS, SEN(sigsuspend), "sigsuspend" },
[ 73] = { 1, TS, SEN(sigpending), "sigpending" },
[ 74] = { 2, 0, SEN(sethostname), "sethostname" },
[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" },
[4069] = { 1, TS, SEN(sigsetmask), "ssetmask" },
[4070] = { 2, 0, SEN(setreuid), "setreuid" },
[4071] = { 2, 0, SEN(setregid), "setregid" },
-[4072] = { 3, TS, SEN(sigsuspend), "sigsuspend" },
+[4072] = { 1, TS, SEN(sigsuspend), "sigsuspend" },
[4073] = { 1, TS, SEN(sigpending), "sigpending" },
[4074] = { 2, 0, SEN(sethostname), "sethostname" },
[4075] = { 2, 0, SEN(setrlimit), "setrlimit" },
[ 69] = { 1, TS, SEN(sigsetmask), "ssetmask" },
[ 70] = { 2, 0, SEN(setreuid), "setreuid" },
[ 71] = { 2, 0, SEN(setregid), "setregid" },
-[ 72] = { 3, TS, SEN(sigsuspend), "sigsuspend" },
+[ 72] = { 1, TS, SEN(sigsuspend), "sigsuspend" },
[ 73] = { 1, TS, SEN(sigpending), "sigpending" },
[ 74] = { 2, 0, SEN(sethostname), "sethostname" },
[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" },
[ 69] = { 1, TS, SEN(sigsetmask), "ssetmask" },
[ 70] = { 2, 0, SEN(setreuid), "setreuid" },
[ 71] = { 2, 0, SEN(setregid), "setregid" },
-[ 72] = { 3, TS, SEN(sigsuspend), "sigsuspend" },
+[ 72] = { 1, TS, SEN(sigsuspend), "sigsuspend" },
[ 73] = { 1, TS, SEN(sigpending), "sigpending" },
[ 74] = { 2, 0, SEN(sethostname), "sethostname" },
[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" },
[ 69] = { 1, TS, SEN(sigsetmask), "ssetmask" },
[ 70] = { 2, 0, SEN(setreuid16), "setreuid" },
[ 71] = { 2, 0, SEN(setregid16), "setregid" },
-[ 72] = { 3, TS, SEN(sigsuspend), "sigsuspend" },
+[ 72] = { 1, TS, SEN(sigsuspend), "sigsuspend" },
[ 73] = { 1, TS, SEN(sigpending), "sigpending" },
[ 74] = { 2, 0, SEN(sethostname), "sethostname" },
[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" },
[ 69] = { 1, TS, SEN(sigsetmask), "ssetmask" },
[ 70] = { 2, 0, SEN(setreuid16), "setreuid" },
[ 71] = { 2, 0, SEN(setregid16), "setregid" },
-[ 72] = { 3, TS, SEN(sigsuspend), "sigsuspend" },
+[ 72] = { 1, TS, SEN(sigsuspend), "sigsuspend" },
[ 73] = { 1, TS, SEN(sigpending), "sigpending" },
[ 74] = { 2, 0, SEN(sethostname), "sethostname" },
[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" },
[198] = { 3, TS, SEN(sigaction), "sigaction" },
[199] = { 0, TS, SEN(siggetmask), "sgetmask" },
[200] = { 1, TS, SEN(sigsetmask), "ssetmask" },
-[201] = { 3, TS, SEN(sigsuspend), "sigsuspend" },
+[201] = { 1, TS, SEN(sigsuspend), "sigsuspend" },
[202] = { 2, TF|TLST|TSTA, SEN(lstat), "oldlstat" },
[203] = { 1, TF, SEN(uselib), "uselib" },
[204] = { 3, TD, SEN(readdir), "readdir" },
[198] = { 3, TS, SEN(sigaction), "sigaction" },
[199] = { 0, TS, SEN(siggetmask), "sgetmask" },
[200] = { 1, TS, SEN(sigsetmask), "ssetmask" },
-[201] = { 3, TS, SEN(sigsuspend), "sigsuspend" },
+[201] = { 1, TS, SEN(sigsuspend), "sigsuspend" },
[202] = { 2, TF|TLST|TSTA, SEN(lstat), "oldlstat" },
[203] = { 1, TF, SEN(uselib), "uselib" },
[204] = { 3, TD, SEN(readdir), "readdir" },
SYS_FUNC(sigsuspend)
{
- tprintsigmask_val("", tcp->u_arg[2]);
+#ifdef MIPS
+ print_sigset_addr_len(tcp, tcp->u_arg[tcp->s_ent->nargs - 1],
+ current_wordsize);
+#else
+ tprintsigmask_val("", tcp->u_arg[tcp->s_ent->nargs - 1]);
+#endif
return RVAL_DECODED;
}
signal_receive
signalfd4
sigreturn
+sigsuspend
sleep
socketcall
splice
signal_receive -a16 -e trace=kill
signalfd4
sigreturn -esignal='!USR1'
+sigsuspend -a19 -esignal=none
socketcall -a20
splice
stat -a32 -v -P stat.sample -P /dev/full
siginfo
signalfd4
sigreturn
+sigsuspend
socketcall
splice
stat
--- /dev/null
+/*
+ * Check decoding of sigsuspend syscall.
+ *
+ * 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 "tests.h"
+#include <asm/unistd.h>
+
+#ifdef __NR_sigsuspend
+
+# include <assert.h>
+# include <errno.h>
+# include <signal.h>
+# include <stdio.h>
+# include <stdint.h>
+# include <string.h>
+# include <unistd.h>
+
+# ifdef MIPS
+# define SIGNAL_MASK_BY_REF 1
+# else
+# define SIGNAL_MASK_BY_REF 0
+# endif
+
+static long
+k_sigsuspend(const kernel_ulong_t arg1,
+ const kernel_ulong_t arg2,
+ const kernel_ulong_t arg3)
+{
+ return syscall(__NR_sigsuspend, arg1, arg2, arg3);
+}
+
+static int signo;
+
+static void
+handler(int i)
+{
+ signo = i;
+}
+
+int
+main(void)
+{
+ union {
+ sigset_t libc_mask;
+ unsigned long old_mask;
+ } u;
+ unsigned long mask1, mask2;
+
+ sigemptyset(&u.libc_mask);
+ sigaddset(&u.libc_mask, SIGUSR1);
+ mask1 = u.old_mask;
+
+ sigemptyset(&u.libc_mask);
+ sigaddset(&u.libc_mask, SIGUSR2);
+ mask2 = u.old_mask;
+
+ sigaddset(&u.libc_mask, SIGUSR1);
+ if (sigprocmask(SIG_SETMASK, &u.libc_mask, NULL))
+ perror_msg_and_fail("sigprocmask");
+
+ const struct sigaction sa = { .sa_handler = handler };
+ if (sigaction(SIGUSR1, &sa, NULL) || sigaction(SIGUSR2, &sa, NULL))
+ perror_msg_and_fail("sigaction");
+
+ raise(SIGUSR1);
+ raise(SIGUSR2);
+
+#if SIGNAL_MASK_BY_REF
+ k_sigsuspend((uintptr_t) &mask1, 0xdeadbeef, (uintptr_t) &mask2);
+#else
+ k_sigsuspend(mask1, 0xdeadbeef, mask2);
+#endif
+ if (EINTR != errno)
+ perror_msg_and_skip("sigsuspend");
+
+ printf("sigsuspend([%s]) = ? ERESTARTNOHAND"
+ " (To be restarted if no handler)\n",
+ signo == SIGUSR2 ? "USR1" : "USR2");
+
+ puts("+++ exited with 0 +++");
+ return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_sigsuspend")
+
+#endif