From 97fca116c19cf5bb225f12dc9794cb2faf827061 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Tue, 10 Mar 2015 07:08:25 +0100 Subject: [PATCH] PR16716 partial fix: Fix types and nesting. Fix types and nesting for rt_sigqueueinfo, setdomainname, setrlimit, splice, vmsplice and tee syscalls. * tapset/linux/syscalls2.stp: Fix types and nesting. * tapset/linux/nd_syscalls2.stp: Fix types and nesting. * tapset/linux/aux_syscalls.stp: Add SPLICE* defs. * NEWS: Add deprecation note. * testsuite/buildok/syscalls2-detailed.stp: New testcase. * testsuite/buildok/nd_syscalls2-detailed.stp: New testcase. * testsuite/systemtap.syscall/getrlimit.c: Updated testcase. * testsuite/systemtap.syscall/rt_signal.c: Updated testcase. * testsuite/systemtap.syscall/domainname.c: New testcase. * testsuite/systemtap.syscall/tee.c: New testcase. --- NEWS | 5 + tapset/linux/aux_syscalls.stp | 33 +++++++ tapset/linux/nd_syscalls2.stp | 76 ++++++++++++--- tapset/linux/syscalls2.stp | 88 ++++++++++++++--- testsuite/buildok/nd_syscalls2-detailed.stp | 14 ++- testsuite/buildok/syscalls2-detailed.stp | 12 ++- testsuite/systemtap.syscall/domainname.c | 33 +++++++ testsuite/systemtap.syscall/getrlimit.c | 11 ++- testsuite/systemtap.syscall/rt_signal.c | 26 ++++- testsuite/systemtap.syscall/tee.c | 102 ++++++++++++++++++++ 10 files changed, 367 insertions(+), 33 deletions(-) create mode 100644 testsuite/systemtap.syscall/domainname.c create mode 100644 testsuite/systemtap.syscall/tee.c diff --git a/NEWS b/NEWS index 3d6dac041..2546eb975 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,10 @@ * What's new in version 2.8 +- The following tapset variables and functions are deprecated in + version 2.8: + - The 'hostname_uaddr' in the [nd_]syscall.setdomainname. Please + use 'domainname_uaddr' instead. + * What's new in version 2.7, 2015-02-18 - Some systemtap sample scripts are now identified with the "_best" keyword, diff --git a/tapset/linux/aux_syscalls.stp b/tapset/linux/aux_syscalls.stp index 668aef205..f4bb025db 100644 --- a/tapset/linux/aux_syscalls.stp +++ b/tapset/linux/aux_syscalls.stp @@ -4570,3 +4570,36 @@ function _stp_timerfd_flags_str:string(flags:long) (unsigned int)STAP_ARG_flags, STAP_RETVALUE, MAXSTRINGLEN); %} + +%{ +// RHEL5 linux/pipe_fs_i.h has SPLICE* defs. RHEL6+ has it in +// separate linux/splice.h, which does not exist on RHEL5. +#include +#ifndef SPLICE_F_MOVE +#include +#endif + +static const _stp_val_array const _stp_splice_flags_list[] = { +#ifdef SPLICE_F_MOVE + V(SPLICE_F_MOVE), +#endif +#ifdef SPLICE_F_NONBLOCK + V(SPLICE_F_NONBLOCK), +#endif +#ifdef SPLICE_F_MORE + V(SPLICE_F_MORE), +#endif +#ifdef SPLICE_F_GIFT + V(SPLICE_F_GIFT), +#endif + {0, NULL} +}; +%} + +function _stp_splice_flags_str:string(flags:long) +%{ /* pure */ + _stp_lookup_or_str(_stp_splice_flags_list, + (unsigned int)STAP_ARG_flags, STAP_RETVALUE, + MAXSTRINGLEN); +%} + diff --git a/tapset/linux/nd_syscalls2.stp b/tapset/linux/nd_syscalls2.stp index 495b59f41..9efcd4cbf 100644 --- a/tapset/linux/nd_syscalls2.stp +++ b/tapset/linux/nd_syscalls2.stp @@ -1649,7 +1649,9 @@ probe nd_syscall.compat_rt_sigprocmask.return = # # long sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo) # -probe nd_syscall.rt_sigqueueinfo = kprobe.function("sys_rt_sigqueueinfo") ? +probe nd_syscall.rt_sigqueueinfo = __nd_syscall.rt_sigqueueinfo ?, + kprobe.function("sys32_rt_sigqueueinfo") ?, + kprobe.function("compat_sys_rt_sigqueueinfo") ? { name = "rt_sigqueueinfo" asmlinkage() @@ -1658,11 +1660,21 @@ probe nd_syscall.rt_sigqueueinfo = kprobe.function("sys_rt_sigqueueinfo") ? uinfo_uaddr = pointer_arg(3) argstr = sprintf("%d, %s, %p", pid, _signal_name(sig), uinfo_uaddr) } -probe nd_syscall.rt_sigqueueinfo.return = kprobe.function("sys_rt_sigqueueinfo").return ? +probe __nd_syscall.rt_sigqueueinfo = kprobe.function("sys_rt_sigqueueinfo") +{ + @__syscall_gate(%{ __NR_rt_sigqueueinfo %}) +} +probe nd_syscall.rt_sigqueueinfo.return = __nd_syscall.rt_sigqueueinfo.return, + kprobe.function("sys32_rt_sigqueueinfo").return ?, + kprobe.function("compat_sys_rt_sigqueueinfo").return ? { name = "rt_sigqueueinfo" retstr = returnstr(1) } +probe __nd_syscall.rt_sigqueueinfo.return = kprobe.function("sys_rt_sigqueueinfo").return +{ + @__syscall_gate(%{ __NR_rt_sigqueueinfo %}) +} # rt_sigreturn _______________________________________________ # int sys_rt_sigreturn(unsigned long __unused) @@ -2607,9 +2619,13 @@ probe nd_syscall.setdomainname = kprobe.function("sys_setdomainname") ? { name = "setdomainname" asmlinkage() - hostname_uaddr = pointer_arg(1) + domainname_uaddr = pointer_arg(1) +%( systemtap_v <= "1.8" %? + hostname_uaddr = domainname_uaddr +%) + domainname_str = user_string_quoted(domainname_uaddr) len = int_arg(2) - argstr = sprintf("%p, %d", hostname_uaddr, len) + argstr = sprintf("%s, %d", domainname_str, len) } probe nd_syscall.setdomainname.return = kprobe.function("sys_setdomainname").return ? { @@ -2993,9 +3009,13 @@ probe nd_syscall.setreuid16.return = kprobe.function("sys_setreuid16").return ? # # asmlinkage long # sys_setrlimit(unsigned int resource, -# struct rlimit __user *rlim) +# struct rlimit __user *rlim) +# asmlinkage long +# compat_sys_setrlimit(unsigned int resource, +# struct compat_rlimit __user *rlim) # -probe nd_syscall.setrlimit = kprobe.function("sys_setrlimit") ? +probe nd_syscall.setrlimit = __nd_syscall.setrlimit ?, + kprobe.function("compat_sys_setrlimit") ? { name = "setrlimit" asmlinkage() @@ -3004,11 +3024,20 @@ probe nd_syscall.setrlimit = kprobe.function("sys_setrlimit") ? argstr = sprintf("%s, %s", _rlimit_resource_str(resource), _struct_rlimit_u(rlim_uaddr)) } -probe nd_syscall.setrlimit.return = kprobe.function("sys_setrlimit").return ? +probe __nd_syscall.setrlimit = kprobe.function("sys_setrlimit") +{ + @__syscall_gate(%{ __NR_setrlimit %}) +} +probe nd_syscall.setrlimit.return = __nd_syscall.setrlimit.return ?, + kprobe.function("compat_sys_setrlimit").return ? { name = "setrlimit" retstr = returnstr(1) } +probe __nd_syscall.setrlimit.return = kprobe.function("sys_setrlimit").return +{ + @__syscall_gate(%{ __NR_setrlimit %}) +} # setsid _____________________________________________________ # @@ -3853,8 +3882,15 @@ probe nd_syscall.splice = kprobe.function("sys_splice") ? { name = "splice" asmlinkage() - argstr = sprintf("%d, %p, %d, %p, %d, 0x%x", - int_arg(1), pointer_arg(2), int_arg(3), pointer_arg(4), ulong_arg(5), uint_arg(6)) + fd_in = int_arg(1) + off_in = pointer_arg(2) + fd_out = int_arg(3) + off_out = pointer_arg(4) + len = ulong_arg(5) + flags = uint_arg(6) + flags_str = (_stp_splice_flags_str(flags)) + argstr = sprintf("%d, %p, %d, %p, %u, %s", fd_in, off_in, fd_out, + off_out, len, flags_str); } probe nd_syscall.splice.return = kprobe.function("sys_splice").return ? { @@ -4168,7 +4204,11 @@ probe nd_syscall.tee = kprobe.function("sys_tee") ? { name = "tee" asmlinkage() - argstr = sprintf("%d, %d, %d, 0x%x", int_arg(1), int_arg(2), ulong_arg(3), uint_arg(4)) + fdin = int_arg(1) + fdout = int_arg(2) + len = ulong_arg(3) + flags = uint_arg(4) + argstr = sprintf("%d, %d, %u, 0x%x", fdin, fdout, len, flags) } probe nd_syscall.tee.return = kprobe.function("sys_tee").return ? { @@ -5000,18 +5040,30 @@ probe nd_syscall.vhangup.return = kprobe.function("sys_vhangup").return # probe nd_syscall.vmsplice = kprobe.function("sys_vmsplice") ? { + @__syscall_gate_compat_simple name = "vmsplice" asmlinkage() - argstr = sprintf("%d, %p, %d, 0x%x", int_arg(1), pointer_arg(2), ulong_arg(3), uint_arg(4)) + fd = int_arg(1) + iov = pointer_arg(2) + nr_segs = ulong_arg(3) + flags = uint_arg(4) + flags_str = _stp_splice_flags_str(flags) + argstr = sprintf("%d, %p, %u, %s", fd, iov, nr_segs, flags_str) } probe nd_syscall.compat_vmsplice = kprobe.function("compat_sys_vmsplice") ? { name = "vmsplice" asmlinkage() - argstr = sprintf("%d, %p, %d, 0x%x", int_arg(1), pointer_arg(2), uint_arg(3), uint_arg(4)) + fd = int_arg(1) + iov = pointer_arg(2) + nr_segs = ulong_arg(3) + flags = uint_arg(4) + flags_str = _stp_splice_flags_str(flags) + argstr = sprintf("%d, %p, %u, %s", fd, iov, nr_segs, flags_str) } probe nd_syscall.vmsplice.return = kprobe.function("sys_vmsplice").return ? { + @__syscall_gate_compat_simple name = "vmsplice" retstr = returnstr(1) } diff --git a/tapset/linux/syscalls2.stp b/tapset/linux/syscalls2.stp index 3ee3debe3..c07e723b2 100644 --- a/tapset/linux/syscalls2.stp +++ b/tapset/linux/syscalls2.stp @@ -1628,19 +1628,31 @@ probe syscall.compat_rt_sigprocmask.return = # # long sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo) # -probe syscall.rt_sigqueueinfo = kernel.function("sys_rt_sigqueueinfo").call +probe syscall.rt_sigqueueinfo = __syscall.rt_sigqueueinfo ?, + kernel.function("sys32_rt_sigqueueinfo").call ?, + kernel.function("compat_sys_rt_sigqueueinfo").call ? { name = "rt_sigqueueinfo" - pid = $pid - sig = $sig + pid = __int32($pid) + sig = __int32($sig) uinfo_uaddr = $uinfo - argstr = sprintf("%d, %s, %p", $pid, _signal_name($sig), $uinfo) + argstr = sprintf("%d, %s, %p", pid, _signal_name(sig), $uinfo) } -probe syscall.rt_sigqueueinfo.return = kernel.function("sys_rt_sigqueueinfo").return +probe __syscall.rt_sigqueueinfo = kernel.function("sys_rt_sigqueueinfo").call +{ + @__syscall_gate(%{ __NR_rt_sigqueueinfo %}) +} +probe syscall.rt_sigqueueinfo.return = __syscall.rt_sigqueueinfo.return ?, + kernel.function("sys32_rt_sigqueueinfo").return ?, + kernel.function("compat_sys_rt_sigqueueinfo").return ? { name = "rt_sigqueueinfo" retstr = return_str(1, $return) } +probe __syscall.rt_sigqueueinfo.return = kernel.function("sys_rt_sigqueueinfo").return +{ + @__syscall_gate(%{ __NR_rt_sigqueueinfo %}) +} # rt_sigreturn _______________________________________________ # int sys_rt_sigreturn(unsigned long __unused) @@ -2519,9 +2531,13 @@ probe syscall.sendto.return = kernel.function("sys_sendto").return ?, probe syscall.setdomainname = kernel.function("sys_setdomainname").call { name = "setdomainname" - hostname_uaddr = $name - len = $len - argstr = sprintf("%p, %d", $name, $len) + domainname_uaddr = $name +%( systemtap_v <= "1.8" %? + hostname_uaddr = domainname_uaddr +%) + domainname_str = user_string_quoted(domainname_uaddr) + len = __int32($len) + argstr = sprintf("%s, %d", domainname_str, len) } probe syscall.setdomainname.return = kernel.function("sys_setdomainname").return { @@ -2879,9 +2895,13 @@ probe syscall.setreuid16.return = kernel.function("sys_setreuid16").return ? # # asmlinkage long # sys_setrlimit(unsigned int resource, -# struct rlimit __user *rlim) +# struct rlimit __user *rlim) +# asmlinkage long +# compat_sys_setrlimit(unsigned int resource, +# struct compat_rlimit __user *rlim) # -probe syscall.setrlimit = kernel.function("sys_setrlimit").call +probe syscall.setrlimit = __syscall.setrlimit ?, + kernel.function("compat_sys_setrlimit").call { name = "setrlimit" resource = $resource @@ -2889,11 +2909,20 @@ probe syscall.setrlimit = kernel.function("sys_setrlimit").call argstr = sprintf("%s, %s", _rlimit_resource_str($resource), _struct_rlimit_u($rlim)) } -probe syscall.setrlimit.return = kernel.function("sys_setrlimit").return +probe __syscall.setrlimit = kernel.function("sys_setrlimit").call +{ + @__syscall_gate(%{ __NR_setrlimit %}) +} +probe syscall.setrlimit.return = __syscall.setrlimit.return ?, + kernel.function("compat_sys_setrlimit").return { name = "setrlimit" retstr = return_str(1, $return) } +probe __syscall.setrlimit.return = kernel.function("sys_setrlimit").return +{ + @__syscall_gate(%{ __NR_setrlimit %}) +} # setsid _____________________________________________________ # # long sys_setsid(void) @@ -3646,8 +3675,15 @@ probe __syscall.socketcall.socketpair.return = probe syscall.splice = kernel.function("sys_splice").call ? { name = "splice" - argstr = sprintf("%d, %p, %d, %p, %d, 0x%x", - $fd_in, $off_in, $fd_out, $off_out, $len, $flags) + fd_in = __int32($fd_in) + off_in = $off_in + fd_out = __int32($fd_out) + off_out = $off_out + len = __ulong($len) + flags = $flags + flags_str = (_stp_splice_flags_str(flags)) + argstr = sprintf("%d, %p, %d, %p, %u, %s", fd_in, off_in, fd_out, + off_out, len, flags_str); } probe syscall.splice.return = kernel.function("sys_splice").return ? { @@ -3952,7 +3988,15 @@ probe syscall.syslog.return = kernel.function("sys_syslog").return probe syscall.tee = kernel.function("sys_tee").call ? { name = "tee" - argstr = sprintf("%d, %d, %d, 0x%x", $fdin, $fdout, $len, $flags) + fdin = __int32($fdin) + fdout = __int32($fdout) + if (%{ /* pure */ _stp_is_compat_task() %}) { + len = __uint32($len) + } else { + len = __ulong($len) + } + flags = __uint32($flags) + argstr = sprintf("%d, %d, %u, 0x%x", fdin, fdout, len, flags) } probe syscall.tee.return = kernel.function("sys_tee").return ? { @@ -4766,16 +4810,28 @@ probe syscall.vhangup.return = kernel.function("sys_vhangup").return # probe syscall.vmsplice = kernel.function("sys_vmsplice").call ? { + @__syscall_gate_compat_simple name = "vmsplice" - argstr = sprintf("%d, %p, %d, 0x%x", $fd, $iov, $nr_segs, $flags) + fd = __int32($fd) + iov = $iov + nr_segs = __ulong($nr_segs) + flags = $flags + flags_str = _stp_splice_flags_str(flags) + argstr = sprintf("%d, %p, %u, %s", fd, iov, nr_segs, flags_str) } probe syscall.compat_vmsplice = kernel.function("compat_sys_vmsplice").call ? { name = "vmsplice" - argstr = sprintf("%d, %p, %d, 0x%x", $fd, $iov32, $nr_segs, $flags) + fd = __int32($fd) + iov = @__pointer($iov32) + nr_segs = __uint32($nr_segs) + flags = $flags + flags_str = _stp_splice_flags_str(flags) + argstr = sprintf("%d, %p, %u, %s", fd, iov, nr_segs, flags_str) } probe syscall.vmsplice.return = kernel.function("sys_vmsplice").return ? { + @__syscall_gate_compat_simple name = "vmsplice" retstr = return_str(1, $return) } diff --git a/testsuite/buildok/nd_syscalls2-detailed.stp b/testsuite/buildok/nd_syscalls2-detailed.stp index 2d2e13c28..928d5fe5e 100755 --- a/testsuite/buildok/nd_syscalls2-detailed.stp +++ b/testsuite/buildok/nd_syscalls2-detailed.stp @@ -663,9 +663,14 @@ probe nd_syscall.sendto.return ? probe nd_syscall.setdomainname { printf("%s(%s)\n", name, argstr) - printf("%p %d\n", hostname_uaddr, len) +%( systemtap_v <= "1.8" %? + printf("%p, %p, %s, %d", domainname_uaddr, hostname_uaddr, domainname_str, len) +%: + printf("%p, %s, %d", domainname_uaddr, domainname_str, len) +%) } -probe nd_syscall.setdomainname.return + +probe syscall.setdomainname.return { printf("%s %s\n", name, retstr) } @@ -1058,6 +1063,8 @@ probe nd_syscall.socketpair.return probe nd_syscall.splice ? { printf("%s, %s\n", name, argstr) + printf("%d, %p, %d, %p, %u, %u, %s", fd_in, off_in, fd_out, + off_out, len, flags, flags_str); } probe nd_syscall.splice.return ? { @@ -1206,6 +1213,7 @@ probe nd_syscall.syslog.return probe nd_syscall.tee ? { printf("%s, %s\n", name, argstr) + printf("%d, %d, %u, 0x%x", fdin, fdout, len, flags) } probe nd_syscall.tee.return ? { @@ -1475,6 +1483,8 @@ probe nd_syscall.vhangup.return probe nd_syscall.vmsplice ?, nd_syscall.compat_vmsplice ? { printf("%s, %s\n", name, argstr) + argstr = sprintf("%d, %p, %u, %u, %s", fd, iov, nr_segs, + flags, flags_str) } probe nd_syscall.vmsplice.return ?, nd_syscall.compat_vmsplice.return ? { diff --git a/testsuite/buildok/syscalls2-detailed.stp b/testsuite/buildok/syscalls2-detailed.stp index 75e7f4993..41ceb7fe0 100755 --- a/testsuite/buildok/syscalls2-detailed.stp +++ b/testsuite/buildok/syscalls2-detailed.stp @@ -659,8 +659,13 @@ probe syscall.sendto.return ? probe syscall.setdomainname { printf("%s(%s)\n", name, argstr) - printf("%p %d\n", hostname_uaddr, len) +%( systemtap_v <= "1.8" %? + printf("%p, %p, %s, %d", domainname_uaddr, hostname_uaddr, domainname_str, len) +%: + printf("%p, %s, %d", domainname_uaddr, domainname_str, len) +%) } + probe syscall.setdomainname.return { printf("%s %s\n", name, retstr) @@ -1054,6 +1059,8 @@ probe syscall.socketpair.return probe syscall.splice ? { printf("%s, %s\n", name, argstr) + printf("%d, %p, %d, %p, %u, %u, %s", fd_in, off_in, fd_out, + off_out, len, flags, flags_str); } probe syscall.splice.return ? { @@ -1202,6 +1209,7 @@ probe syscall.syslog.return probe syscall.tee ? { printf("%s, %s\n", name, argstr) + printf("%d, %d, %u, 0x%x", fdin, fdout, len, flags) } probe syscall.tee.return ? { @@ -1471,6 +1479,8 @@ probe syscall.vhangup.return probe syscall.vmsplice ?, syscall.compat_vmsplice ? { printf("%s, %s\n", name, argstr) + argstr = sprintf("%d, %p, %u, %u, %s", fd, iov, nr_segs, + flags, flags_str) } probe syscall.vmsplice.return ?, syscall.compat_vmsplice.return ? { diff --git a/testsuite/systemtap.syscall/domainname.c b/testsuite/systemtap.syscall/domainname.c new file mode 100644 index 000000000..c28b62431 --- /dev/null +++ b/testsuite/systemtap.syscall/domainname.c @@ -0,0 +1,33 @@ +/* COVERAGE: setdomainname getdomainname */ + +#include +#include +#include + +#define MAX_NAME_LEN __NEW_UTS_LEN +static char domain_name[MAX_NAME_LEN]; + +int main() { + // The backend for getdomainname() appears to be sys_uname(). This is true + // except for alpha and sparc. Alpha is a history and no available sparc + // HW to test on. So skipping this instead of writing a testcase for blind. + + getdomainname(domain_name, sizeof(domain_name)); + + // Notice we aren't calling setdomainname() so that it will succeed. + // This is on purpose. We don't want to change the domainname. + // + // setdomainname(domain_name, sizeof(domain_name)); + + setdomainname((const char *)-1, sizeof(domain_name)); +#ifdef __s390__ + //staptest// setdomainname ([7]?[f]+, NNNN) = NNNN (EFAULT) +#else + //staptest// setdomainname ([f]+, NNNN) = NNNN (EFAULT) +#endif + + setdomainname(domain_name, -1); + //staptest// setdomainname ("[[[[[a-zA-Z0-9\.-]+!!!!(none)]]]]", -1) = NNNN (EINVAL) + + return 0; +} diff --git a/testsuite/systemtap.syscall/getrlimit.c b/testsuite/systemtap.syscall/getrlimit.c index c24292f8b..67c3271d1 100644 --- a/testsuite/systemtap.syscall/getrlimit.c +++ b/testsuite/systemtap.syscall/getrlimit.c @@ -1,4 +1,4 @@ -/* COVERAGE: getrlimit */ +/* COVERAGE: getrlimit setrlimit */ #include #include @@ -11,6 +11,9 @@ int main() { getrlimit(RLIMIT_CPU, &rlim); //staptest// getrlimit (RLIMIT_CPU, XXXX) = 0 + setrlimit(RLIMIT_CPU, &rlim); + //staptest// setrlimit (RLIMIT_CPU, \[NNNN,NNNN\]) = 0 + // --- then check nasty calls --- getrlimit(-1, &rlim); @@ -26,5 +29,11 @@ int main() { //staptest// getrlimit (RLIMIT_CPU, 0x[f]+) = NNNN (EFAULT) #endif + setrlimit(-1, &rlim); + //staptest// setrlimit (RLIM_INFINITY, \[NNNN,NNNN\]) = NNNN (EINVAL) + + setrlimit(RLIMIT_CPU, (const struct rlimit *)-1); + //staptest// setrlimit (RLIMIT_CPU, UNKNOWN) = NNNN (EFAULT) + return 0; } diff --git a/testsuite/systemtap.syscall/rt_signal.c b/testsuite/systemtap.syscall/rt_signal.c index e24ca3bd7..b217e18b0 100644 --- a/testsuite/systemtap.syscall/rt_signal.c +++ b/testsuite/systemtap.syscall/rt_signal.c @@ -1,19 +1,26 @@ -/* COVERAGE: rt_sigprocmask rt_sigaction rt_sigpending */ +/* COVERAGE: rt_sigprocmask rt_sigaction rt_sigpending rt_sigqueueinfo */ #include #include #include #include #include +#include static void sig_act_handler(int signo) { } +int +__rt_sigqueueinfo(pid_t tgid, int sig, siginfo_t *siginfo) +{ + return syscall(__NR_rt_sigqueueinfo, tgid, sig, siginfo); +} int main() { sigset_t mask; + siginfo_t siginfo; struct sigaction sa; sigemptyset(&mask); @@ -81,6 +88,23 @@ int main() //staptest// rt_sigpending (0x[f]+, 8) = -NNNN (EFAULT) #endif + siginfo.si_code = SI_USER; + siginfo.si_pid = getpid(); + siginfo.si_uid = getuid(); + siginfo.si_value = 1; + + __rt_sigqueueinfo(getpid(), SIGUSR1, &siginfo); + //staptest// rt_sigqueueinfo (NNNN, SIGUSR1, XXXX) = 0 + + __rt_sigqueueinfo(-1, SIGUSR1, &siginfo); + //staptest// rt_sigqueueinfo (-1, SIGUSR1, XXXX) = NNNN + + __rt_sigqueueinfo(getpid(), -1, &siginfo); + //staptest// rt_sigqueueinfo (NNNN, 0x[f]+, XXXX) = NNNN + + __rt_sigqueueinfo(getpid(), SIGUSR1, (siginfo_t *)-1); + //staptest// rt_sigqueueinfo (NNNN, SIGUSR1, 0x[f]+) = NNNN + return 0; } diff --git a/testsuite/systemtap.syscall/tee.c b/testsuite/systemtap.syscall/tee.c new file mode 100644 index 000000000..bb7fb6371 --- /dev/null +++ b/testsuite/systemtap.syscall/tee.c @@ -0,0 +1,102 @@ +/* COVERAGE: tee splice vmsplice */ + +#define _GNU_SOURCE +#include +#include +#include + +#define TEST_BLOCK_SIZE (1<<17) /* 128K */ + +int main() { + + int pipes[2]; + struct iovec v; + static char buffer[TEST_BLOCK_SIZE]; + v.iov_base = buffer; + v.iov_len = TEST_BLOCK_SIZE; + pipe(pipes); + + // ------- tee ---------- + + tee(0, 0, 0, 0); + //staptest// tee (0, 0, 0, 0x0) = 0 + + tee(-1, 0, 0, 0); + //staptest// tee (-1, 0, 0, 0x0) + + tee(0, -1, 0, 0); + //staptest// tee (0, -1, 0, 0x0) + + tee(0, 0, (unsigned long)-1, 0); +#if __WORDSIZE == 64 + //staptest// tee (0, 0, 18446744073709551615, 0x0) +#else + //staptest// tee (0, 0, 4294967295, 0x0) +#endif + + tee(0, 0, 0, -1); + //staptest// tee (0, 0, 0, 0x[f]+) + + // ------- splice ------- + + splice(0, NULL, 0, NULL, 0, SPLICE_F_MOVE); + //staptest// splice (0, 0x0, 0, 0x0, 0, SPLICE_F_MOVE) = 0 + + splice(-1, NULL, 0, NULL, 0, SPLICE_F_MOVE); + //staptest// splice (-1, 0x0, 0, 0x0, 0, SPLICE_F_MOVE) + + splice(0, (loff_t *)-1, 0, NULL, 0, SPLICE_F_MOVE); +#ifdef __s390__ + //staptest// splice (0, 0x[7]?[f]+, 0, 0x0, 0, SPLICE_F_MOVE) +#else + //staptest// splice (0, 0x[f]+, 0, 0x0, 0, SPLICE_F_MOVE) +#endif + + splice(0, NULL, -1, NULL, 0, SPLICE_F_MOVE); + //staptest// splice (0, 0x0, -1, 0x0, 0, SPLICE_F_MOVE) + + splice(0, NULL, 0, (loff_t *)-1, 0, SPLICE_F_MOVE); +#ifdef __s390__ + //staptest// splice (0, 0x0, 0, 0x[7]?[f]+, 0, SPLICE_F_MOVE) +#else + //staptest// splice (0, 0x0, 0, 0x[f]+, 0, SPLICE_F_MOVE) +#endif + + splice(0, NULL, 0, NULL, -1, SPLICE_F_MOVE); +#if __WORDSIZE == 64 + //staptest// splice (0, 0x0, 0, 0x0, 18446744073709551615, SPLICE_F_MOVE) +#else + //staptest// splice (0, 0x0, 0, 0x0, 4294967295, SPLICE_F_MOVE) +#endif + + splice(0, NULL, 0, NULL, 0, -1); + //staptest// splice (0, 0x0, 0, 0x0, 0, SPLICE_F_MOVE|SPLICE_F_NONBLOCK|SPLICE_F_MORE|SPLICE_F_GIFT|XXXX) + + + // ------- vmsplice ----- + + vmsplice(pipes[1], &v, 1, SPLICE_F_MOVE); + //staptest// vmsplice (NNNN, XXXX, 1, SPLICE_F_MOVE) = NNNN + + vmsplice(-1, &v, 1, SPLICE_F_MOVE); + //staptest// vmsplice (-1, XXXX, 1, SPLICE_F_MOVE) + + vmsplice(pipes[1], (const struct iovec *)-1, 1, SPLICE_F_MOVE); +#ifdef __s390__ + //staptest// vmsplice (NNNN, 0x[7]?[f]+, 1, SPLICE_F_MOVE) +#else + //staptest// vmsplice (NNNN, 0x[f]+, 1, SPLICE_F_MOVE) +#endif + + vmsplice(pipes[1], &v, -1, SPLICE_F_MOVE); +#if __WORDSIZE == 64 + //staptest// vmsplice (NNNN, XXXX, 18446744073709551615, SPLICE_F_MOVE) +#else + //staptest// vmsplice (NNNN, XXXX, 4294967295, SPLICE_F_MOVE) +#endif + + vmsplice(pipes[1], &v, 1, -1); + //staptest// vmsplice (NNNN, XXXX, 1, SPLICE_F_MOVE|SPLICE_F_NONBLOCK|SPLICE_F_MORE|SPLICE_F_GIFT|XXXX) + + return 0; +} -- 2.43.5