btrfs
caps
caps-abbrev
+check_sigign
chmod
chown
chown32
libtests.a
link
linkat
+list_sigaction_signum
llseek
lookup_dcookie
lseek
sendfile64
set_mempolicy
set_ptracer_any
+set_sigign
setdomainname
setfsgid
setfsgid32
attach-p-cmd-p \
block_reset_raise_run \
caps-abbrev \
+ check_sigign \
clone_parent \
clone_ptrace \
count-f \
ioctl_rtc-v \
is_linux_mips_n64 \
ksysent \
+ list_sigaction_signum \
mmsg-silent \
mmsg_name-v \
msg_control-v \
seccomp-filter-v \
seccomp-strict \
set_ptracer_any \
+ set_sigign \
signal_receive \
sleep \
stack-fcall \
redirect-fds.test \
redirect.test \
restart_syscall.test \
+ sigign.test \
strace-C.test \
strace-E.test \
strace-S.test \
--- /dev/null
+/*
+ * Check that the signal handler for the given signan number is set
+ * to SIG_IGN/SIG_DFL.
+ *
+ * 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 <signal.h>
+#include <stdlib.h>
+
+int
+main(int ac, char **av)
+{
+ if (ac != 3)
+ error_msg_and_fail("usage: check_sigign 0|1 signum");
+
+ const int ign = !!atoi(av[1]);
+ const int signum = atoi(av[2]);
+ struct sigaction act;
+
+ if (sigaction(signum, NULL, &act))
+ perror_msg_and_fail("sigaction: %s", av[2]);
+
+ return ign ^ (act.sa_handler == SIG_IGN);
+}
--- /dev/null
+/*
+ * List signal numbers that are valid arguments for sigaction 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 <signal.h>
+#include <stdio.h>
+
+int
+main(void)
+{
+ unsigned int i;
+
+ for (i = 1; i < 32; ++i) {
+ static const struct sigaction ign = { .sa_handler = SIG_IGN };
+ static const struct sigaction dfl = { .sa_handler = SIG_DFL };
+ struct sigaction act;
+
+ if (sigaction(i, &ign, NULL) ||
+ sigaction(i, NULL, &act) ||
+ ign.sa_handler != act.sa_handler ||
+ sigaction(i, &dfl, NULL) ||
+ sigaction(i, NULL, &act) ||
+ dfl.sa_handler != act.sa_handler)
+ continue;
+
+ printf("%u\n", i);
+ }
+
+ return 0;
+}
--- /dev/null
+/*
+ * Execute a command with a signal handler set to SIG_IGN/SIG_DFL.
+ *
+ * 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 <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int
+main(int ac, char **av)
+{
+ if (ac < 4)
+ error_msg_and_fail("usage: set_sigign 0|1 signum path...");
+
+ const int ign = atoi(av[1]);
+ const int signum = atoi(av[2]);
+
+ if (signal(signum, ign ? SIG_IGN : SIG_DFL) == SIG_ERR)
+ perror_msg_and_fail("signal: %s", av[2]);
+
+ execvp(av[3], av + 3);
+ perror_msg_and_fail("execvp: %s", av[3]);
+}
--- /dev/null
+#!/bin/sh
+
+# Check signal disposition transparency.
+# Starting with commit v4.17-8-ge97a66f strace is expected
+# to forward the signal disposition to tracees unchanged.
+
+. "${srcdir=.}/init.sh"
+
+run_prog ../list_sigaction_signum > /dev/null
+saved_STRACE="$STRACE"
+
+for sig in $(../list_sigaction_signum); do
+ for ign in 0 1; do
+ set_cmd="../set_sigign $ign $sig"
+ check_cmd="../check_sigign $ign $sig"
+ run_prog $set_cmd $check_cmd
+ STRACE="$set_cmd $saved_STRACE"
+ for i in '' -I1 -I2 -I3 -I4; do
+ run_strace $i -enone $check_cmd
+ done
+ done
+done