William Cohen [Fri, 21 Nov 2014 01:04:23 +0000 (20:04 -0500)]
Allow syscall tests to match the arm64 remapped syscalls
The arm64 does not implement a number of deprecated syscalls. The
deprecated syscalls are remapped to more generic syscalls with the
additional arguments set to so the remapped systemcall emulates the
behavior the deprecated syscalls. The syscall tests matching needed
to be adjusted to match these remaped syscalls for inotify_init(),
pipe(), select(), and vfork(). These fixes are applied to the
following tests:
David Smith [Thu, 20 Nov 2014 15:34:08 +0000 (09:34 -0600)]
PR16716 partial fix: Fix types in 'syscall.{semctl,semget,semop,semtimedop}'.
* tapset/linux/syscalls2.stp: Fix types and nesting in syscall.semctl,
syscall.semget, syscall.semop, and syscall.semtimedop.
* tapset/linux/nd_syscalls2.stp: Ditto.
* tapset/linux/aux_syscalls.stp: Add SEMOP, SEMCTL, and SEMTIMEDOP defines
when needed.
* tapset/linux/syscalls.stpm: Add __compat_syscall_gate_negative macro.
* tapset/linux/s390/syscalls.stp: Since syscall.ipc was interferring with
the new syscall.sem* work, go ahead and deprecate syscall.ipc now.
* tapset/linux/s390/nd_syscalls.stp: Ditto.
* testsuite/systemtap.syscall/semctl.c: New testcase.
* testsuite/systemtap.syscall/semget.c: Ditto.
* testsuite/systemtap.syscall/semop.c: Ditto.
* testsuite/buildok/syscalls2-detailed.stp: Add tests for new convenience vars.
* testsuite/buildok/nd_syscalls2-detailed.stp: Ditto.
* testsuite/buildok/syscalls-arch-detailed.stp: Only test s390x
syscall.ipc when needed.
* testsuite/buildok/nd_syscalls-arch-detailed.stp:: Ditto.
William Cohen [Wed, 19 Nov 2014 14:48:49 +0000 (09:48 -0500)]
Add arm64 loader to the whitelist of interpreters
All the systemtap.base/listing_mode.exp tests that probed the library
were failing (pr17622) because the code did not have the arm64 loader
whitelisted. Added the appropriate arm64 loader to the whitelist to
resolve this issue.
William Cohen [Fri, 14 Nov 2014 04:52:44 +0000 (23:52 -0500)]
Correct nodebug mkdirat syscall argstr
The debuginfo mkdirat syscall prints a string for the first argument.
However, the nodebug version just printed the numerical value of the
first arg. Some of the testsuite/systemtap.syscall/nd_syscall.exp
tests were failing because of the difference in output.
William Cohen [Fri, 14 Nov 2014 04:39:27 +0000 (23:39 -0500)]
Improve arm64 syscall/nd_syscall test results
A number of syscalls are remapped on the arm64 to newer, more general syscalls.
The older syscalls are not implemented on arm64. The tests should match those
newer, more general syscalls.
David Smith [Thu, 6 Nov 2014 20:47:36 +0000 (14:47 -0600)]
Fixed BZ1160837 by updating the iostat-scsi.stp example.
* testsuite/systemtap.examples/io/iostat-scsi.stp: Updated for newer
kernels like RHEL7 and rawhide. Probes the "sd_init_command" kernel
function which replaced "sd_prep_fn" in newer kernels. Added whitespace
for more clarity.
William Cohen [Fri, 31 Oct 2014 16:24:55 +0000 (12:24 -0400)]
Estimate the frequency of the arch64 get_cycle()
Unlike 32-bit arm the 64-bit has a working get_cycle() function and
the SystemTap runtime support should make an attempt to estimate the
frequency of get_cycle(). This change will make scripts using time
information on aarch64 produce accurate results.
Frank Ch. Eigler [Thu, 16 Oct 2014 20:25:55 +0000 (16:25 -0400)]
RHBZ1153673: speculatively correct segv in dead_control_remover
It was reported that ::visit_block was occasionally called with
a 0-size input vs[]. That leads to an array overflow, as the
for condition becomes apprx. (i < UINT_MAX).
for (size_t i = 0; i < vs.size() - 1; ++i)
do_something_with (vs[i]);
Abegail Jakop [Thu, 9 Oct 2014 21:31:35 +0000 (17:31 -0400)]
PR11528: put retval assignment after arg assignments
translate.cxx: moved generated c portion for the retval assignment from
::c_assign to ::visit_functioncall, after function argument assignments
to avoid complicationns with nested functioncalls
William Cohen [Thu, 9 Oct 2014 02:06:32 +0000 (22:06 -0400)]
Make the -DDEBUG_UNWIND output more tolerant of types used in struct pt_regs
On aarch64 u64 rather than unsigned long is used to store various
register values in struct pt_regs. When -DDEBUG_UNWIND is used to
compile SystemTap scripts the warning from the type mismatches causes
the module builds to fail. The kernel's
Documentation/printk-formations.txt suggests explicit typecast to
unsigned long long and using %llu as the print specifier in these
cases.
Lukas Berk [Wed, 8 Oct 2014 17:54:29 +0000 (13:54 -0400)]
Add support for getrandom, memfd_create, seccomp syscalls
Linux 3.17 added several syscalls, we need to add support for them
as well.
*aux_syscalls.stp - aux funcitions for sorting through flags
*nd_syscalls.stp - no debuginfo impl for getrandom,memfd_create
*nd_syscalls2.stp - no debuginfo impl for seccomp
*syscalls.stp - impl for getrandom,memfd_create
*syscalls2.stp - impl for seccomp
*buildok/nd_syscalls-details.stp - testcase for nd getrandom, memfd_create
*buildok/nd_syscalls2-details.stp - testcase for nd seccomp
*buildok/syscalls-details.stp - testcase for getrandom, memfd_create
*buildok/syscalls2-details.stp - testcase for seccomp
*systemtap.syscall/getrandom.c - test of the actual getrandom syscall
*systemtap.syscall/memfd_create.c - test of the actual memfd_create syscall
William Cohen [Tue, 7 Oct 2014 14:44:28 +0000 (10:44 -0400)]
Define __NR_epoll_wait if not defined (PR17462)
On arm64 __NR_epoll_wait is not defined and some of probes will fail
to build because of the lacking define (PR17462). This makes sure there
is a sane definition, so scripts compile.
Abegail Jakop [Wed, 1 Oct 2014 20:49:39 +0000 (16:49 -0400)]
PR11528: new pragma "unmodified-fnargs" for embedded-c
elaborate.cxx: remove the portion in semantic_pass_opt2() that populates
a vector with unmodified function args
translate.cxx: new function that uses a new visitor to determine if the body
of a function modifies the function arguments. for embedded code, it checks
for the presence of the pure or unmodified-fnargs pragma.
translate.cxx: in ::c_assign(), when the rval is a functioncall and the
function returns a string, the retval is points to the destination.
c_unparser::visit_functioncall() handles the case where the return value
of the function is not used, by setting the destination to a tmpvar.
PR16806: tweak test case to guarantee stoppage better
We run the "./loop" executable under /usr/bin/timeout control, but on
RHEL6, uprobes can take a while to sync up for some reason, leading to
a testsuite hang. Switch to timeout -s KILL, moohahahaha, from orbit.
stp: rt: replace stp_print lock with stp style lock
-rt mode preemptable spin lock lead to deadlock causes x86 box to freeze.
Replacing spin lock with stp type raw lock solves the problem. Observed
deadlock in make installcheck testsuite for sched_switch.stp test case.
stp: rt: replace addr_map_lock rd/wr lock with stp type raw lock
Without this change, Noticed that make installcheck freezes x86_64 box, testing
done on IvyBridge v2 12 core (HT). With crash post mortem analysis observed
that multiple threads grabs rd lock and get preempted in rt mode which
shouldn't ideally be the expected flow. rd/wr lock is preemptible which is
causing this problem for -rt mode so replace them with stp style raw lock.
However I poited out in other patches that replacement of rd/wr with rcu lock
in general better approach, we'll revisit them later(todo).
Note : This module afaiu is prime candidate to benifit rcu locking primitives
and same some cycle, should improve overall performance, more scallable.
[This is general desing improvement so keeping those changes out from this
patch. .todo]
Replacing rd/wr lock with raw lock supress these bug_on. However more suitable
fix is to replace read/write lock in general with RCU style lock, followed by
use of rcu variant hlist api but current module desing need to go through some
real desing chnages in order of adding and freeing entry to/from free list,
which i choose work upon as separate patch[todo.]
Locking helper api used for replacing -rt and non-rt specific locks with common
helper lock starts with prefix stp_. -rt version of locking api compatible to
kernel version 3.0 and greater. Older -rt version can be supported by adding
more kernel version checks, ifdefs in header file.. I haven't tested on
those(older) kernel version so not including code for now. Tested for
3.10.40-rt38 and 3.14.12-rt9.
PR11528: pass function args as char * where possible
elaborate.cxx: store the function arguements that are not modified
within the function body
translate.cxx: change the type of unmodified, string function args
to char * and treat them as such when emitting functioncalls
Martin Cermak [Tue, 23 Sep 2014 07:03:02 +0000 (09:03 +0200)]
PR16716 partial fix: Fix types and compat support in timer syscalls family
* tapset/linux/syscalls2.stp:
syscall.timer_{delete,getoverrun,gettime,settime}: Fix types
syscall.timer_gettime: Add compat support
* tapset/linux/nd_syscalls2.stp (timer_gettime): Add compat support
* tapset/linux/aux_syscalls.stp: Print the pointer value
when _stp_copy_from_user() fails instead of reporting "UNKNOWN"
* testsuite/systemtap.syscall/test.tcl: Link with -lrt to allow
using glibc wrappers for timer syscalls family
* testsuite/systemtap.syscall/timer.c: Add more tests
Josh Stone [Fri, 12 Sep 2014 22:51:10 +0000 (15:51 -0700)]
stapdyn: use process_vm_readv/writev when possible
For script deref uses, we were using pread/pwrite on /proc/self/mem.
But thanks to CVE-2012-0056, some kernels have completely disabled
mem_write, so stapdyn guru scripts can't write memory at all. Our
testsuite failed on at_var_lvalue.exp and deref.exp in this case.
When the process_vm_readv/writev syscalls are available, we can
accomplish the same thing, and don't even need an open fd for it.
Jonathan Lebon [Fri, 12 Sep 2014 20:53:42 +0000 (16:53 -0400)]
initscript: also delete uprobes.ko during cleanup
If after cleanup we've removed all the scripts that require uprobes.ko,
then we should also delete uprobes.ko itself. It will be copied back in
the cache directory the next time a uprobes.ko dependent script is
compiled.
systemtap-initscript scripts that rely on uprobes must be configured
with the --save-uprobes option. This option saves the generated
uprobes.ko module and loads it when running the script.
The uprobes dependency information is actually available at compile time
so we can autodetect as follows:
1. Check if uprobes.ko was generated during compile
2. When uprobes.ko was generated, touch <name>.uprobes in the cache
directory.
3. Add the staprun -u option if <name>.uprobes exists
It is no longer necessary to specify the --save-uprobes option in the
initscript configuration file, although doing so allowed.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Jonathan Lebon [Fri, 12 Sep 2014 18:06:08 +0000 (14:06 -0400)]
PR17190: accept functions given with their decl_line
If the user gives a probe for a specific function, e.g.
kernel.function("vfs_read@fs/read_write.c:393")
where the vfs_read() function is declared at lineno 393, we don't
actually want to probe lineno 393 (most likely there's nothing there
anyway). We simply need to probe the function's entry point.
Jonathan Lebon [Mon, 8 Sep 2014 21:17:59 +0000 (17:17 -0400)]
nearest probes: preserve user-entered lineno in chain
This patch adds an earlier well-formed probe point in the derivation
chain of .nearest probes so that the original lineno entered is
retained during stap -l.
Martin Cermak [Wed, 10 Sep 2014 18:21:16 +0000 (20:21 +0200)]
server.exp: fix condition affecting avahi related subtests
On systemd based systems, /usr/sbin/service calls /bin/systemctl.
Unlike rhel6's /sbin/service, systemctl logs to stderr even in case
of successful service restart. Tcl's exec(), called from the as_root(),
is by default sensitive to stderr, and produced false failure.
Josh Stone [Wed, 3 Sep 2014 23:37:06 +0000 (16:37 -0700)]
Remove systemtap_session::built_uprobes
For the purpose of save_uprobes, it doesn't actually matter whether
uprobes.ko was just built or was pulled from the cache. If we have the
uprobes_path at all, go ahead and save it.