2 * Check decoding of kill syscall.
4 * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
5 * Copyright (c) 2016 Fei Jie <feij.fnst@cn.fujitsu.com>
6 * Copyright (c) 2016-2018 The strace developers.
9 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include <asm/unistd.h>
29 const struct sigaction act = { .sa_handler = handler };
30 if (sigaction(SIGALRM, &act, NULL))
31 perror_msg_and_fail("sigaction");
35 sigaddset(&mask, SIGALRM);
36 if (sigprocmask(SIG_UNBLOCK, &mask, NULL))
37 perror_msg_and_fail("sigprocmask");
39 const int pid = getpid();
40 long rc = syscall(__NR_kill, pid, (long) 0xdefaced00000000ULL | SIGALRM);
41 printf("kill(%d, SIGALRM) = %ld\n", pid, rc);
43 const long big_pid = (long) 0xfacefeedbadc0dedULL;
44 const long big_sig = (long) 0xdeadbeefcafef00dULL;
45 rc = syscall(__NR_kill, big_pid, big_sig);
46 printf("kill(%d, %d) = %ld %s (%m)\n",
47 (int) big_pid, (int) big_sig, rc, errno2name());
49 rc = syscall(__NR_kill, (long) 0xdefaced00000000ULL | pid, 0);
50 printf("kill(%d, 0) = %ld\n", pid, rc);
52 puts("+++ exited with 0 +++");
58 SKIP_MAIN_UNDEFINED("__NR_kill")