David Smith [Thu, 31 Aug 2017 14:38:18 +0000 (09:38 -0500)]
Add a minor update to the strace example and meta file.
* testsuite/systemtap.examples/process/strace.stp (filter_p): Remove
comment about PR6762, which has been fixed.
* testsuite/systemtap.examples/process/strace.meta: Run the script on a
specific process, instead of on the entire system (where we would hit
"probe overhead exceeded threshold").
David Smith [Thu, 31 Aug 2017 14:35:41 +0000 (09:35 -0500)]
Update tapset/python2.stp for RHEL6-era systems.
* tapset/python2.stp (Py2Long_AsLongLongAndOverflow_Small): Don't bother
trying to see if the Py2LongObject is defined, go ahead and use it. The
check to see if it is defined seems to fail.
(Py2Long_AsLongLongAndOverflow_Big): Ditto.
David Smith [Tue, 29 Aug 2017 21:27:23 +0000 (16:27 -0500)]
Fix PR22036 by handling "struct bio" kernel changes.
* buildrun.cxx (compile_pass): Add "autoconf"-style test for bi_opf field
of the "bio" structure.
* runtime/linux/autoconf-bio-bi_opf.c: New file.
* tapset/linux/ioblock.stp (bio_op): Use new STAPCONF_BIO_BI_OPF define.
David Smith [Tue, 29 Aug 2017 16:03:06 +0000 (11:03 -0500)]
Fix PR22012 by updating the way we read user strings.
* runtime/linux/loc2c-runtime.h (_stp_deref_string_nofault): Renamed from
kderef_string_() and modified to be able to read either a kernel or user
string.
(kderef_string): Modified to call the new _stp_deref_string_nofault().
* runtime/linux/copy.c (_stp_strncpy_from_user): Replace all code with a
call to _stp_deref_string_nofault(). This avoids a "scheduling while
atomic" kernel BUG seen when reading strings.
David Smith [Thu, 24 Aug 2017 21:42:51 +0000 (16:42 -0500)]
Tweak more systemtap.examples meta files to improve test passes.
* testsuite/systemtap.examples/general/key.meta: Check that the probed
kernel function exists before trying to compile/run the example.
* testsuite/systemtap.examples/general/keyhack.meta: Ditto.
David Smith [Thu, 24 Aug 2017 16:00:59 +0000 (11:00 -0500)]
Perform process cleanup in testsuite/systemtap.interactive/*.exp.
* testsuite/systemtap.interactive/char_and_line.exp: Be sure to kill
systemtap at the end of the test and wait on it to finish.
* testsuite/systemtap.interactive/input.char.exp: Ditto.
* testsuite/systemtap.interactive/input.line.exp: Ditto.
David Smith [Thu, 24 Aug 2017 15:42:58 +0000 (10:42 -0500)]
Add a fix to the 'container_check' example.
* testsuite/systemtap.examples/profiling/container_check.stp: Handle the
fact that the kernel functions ns_capable() and capable() have different
function signatures. On RHEL6 systems, we were getting bogus output.
David Smith [Thu, 24 Aug 2017 15:34:22 +0000 (10:34 -0500)]
Tweak some systemtap.examples meta files to improve test passes.
* testsuite/systemtap.examples/memory/hugepage_collapse.meta: Check that
the probed kernel function exists before trying to compile/run the
example.
* testsuite/systemtap.examples/memory/hugepage_split.meta: Ditto.
* testsuite/systemtap.examples/general/func_time_stats.meta: Probe
syscall.read instead of syscall.nanosleep, since we're much more likely
to hit that syscall.
Aaron Merey [Wed, 23 Aug 2017 22:54:49 +0000 (18:54 -0400)]
PR21891: perform _stext relocation on kprobes, fix kretprobe registration.
* stapbpf/stapbpf.cxx (maybe_collect_kprobe): read value of _stext from
/proc/kallsyms and add to kprobe symbol offsets.
* tapsets.cxx (dwarf_derived_probe::dwarf_derived_probe): set symbol_name
to funcname for kretprobes.
David Smith [Wed, 23 Aug 2017 21:00:24 +0000 (16:00 -0500)]
Fix PR21998 by updating tapset/linux/ip.stp.
* tapset/linux/ip.stp: Use the new 'iphdr_cast' macro to properly cast a
value to a iphdr struture pointer. For RHEL6, this fixes some "kbuild
exited with status: 2" warnings.
David Smith [Wed, 23 Aug 2017 19:05:21 +0000 (14:05 -0500)]
Add small fixes in tapset/linux/memory.stp.
* tapset/linux/memory.stp: Handle the case where __GFP_MEMALLOC doesn't
exist (like on RHEL6). In __vm.kmalloc_node.kp, add @entry() around
variables in a return probe.
David Smith [Wed, 23 Aug 2017 16:34:56 +0000 (11:34 -0500)]
Fix PR21996 by updating DEREF_FAULT for dyninst.
* runtime/loc2c-runtime.h (DEREF_FAULT): Fix dyninst compile errors on
32-bit systems where 'intptr_t' is an 'int'. Be sure to cast to 'long'
in DEREF_FAULT and STORE_DEREF_FAULT before printing the value with
"%lx".
David Smith [Tue, 22 Aug 2017 19:44:03 +0000 (14:44 -0500)]
Add and use a new macro @inet_sock_cast().
* tapset/linux/inet.stpm: Added new macro file.
* tapset/linux/inet_sock.stp: Use new @inet_sock_cast() macro to
standardize casting a pointer to a "struct inet_sock".
* tapset/linux/ip.stp: Ditto.
* tapset/linux/tcp.stp: Ditto.
David Smith [Tue, 22 Aug 2017 15:15:29 +0000 (10:15 -0500)]
PR21984: Fix "cast to pointer from integer of different size" errors.
* runtime/linux/loc2c-runtime.h: Modify the __Xread() and __Xwrite()
macros for 32-bit systems so that 64-bit values are handled properly.
* tapset/linux/atomic.stp: Make sure all pointer values are cast
properly. Their values must be cast to a 'uintptr_t' value then the
final pointer type value. This is necessary for 32-bit systems (since
systemtap variables are 64-bits). Some pointer casts weren't cast to a
numeric value, some were cast to a signed value, etc. Standardize all of
them.
* tapset/linux/aux_syscalls.stp: Ditto.
* tapset/linux/conversions-guru.stp: Ditto.
* tapset/linux/conversions.stp: Ditto.
* tapset/linux/i386/aux_syscalls.stp: Ditto.
* tapset/linux/ioblock.stp: Ditto.
* tapset/linux/ioscheduler.stp: Ditto.
* tapset/linux/ip.stp: Ditto.
* tapset/linux/ipmib.stp: Ditto.
* tapset/linux/kprocess.stp: Ditto.
* tapset/linux/netfilter.stp: Ditto.
* tapset/linux/nfs.stp: Ditto.
* tapset/linux/nfsd.stp: Ditto.
* tapset/linux/proc_mem.stp: Ditto.
* tapset/linux/rcu.stp: Ditto.
* tapset/linux/s390/aux_syscalls.stp: Ditto.
* tapset/linux/signal.stp: Ditto.
* tapset/linux/socket.stp: Ditto.
* tapset/linux/task.stp: Ditto.
* tapset/linux/tcp.stp: Ditto.
* tapset/linux/tcpmib.stp: Ditto.
* tapset/linux/x86_64/aux_syscalls.stp: Ditto.
* tapset/string.stp: Ditto.
* tapset/uconversions-guru.stp: Ditto.
* tapset/uconversions.stp: Ditto.
Stan Cox [Thu, 17 Aug 2017 18:46:27 +0000 (14:46 -0400)]
Send rpmname and buildid to http server.
* client-http.cxx (get_rpmname): New to get the rpmname of a file.
(process_buildid, get_buildid): New to get the buildid of a file.
(post): Also send rpmname and buildid
* main.cxx (passes_0_4): Invoke http client after elaboration pass.
David Smith [Wed, 16 Aug 2017 15:39:45 +0000 (10:39 -0500)]
Send over the linux distribution info to the http server.
* httpd/backends.cxx (local_backend::local_backend): Get the distro name
and arch.
(local_backend::can_generate_module): Check the distro name and arch.
(docker_backend::docker_backend): Get the list of JSON docker data files.
(docker_backend::can_generate_module): Check the arch and see if we have
a JSON docker data file for that distro.
* httpd/api.cxx (response build_collection_rh::POST): Look for 'distro_name'
and 'distro_version' tags.
* httpd/api.h (client_request_data): Added 'distro_name' and
'distro_version' fields.
* util.cxx (get_distro_info): New function.
* util.h: Add get_distro_info() declaration.
* httpd/client.py: Send over the distro information.
* dtrace.in: When building packages like libvirt on openSUSE that
link a libvirt_probes.o from dtrace, the build results differed
across builds. This is because the source's temporary filename
was in the .o. Make the temporary filename reproducible.
David Smith [Fri, 11 Aug 2017 14:36:51 +0000 (09:36 -0500)]
Fix PR21802 by improving the syscall test cases.
* testsuite/systemtap.syscall/syscall.exp: Add logic to use the
'CHECK_ONLY' environment variable to limit the syscalls tested.
* testsuite/systemtap.syscall/nd_syscall.exp: Ditto.
David Smith [Thu, 3 Aug 2017 19:23:28 +0000 (14:23 -0500)]
Fix deref handling on 32-bit kernels.
* runtime/linux/loc2c-runtime.h (__stp_deref_nocheck_): Fix i386/arm
systems where handling 8-byte values in one operation isn't possible.
(__stp_store_deref_nocheck_): Ditto.
David Smith [Thu, 3 Aug 2017 18:46:31 +0000 (13:46 -0500)]
Fix PR21901 by releasing locks in the correct order in runtime/stp_utrace.c.
* runtime/stp_utrace.c (utrace_reset): Be sure to release the locks in the
order we take them, otherwise we get an "inconsistent lock state" kernel
warning.
* main.cxx: Don't be sensitive to HAVE_LINUX_BPF_H in redundant
decisions.
* stapbpf: Clear bpf_attr's before passing to kernel, else -EINVAL.
Use log_level for verbosity for bpf syscall and elsewhere. Unshare
random text buffers and bpf's designated bpf_log_buf.
* runtime/linux/netfilter.c: To avoid "sleeping function called from
invalid context" kernel bugs, switch from using 'for_each_net_rcu()' to
using 'for_each_net()'. This avoids putting us into atomic context.
David Smith [Thu, 27 Jul 2017 17:32:54 +0000 (12:32 -0500)]
Fix syscall.{preadv,pwritev} 'offset' variable handling.
* tapset/linux/syscalls.stpm (__pos_from_hilo): New macro.
* tapset/linux/sysc_preadv.stp: Uses @__pos_from_hilo() macro to get the
correct 'offset' value.
* tapset/linux/sysc_preadv2.stp: Ditto.
* tapset/linux/sysc_pwritev.stp: Ditto.
* tapset/linux/sysc_pwritev2.stp: Ditto.
* testsuite/systemtap.syscall/preadv.c (__preadv2): Renamed from
'preadv2', since glibc 2.25 has implemented 'preadv2'.
* testsuite/systemtap.syscall/pwritev.c (__pwritev2): Renamed from
'pwritev2', sine glibc 2.25 has implemented 'pwritev2'.
David Smith [Wed, 26 Jul 2017 21:04:24 +0000 (16:04 -0500)]
syscall.execveat probes: provide decoded env_str
* tapset/linux/sysc_execveat.stp: Commit be0c04a changed syscall.execve to
provide decoded environment variables. Make similar changes for
syscall.execveat.
* testsuite/systemtap.syscall/execve.c: Update for output change.
* testsuite/systemtap.syscall/execveat.c: Ditto.
David Smith [Wed, 26 Jul 2017 15:19:36 +0000 (10:19 -0500)]
Fix PR21834 by updating the netfilter probes for new kernels.
* runtime/linux/netfilter.c: New file containing
nf_register_hook/nf_unregister_hook.
* tapset-netfilter.cxx (netfilter_derived_probe_group::emit_module_decls):
Include "linux/netfilter.c".
* buildrun.cxx (compile_pass): Add exportconf test for "nf_register_hook".
David Smith [Tue, 25 Jul 2017 20:07:46 +0000 (15:07 -0500)]
Updated testsuite/buildok/fortytwo.stp for rawhide.
* testsuite/buildok/fortytwo.stp: Updated for rawhide kernels,
4.13.0-0.rc1.git4.1.fc27.x86_64, where the kernel function
'do_readv_writev' no longer exists. Instead, probe
'do_iter_readv_writev'.
autocast support: bring back early manual functionall->synth-decl referent
When synthesizing dwarf-related functions, we can usually rely on
pass-2 symbol resolution to match up the functioncall*s with the
functiondecl*s. But in the case of autocast handling, synth function
generation is for whatever reason delayed past this point in pass-2,
so we have to manually resolve symbols/referents to some extent.
The bpf branch converts this former macro into an inline function,
so stricter type checking applies. This explicit cast makes several
pass-4 errors go poof!
As commented, we may well require sign-extension of the
rvalue that gets assigned to the lvalue. But the previous
code didn't do that; we certainly get away with it for x86.
Add probe alias input.line, allow multiple procfs.write probes for a single file.
* man/stapprobes.3stap: updated section on input probes.
* runtime/procfs-probes.c (struct stap_procfs_probe): member write_probe renamed to
write_probes. Type of member changed to struct stap_probe**.
(_stp_proc_write_file): now handles multiple write probes.
* runtime/procfs.c (_stp_create_procfs): no longer exits when trying to create
a proc file that already exists.
* tapset-procfs.cxx (struct procfs_probe_set): member write_probe renamed to
write_probes. Type of member changed to vector<procfs_derived_probe*>.
(procfs_derived_probe_group::emit_module_decls): now handles multiple
write_probes.
* tapset/input.stp: added alias input.line.
David Smith [Tue, 18 Jul 2017 21:28:17 +0000 (16:28 -0500)]
Improve the http server "local" backend.
* httpd/backends.cxx (local_backend::local_backend): Look for all the
kernels this system can compile a module for.
(local_backend::can_generate_module): Make sure this system can compile
a module for the target kernel.
(docker_backend): Add class start.
* httpd/api.cxx (result_info::generate_response): Can now return an error
status.
(response build_collection_rh::POST): Fixed typo in error message.
(build_info::set_result): New function.
(build_info::module_build): Always specify the kernel version in the
stap command line. Generate an error result if needed. Return an error
if no suitable backend can be found. Call globfree() when needed.
(get_backends): Add docker backend.
Cody Santing [Tue, 6 Jun 2017 18:20:06 +0000 (14:20 -0400)]
PR21283 initial commit
* remote.cxx: detect dyninst mode then adjust the extension of the
module being sent to .so. Also passes a new '-d' argument to stapsh
signifying dyninst mode.
* staprun/stapsh.c: if in dyninst mode, call stapdyn vs staprun