]> sourceware.org Git - systemtap.git/log
systemtap.git
6 years agoio_submit.stp: fix array membership test
Jeff Moyer [Fri, 11 May 2018 19:25:50 +0000 (15:25 -0400)]
io_submit.stp: fix array membership test

io_submit.stp keeps track of threads which are currently executing
in the io_submit system call like so:

probe syscall.io_submit {
          in_iosubmit[tid()] = 1
}

probe syscall.io_submit.return {
          /* this assumes a given proc will do lots of io_submit calls, and
           * so doesn't do the more expensive "delete in_iosubmit[p]".  If
           * there are lots of procs doing small number of io_submit calls,
           * the hash may grow pretty big, so using delete may be better
           */
          in_iosubmit[tid()] = 0
}

However, the test to see if a thread is currently executing in io_submit
is performed using the membership operator 'in':

  if (tid() in in_iosubmit)

This is obviously wrong.  We can do one of two things:
1) change the test to if (in_iosubmit[tid()] == 1) or
2) just perform the delete in the return probe

While I agree that we typically have a small number of threads performing
io_submit, I don't believe there is substance to the performance claims
for the delete operator.  So, I've opted for solution 2.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
6 years agoUpdated spec file to change dependency on net-tools to iproute
Jafeer Uddin [Fri, 25 May 2018 14:42:41 +0000 (10:42 -0400)]
Updated spec file to change dependency on net-tools to iproute

6 years agorhbz1496156: removed dependencies on deprecated net-tools package
Jafeer Uddin [Thu, 24 May 2018 19:46:46 +0000 (15:46 -0400)]
rhbz1496156: removed dependencies on deprecated net-tools package

* java/stapbm.in: replaced netstat with ss

6 years agoChange the http docker backend to run systemtap in the container image.
David Smith [Wed, 23 May 2018 17:37:07 +0000 (12:37 -0500)]
Change the http docker backend to run systemtap in the container image.

* httpd/backends.cxx (docker_backend::generate_module): Switch back to
  running systemtap inside the container. Trying to use the container
  image as a sysroot didn't work well. Trying to run systemtap on the
  sysroot worked fine, but running gcc 8 (f28) against a centos 7
  sysroot's kernel source failed. Trying to run the centos 7 gcc from f28
  kept crashing. So, we're back to running systemtap in the container
  image.

6 years agorpm: by default, configure with --enable-docs=prebuilt
Frank Ch. Eigler [Wed, 16 May 2018 17:35:13 +0000 (13:35 -0400)]
rpm: by default, configure with --enable-docs=prebuilt

6 years agoFix testcases broken by not expectig 'WARNING: Missing unwind data'
Martin Cermak [Tue, 22 May 2018 11:59:35 +0000 (13:59 +0200)]
Fix testcases broken by not expectig 'WARNING: Missing unwind data'

* lib/stap_run.exp: Fix systemtap.base/caller.exp
* systemtap.base/backtrace.exp: Fix itself
* systemtap.context/backtrace.tcl: Fix systemtap.context/context.exp

6 years agoFix testcase systemtap.string/text_str.exp
Martin Cermak [Thu, 17 May 2018 08:51:18 +0000 (10:51 +0200)]
Fix testcase systemtap.string/text_str.exp

PR22991 (Invalid truncation of quoted strings) was fixed in
commit fa4f499d8c92600702853d763ae3ea45002c07e3, but respective
change hasn't been applied to systemtap.string/text_str.exp.
Adding the missing bit.

6 years agoFix testcase systemtap.unprivileged/unprivileged_embedded_C.exp
Martin Cermak [Wed, 16 May 2018 09:56:20 +0000 (11:56 +0200)]
Fix testcase systemtap.unprivileged/unprivileged_embedded_C.exp

Commit 2f6fcfc6 (Fix BZ1546179 by being careful when accessing
sk_buff structures) made the "unprivileged_embedded_C.exp"
testcase unhappy.  It started to report false positives.

Thing is that embeddedc.awk can't correctly parse two block
boundaries at a line, which is exactly what the commit introduces
by adding "} catch { }", or "try { ... } catch { }".  Here is the
failure as observed with git stap 0e051c5:

=======
FAIL: unprivileged embedded C: : --unprivileged: Unterminated block at: function _input_route_type:long (skb:long): 2 0
FAIL: unprivileged embedded C: : --privilege=stapusr: Unterminated block at EOF: 2 0
FAIL: unprivileged embedded C: : --privilege=stapsys: Unterminated block at: function _input_route_type:long (skb:long): 2 0
FAIL: unprivileged embedded C: : --privilege=stapsys: Unterminated block at EOF: 2 0
FAIL: unprivileged embedded C (transitive): : --privilege=stapusr: Unterminated block at: function _input_route_type:long (skb:long): 2 0
FAIL: unprivileged embedded C (transitive): : --privilege=stapsys: Unterminated block at: function _input_route_type:long (skb:long): 2 0
=======

This commit tries to address the issue by making embeddedc.awk
able to process two block boundaries at a line.

6 years agostapbpf: add foreach loop support
Aaron Merey [Fri, 11 May 2018 23:02:06 +0000 (19:02 -0400)]
stapbpf: add foreach loop support

* bpf-translate.cxx (visit_foreach_loop): translates foreach loops.

* bpf-internal.h (BPF_FUNC_map_get_next_key): add id for map_get_next_key.

* bpfinterp.cxx (bpf_interpret): call map_get_next_key when function id equals
  BPF_FUNC_map_get_next_key. (map_get_next_key): wrapper for bpf_get_next_key
  that includes support for limiting number of iterations and iterating in
  ascending/descending order.

* bpf_tests/foreach.stp: tests these changes.

6 years agoSend the target executable over to the http server.
David Smith [Mon, 7 May 2018 19:14:12 +0000 (14:14 -0500)]
Send the target executable over to the http server.

* httpd/backends.cxx (docker_backend::generate_module): Add the date and
  time to the docker image name, to make them easier to remove. Copy any
  target files from the zip file into the docker image.
* client-http.cxx (http_client::get_rpmname): If an rpm doesn't contain
  the file we're searching for, just return the empty string.
  (http_client_backend::include_file_or_directory): Only include the file
  or directory in the command line arguments if the callers asks.
  (http_client_backend::package_request): Move code from
  http_client_backend::find_and_connect_to_server(). If get_rpmname()
  returns the empty string, add the file so that it will get transferred
  over to the server.
  (http_client_backend::find_and_connect_to_server): Move code to
  http_client_backend::package_request().
* client-http.h (http_client_backend::include_file_or_directory): Updated
  prototype.
* client-nss.cxx (nss_client_backend::include_file_or_directory): Only
  include the file or directory in the command line arguments if the
  callers asks.
* client-nss.h (nss_client_backend::include_file_or_directory): Updated
  prototype.
* csclient.h: Updated client_backend::include_file_or_directory()
  prototype.

6 years agostapbpf: ensure uprobe DWARF offsets are 64-bits wide.
Aaron Merey [Fri, 4 May 2018 22:16:10 +0000 (18:16 -0400)]
stapbpf: ensure uprobe DWARF offsets are 64-bits wide.

stapbpf.cxx: change type of DWARF offset from unsigned long to unsigned long long.

6 years agoMerge branch 'master' of ssh://sourceware.org/git/systemtap
Aaron Merey [Fri, 27 Apr 2018 15:27:28 +0000 (11:27 -0400)]
Merge branch 'master' of ssh://sourceware.org/git/systemtap

6 years agostapbpf: replace uint64_t with unsigned long for 32-bit compatibility
Aaron Merey [Fri, 27 Apr 2018 15:25:23 +0000 (11:25 -0400)]
stapbpf: replace uint64_t with unsigned long for 32-bit compatibility

6 years agomips registers.stp: support oabi for kernel registers
Gustavo Moreira [Thu, 26 Apr 2018 20:57:49 +0000 (16:57 -0400)]
mips registers.stp: support oabi for kernel registers

6 years agostapbpf: add uprobe support
Aaron Merey [Wed, 25 Apr 2018 22:24:07 +0000 (18:24 -0400)]
stapbpf: add uprobe support

* bpf-translate.cxx (translate_bpf_pass): translate uprobe_derived_probes.

* stapbpf.cxx (collect_uprobes, register_uprobes, unregister_uprobes): read uprobe
  information from the .bo file, register/unregister uprobes via debugfs.

* tapsets.cxx (sort_for_bpf): create section names for each uprobe.

* tapsets.h: add necessary declarations.

* bpf_tests/uprobes.stp: smoke test for stapbpf uprobe support.

* bpf.exp: when running bpf_tests/uprobes.stp, spawn a process that triggers the test's probes.

6 years agodwflpp::resolve_prologue_endings should use dwarf_haspc, not highpc.
Mark Wielaard [Sun, 22 Apr 2018 20:50:55 +0000 (22:50 +0200)]
dwflpp::resolve_prologue_endings should use dwarf_haspc, not highpc.

A function can have multiple non-consecutive ranges (for example when
a function is split into a hot and cold part, that are put in separate
sections). resolve_prologue_endings would use the highpc attribute of
a function DIE to see if an address was "beyond" the function (and so
also beyond the prologue). That could cause unexpected errors when
the DIE didn't have a highpc, but only a lowpc and ranges attribute.
Use dwarf_haspc () instead to test whether an address is inside a
function.

See also https://sourceware.org/ml/systemtap/2018-q2/msg00029.html

6 years agoRHBZ1552745: staprun to set /proc/sys/kernel/kptr_restrict=1 on linux >= v4.15
Frank Ch. Eigler [Sun, 22 Apr 2018 18:36:22 +0000 (14:36 -0400)]
RHBZ1552745: staprun to set /proc/sys/kernel/kptr_restrict=1 on linux >= v4.15

Kernels >= 4.15 obscure /sys/module/$MODULE/section/$SECTION pointers
even to root users, unless kptr_restrict is set to 1.  Since we need
this information unobscured for module section-address configuration
at module startup, set that flag, unless $STAP_BZ1552745_OVERRIDE
exists.

6 years agoUpdate mysql and xulrunner testapps
Stan Cox [Fri, 20 Apr 2018 20:53:08 +0000 (16:53 -0400)]
Update mysql and xulrunner testapps

6 years agoPR22991: Store escape sequence pointer before early break
Aaron Merey [Thu, 19 Apr 2018 16:37:40 +0000 (12:37 -0400)]
PR22991: Store escape sequence pointer before early break

runtime/stp_string.c (_stp_text_str): Capture the escape sequence
pointer before a possible while loop break instead of after. Needed
for correct truncation of UTF-8 literals. Also rename variable 'len'
to 'esc_len' for better clarity.

6 years agoruntime/stp_string.c: Remove unused variable.
Aaron Merey [Wed, 18 Apr 2018 22:57:09 +0000 (18:57 -0400)]
runtime/stp_string.c: Remove unused variable.

Variable was mistakenly added in commit fa4f499d8c.

6 years agoPR22991: Fix invalid truncation of quoted strings
Aaron Merey [Wed, 18 Apr 2018 22:46:46 +0000 (18:46 -0400)]
PR22991: Fix invalid truncation of quoted strings

* runtime/stp_string.c (_stp_text_str): If truncation will remove part
  of an escape sequence, then truncate the entire sequence instead.

6 years agoMake kernel DWARF unwinder work with ksalr.
Mark Wielaard [Wed, 18 Apr 2018 13:00:24 +0000 (15:00 +0200)]
Make kernel DWARF unwinder work with ksalr.

The .debug_frame loaded from disk is already relocated against the
expected load offset of the kernel, but the actual static (load)
address might be different (with kaslr). So adjust the startLoc
for that difference when reading any address from the unwind table.

6 years agoDocument remote server testing in testsuite/lib/http_server.exp.
David Smith [Tue, 17 Apr 2018 20:40:31 +0000 (15:40 -0500)]
Document remote server testing in testsuite/lib/http_server.exp.

6 years agoRevert "PR22193: don't elide regex match '=~' operator since it's now side-effecting"
Serhei Makarov [Tue, 17 Apr 2018 19:59:11 +0000 (15:59 -0400)]
Revert "PR22193: don't elide regex match '=~' operator since it's now side-effecting"

This reverts commit 81e03c8fea43b3547a945306218f12722f78eb36, because it broke
elision (e.g. in tapset/linux/syscalls.stpm, see _af_inet_info_u()).

6 years agoloc2stap.c: Give proper error message for unhandled DW_OP_GNU_parameter_ref.
Mark Wielaard [Tue, 17 Apr 2018 16:50:31 +0000 (18:50 +0200)]
loc2stap.c: Give proper error message for unhandled DW_OP_GNU_parameter_ref.

6 years agoChange the http docker backend to use the docker image as a sysroot.
David Smith [Tue, 17 Apr 2018 16:04:30 +0000 (11:04 -0500)]
Change the http docker backend to use the docker image as a sysroot.

* httpd/backends.cxx (docker_backend::generate_module): Switch from
  running systemtap in the docker container to mounting the container and
  using it as a sysroot.
* httpd/docker/fedora.json: Update the docker container to run
  "symlinks".
* httpd/docker/centos.json: Ditto.

6 years agoRHBZ1566422 - fix spurious Build-id mismatch when probing reinserted kernel module
Serhei Makarov [Tue, 17 Apr 2018 15:35:00 +0000 (11:35 -0400)]
RHBZ1566422 - fix spurious Build-id mismatch when probing reinserted kernel module

Code for newer kernels did not clear the address of the notes-section
when a probed module was unloaded. This caused spurious Build-id mismatch
when the module was reinserted as new addresses are not computed for
dynamically loaded modules (see also: PR23068) and the Build-id check
was trying to read the notes section at the no-longer-valid old address.

* runtime/sym.c (_stp_module_notifier): clear addresses on
MODULE_STATE_GOING in newer kernels (>=3.10) too.
* runtime/transport/symbols.c (_stp_kmodule_update_address): fix logic
error and clear notes section addr when reloc=NULL (aka. 'all').

6 years agoFix httpd/docker/fedora_install_package.py to correctly handle file paths.
David Smith [Tue, 17 Apr 2018 15:26:48 +0000 (10:26 -0500)]
Fix httpd/docker/fedora_install_package.py to correctly handle file paths.

* httpd/docker/fedora_install_package.py (PkgSystem.build_id_is_valid):
  Handle 'UsrMove' feature by just comparing file basenames, instead of
  full paths.

6 years agolinux runtime: Add support for new kernel unwind fallback.
Mark Wielaard [Tue, 17 Apr 2018 12:36:13 +0000 (14:36 +0200)]
linux runtime: Add support for new kernel unwind fallback.

In newer kernels dump_trace got replaced by a new unwind infrastructure.
Add a new autoconf-unwind-stack-trace.c to detect whether we can use it.
Extend the runtime/stack.c _stp_stack_print_fallback with a new pt_regs*
argument. Update all callers and add dbug_unwind output to show which
fallback unwinder we are selecting (or if we are just giving up).
Rename the struct unwind_state in unwind.c and unwind.h to uw_state
because the old name now conflicts with the one used in the kernel.

6 years agoAdd a http server test case.
David Smith [Mon, 16 Apr 2018 21:49:57 +0000 (16:49 -0500)]
Add a http server test case.

* testsuite/lib/http_server.exp: New file.
* testsuite/systemtap.http_server/http_server.exp: New test.
* testsuite/config/unix.exp: Added http_server.exp.
* testsuite/lib/systemtap.exp: Include server_ns.exp.

6 years agoFix the http server local backend to run the correct stap version.
David Smith [Mon, 16 Apr 2018 21:44:02 +0000 (16:44 -0500)]
Fix the http server local backend to run the correct stap version.

* httpd/backends.cxx (local_backend::generate_module): Make sure we're
  running the correct version of systemtap.

6 years agoRedirect all 'clog' output from the http server to the log file.
David Smith [Mon, 16 Apr 2018 21:27:00 +0000 (16:27 -0500)]
Redirect all 'clog' output from the http server to the log file.

* httpd/main.cxx (parse_cmdline): Also send 'clog' output to the log file.
* nsscommon.cxx (start_log): Added an option to redirect 'clog' output to
  the log file.
* nsscommon.h: Update start_log() prototype.

6 years agoFix a small bug in follow_link().
David Smith [Mon, 16 Apr 2018 21:24:36 +0000 (16:24 -0500)]
Fix a small bug in follow_link().

* util.cxx (follow_link): Correctly terminate strings after calling
  readlink().

6 years agoImprove http_client::get_rpmname().
David Smith [Mon, 16 Apr 2018 15:46:52 +0000 (10:46 -0500)]
Improve http_client::get_rpmname().

* client-http.cxx (http_client::get_rpmname): Clean up memory leaks (found
  by valgrind) and improve/simplify the rpm finding logic.

6 years agoFix error in last client-http.cxx commit.
David Smith [Mon, 16 Apr 2018 15:44:45 +0000 (10:44 -0500)]
Fix error in last client-http.cxx commit.

* client-http.cxx (http_client_backend::unpack_response): Fix error
  introduced in commit 82191ce.

6 years agoClean up some http server memory leaks found by valgrind.
David Smith [Fri, 13 Apr 2018 13:15:29 +0000 (08:15 -0500)]
Clean up some http server memory leaks found by valgrind.

* httpd/api.cxx (resource::~result_info): New function.
  (build_info::~build_info): Be sure to erase the result from the results
  list.
  (result_infos_erase): New function.
* httpd/backends.cxx (backends_atexit_handler): New function.
  (get_backends): Run backends_atexit_handler() at exit.
* httpd/backends.h: Add virtual backend_base destructor.
* httpd/server.cxx (get_key_values): Call json_object_put() to free the
  created json object.

6 years agoThe http server code now cleans up environment variables.
David Smith [Wed, 11 Apr 2018 13:11:16 +0000 (08:11 -0500)]
The http server code now cleans up environment variables.

* httpd/api.cxx (response build_collection_rh::POST): Clean up the
  environment variable list the client sends the server.
* httpd/main.cxx (main): Clean up the environment variables.

6 years agostapbpf: remove BPF map copy logic from interpreter
amerey [Tue, 10 Apr 2018 22:02:50 +0000 (18:02 -0400)]
stapbpf: remove BPF map copy logic from interpreter

bpfinterp.cxx, bpfinterp.h, stapbpf.cxx: Remove map structs and copy logic.
Instead, perform lookups/updates/deletes on BPF maps directly via bpf().

6 years agoRHBZ1558350: fix typo in linux/nfsd.stp
Serhei Makarov [Tue, 10 Apr 2018 20:13:36 +0000 (16:13 -0400)]
RHBZ1558350: fix typo in linux/nfsd.stp

* linux/nfsd.stp (probe nfsd.proc2.create): fix typo.

6 years agoRHBZ1563052: fix off-by-one error in loc2c-runtime.h
Serhei Makarov [Tue, 10 Apr 2018 18:40:19 +0000 (14:40 -0400)]
RHBZ1563052: fix off-by-one error in loc2c-runtime.h

The new version of kderef_string (added along with the new eBPF
runtime) copies an additional character compared to the old version.

* runtime/linux/loc2c-runtime.h (_stp_deref_string_nofault): reduce len by 1 to leave room for NUL terminator.
* testsuite/systemtap.base/set_kernel.stp: testcase for this bug.

6 years agoThe http client code now asks the server to delete the build info.
David Smith [Thu, 5 Apr 2018 15:55:31 +0000 (10:55 -0500)]
The http client code now asks the server to delete the build info.

* client-http.cxx (http_client_backend::delete_op): Send a delete request
  to the server.
  (http_client_backend::unpack_response): After downloading everything,
  call delete_op().
* httpd/api.cxx (individual_build_rh::DELETE): New function.

6 years agoBPF translator: improve register interference checking
amerey [Tue, 3 Apr 2018 21:55:00 +0000 (17:55 -0400)]
BPF translator: improve register interference checking

bpf_opt.cxx (allocate): Apply the addition checks added to merge()
in commit 883ecae33bb. (reg_alloc): change while loop to for loop
to better indicate how num_spills is updated.

6 years agoHandle removing http server temporary directories on shutdown.
David Smith [Thu, 29 Mar 2018 16:20:23 +0000 (11:20 -0500)]
Handle removing http server temporary directories on shutdown.

* httpd/api.cxx (build_info::~build_info): Removes temporary directory.
  (build_info::module_build): Save temporary directory name.
  (client_request_data::~client_request_data): New function.
* httpd/api.h (client_request_data): Add destructor declaration.
* httpd/docker/stap_build_docker_image.py: Removes temporary directory.

6 years agoFix the systemtap testsuite LD_LIBRARY_PATH.
Martin Cermak [Wed, 28 Mar 2018 09:50:13 +0000 (11:50 +0200)]
Fix the systemtap testsuite LD_LIBRARY_PATH.

The goal here is to ensure the right dyninst libraries are used.
Systemtap is not only packaged for base RHEL/CentOS, but also as
a part of SCL (red hat developer toolset).  In case of SCL we need
to ensure that SCL version of systemtap tests against SCL version
of dyninst and the same is true for base os versions of both
components.

Before this change devtoolset version of systemtap was running
its tests against base rhel version of dyninst, and if that was
missing, dyninst tests were crashing.

This is a testsuite problem only, unrelated to normal stap usage.

6 years agoDrop Python 2 subpackage in future systems
Petr Viktorin [Tue, 27 Mar 2018 18:34:55 +0000 (14:34 -0400)]
Drop Python 2 subpackage in future systems

6 years agoremote: fixes for bpf runtime
amerey [Tue, 27 Mar 2018 17:12:58 +0000 (13:12 -0400)]
remote: fixes for bpf runtime

remote.cxx (class direct, stapsh): Set file extension to .bo and leave args
empty for bpf runtime.

6 years agoPR22193: don't elide regex match '=~' operator since it's now side-effecting
Serhei Makarov [Fri, 23 Mar 2018 16:03:19 +0000 (12:03 -0400)]
PR22193: don't elide regex match '=~' operator since it's now side-effecting

NB: If we detected /* pragma: tagged_dfa */ earlier and set
session.need_tagged_dfa earlier, we would be able to safely elide
regex matches in programs that don't use the matched() tapset.

* elaborate.cxx (void_statement_reducer::visit_regex_query): Assume '=~' is side-effecting.
* staptree.h (varuse_collecting_visitor::visit_regex_query): New function.
* staptree.cxx (varuse_collecting_visitor::visit_regex_query): Assume '=~' is side-effecting.

* testsuite/runok/regex_noelide.stp: Make regex slightly more interesting.

6 years agoFix the naming convention problem for python-setuptools.
Martin Cermak [Fri, 23 Mar 2018 13:37:07 +0000 (14:37 +0100)]
Fix the naming convention problem for python-setuptools.

There is no python2-setuptools.rpm for any of rhel{6,7}.

EPEL6 has python2-setuptools.rpm, but it merely is a dummy wrapper
for python-setuptools.rpm.  ATM, there is no other reason to use EPEL
on RHEL than this, so it's better to avoid it entirely.  RHEL7
depsolver can pair python-setuptools.rpm with python2-setuptools.rpm
via Provides, but there is no python2-setuptools.rpm for RHEL7
either.  But Fedora does have python2-setuptools.rpm.

6 years agosysroot: fix short release -r option handling follow up
Victor Kamensky [Thu, 22 Mar 2018 21:02:02 +0000 (16:02 -0500)]
sysroot: fix short release -r option handling follow up

In case of sysroot set and short release -r option it does not make sense
to pass short release name into dwfl_linux_kernel_report_offline
function. This function is not aware about sysroot and it won't look for
kernel modules under sysroot directory.

6 years agoFor RHEL7, fix pyparsing require in systemtap.spec
Martin Cermak [Thu, 22 Mar 2018 20:49:44 +0000 (15:49 -0500)]
For RHEL7, fix pyparsing require in systemtap.spec

* systemtap.spec: Fixed pyparsing requires issue for RHEL7. The package
  appears to have changed names.

6 years agoWhen enabling python2 probes, make sure we find the right config program.
David Smith [Thu, 22 Mar 2018 19:15:04 +0000 (14:15 -0500)]
When enabling python2 probes, make sure we find the right config program.

* configure.ac: For the python config program, look for 'python2-config'
  and 'python-config'.
* configure: Regenerated.

6 years agoRemove C++11 string member function use for RHEL6.
David Smith [Thu, 22 Mar 2018 15:59:13 +0000 (10:59 -0500)]
Remove C++11 string member function use for RHEL6.

* session.cxx (parse_cmdline): Remove C++11 string member function use for
  RHEL6. Functions include back(), front(), and push_back(), which can be
  easily replaced.
* setupdwfl.cxx (debuginfo_path_insert_sysroot): Ditto.
* tapsets.cxx (path_remove_sysroot): Ditto.
* util.cxx (get_distro_info): Ditto.
  (get_distro_info): Ditto.

6 years agoFix sysroot_sysenv.exp for RHEL6.
David Smith [Thu, 22 Mar 2018 15:56:01 +0000 (10:56 -0500)]
Fix sysroot_sysenv.exp for RHEL6.

* testsuite/systemtap.base/sysroot_sysenv.exp: Fix test for RHEL6 by bind
  mounting /usr/src/kernels down into the fake sysroot.

6 years agoAdd lots more sysroot testing to systemtap.base/sysroot_sysenv.exp.
David Smith [Wed, 21 Mar 2018 16:39:17 +0000 (11:39 -0500)]
Add lots more sysroot testing to systemtap.base/sysroot_sysenv.exp.

* testsuite/systemtap.base/sysroot_sysenv.exp: Add tests based on the 6
  sysroot patches sent in by Victor Kamensky. These will hopefully keep
  the sysroot functionality working. The tests use a custom mount
  namespace to "move" the system's /usr/lib/debug and /lib/modules
  directories into a sysroot directory.

6 years agosysroot: handle symbolic links with absolute name relative to sysroot
Victor Kamensky [Wed, 21 Mar 2018 16:35:26 +0000 (11:35 -0500)]
sysroot: handle symbolic links with absolute name relative to sysroot

In case of symbolic link found under sysroot point to absolute path,
instead of trying to look for such absolute path in host system,
apply sysroot prefix first.

6 years agoCorrected shebang on testsuite/runok/regex_noelide.stp
Serhei Makarov [Wed, 21 Mar 2018 14:17:03 +0000 (10:17 -0400)]
Corrected shebang on testsuite/runok/regex_noelide.stp

6 years agoCorrected file permissions on testsuite/runok/regex_noelide.stp
David Smith [Tue, 20 Mar 2018 20:15:40 +0000 (15:15 -0500)]
Corrected file permissions on testsuite/runok/regex_noelide.stp

6 years agoBPF translator: array elements behave as if preinitialized to 0
Aaron Merey [Tue, 20 Mar 2018 18:02:21 +0000 (14:02 -0400)]
BPF translator: array elements behave as if preinitialized to 0

Previously we exited a probe if there was an attempt to use an element
that an array did not contain. This does not match the behavior of the
default runtime which acts as though the element was preinitialized to
0. This commit changes the translator to match this behavior.

bpf-translate.cxx (visit_arrayindex): If map_lookup_elem returns 0,
set result to 0 instead of jumping to exit_block.

bpf_tests/array_preinit.stp: tests this change.

6 years ago_stp_umodule_relocate needs target file path, not host file path
Victor Kamensky [Tue, 20 Mar 2018 17:41:05 +0000 (12:41 -0500)]
_stp_umodule_relocate needs target file path, not host file path

Strip of sysroot from module name is required when _stp_umodule_relocate
call is generated. Otherwise path won't match path on target and could
will fail to calculated address within the file.

6 years agoconfigure: add option --enable-docs=prebuilt
Serhei Makarov [Tue, 20 Mar 2018 15:40:21 +0000 (11:40 -0400)]
configure: add option --enable-docs=prebuilt

6 years agoAdded a couple of small sysroot fixes.
David Smith [Mon, 19 Mar 2018 21:50:05 +0000 (16:50 -0500)]
Added a couple of small sysroot fixes.

* tapsets.cxx (dwarf_builder::build): Fix commit 4ffecddf5.
  (path_remove_sysroot): Fix extra '/' present at start of paths.

6 years agoDelay adding sysroot path to module name in case of non absolute executable
Victor Kamensky [Mon, 19 Mar 2018 13:53:51 +0000 (08:53 -0500)]
Delay adding sysroot path to module name in case of non absolute executable

Current stap code adds sysroot prematurely for probes that specify non
absolute path name, i.e like "foo", so when find_executable called it
receives full path as <sysroot>/foo and find_executable does not search
PATH while applying sysroot.

Fix delays adding sysroot till path inside of sysroot is searched first.

Also fix missing sysroot addition in glob expansion case.

6 years agosession.cxx: note 4.16-rc4 passes stap smoke tests
Frank Ch. Eigler [Thu, 15 Mar 2018 16:43:40 +0000 (12:43 -0400)]
session.cxx: note 4.16-rc4 passes stap smoke tests

6 years agostap-prep: prefer dnf to yum
Frank Ch. Eigler [Thu, 15 Mar 2018 15:48:52 +0000 (11:48 -0400)]
stap-prep: prefer dnf to yum

Use dnf and dnf debuginfo-install if available, since these understand
some newer rpm constraints than yum does.  e.g., "or" constraints
on rawhide kernels.

6 years agosysroot: fix short release -r option handling
Victor Kamensky [Wed, 14 Mar 2018 22:09:44 +0000 (17:09 -0500)]
sysroot: fix short release -r option handling

* setupdwfl.cxx (debuginfo_path_insert_sysroot): Add a '/' to the end of
  the sysroot for path_insert_sysroot().
  (setup_dwfl_kernel): Simplify logic when finding the kernel path to send
  to elfutils.

6 years agoMake sure sysroot paths don't end with a slash.
David Smith [Wed, 14 Mar 2018 22:05:25 +0000 (17:05 -0500)]
Make sure sysroot paths don't end with a slash.

* session.cxx (parse_cmdline): Make sure a sysroot path does not end with
  a '/', since we build paths like: sysroot + "/lib/modules". If the
  sysroot path ends with a '/', we end up with paths like
  '/SYSROOT//lib/modules'.
  (setup_kernel_release): Take a string parameter, not a character pointer.
* session.h: Update setup_kernel_release() prototype.

6 years agodebuginfo lookup with sysroot case do not remove sysroot from file_name
Victor Kamensky [Wed, 14 Mar 2018 21:54:08 +0000 (16:54 -0500)]
debuginfo lookup with sysroot case do not remove sysroot from file_name

If sysroot option is passed, and debug symbols reside in sysroot along
with executable <foo> in <foo_dir>/.debug/<foo_file> directory,
stap fails to find debuginfo because it strips out sysroot path
from file_name so dwfl_standard_find_debuginfo ends up looking at
host <foo_dir>/.debug/<foo_file> rather then checking
<sysroot>/<foo_dir>/.debug/<foo_file>.

6 years agoImprove BPF tracepoint probe derivation
Aaron Merey [Fri, 9 Mar 2018 23:27:21 +0000 (18:27 -0500)]
Improve BPF tracepoint probe derivation

One goal of BPF tracepoint probe derivation is to determine the offsets of the members
of the BPF tracepoint context structs. These members are the probe's context variables.
The context structs always contain 8 bytes of padding before their first member.

During the probe derivation process, the context structs are replicated in the tracequery
modules and we read the module's debuginfo in order to determine the offsets of the
struct's members. Previously, the 8 bytes of padding was not included in the tracequery
structs and instead 8 was added to the offsets of members of these structs. This approach
ignores the possibility that these 8 bytes of padding could influence the amount of
padding between the struct's other members. This would result in incorrect offsets.

This patch adds an 8 byte member to the front of each of the tracequery structs to ensure
they are proper replicas of the tracepoint context structs.

6 years agoPR22193 :: test that regex match (=~) is not elided (needs fixing)
Serhei Makarov [Fri, 9 Mar 2018 19:39:19 +0000 (14:39 -0500)]
PR22193 :: test that regex match (=~) is not elided (needs fixing)

6 years agomisc PR15065 fix :: remove redundant cleanup code
Serhei Makarov [Sat, 23 Sep 2017 22:50:23 +0000 (18:50 -0400)]
misc PR15065 fix :: remove redundant cleanup code

* stapregex.cxx (stapdfa::emit_declaration): Remove redundant code.
* stapregex-dfa.cxx (dfa::emit): Make sure to clean up to STAPREGEX_MAX_TAG.
* testsuite/runok/regex_grouping.stp: Add testcase.

6 years agoBPF tapset: fix gid()
Aaron Merey [Thu, 8 Mar 2018 22:01:09 +0000 (17:01 -0500)]
BPF tapset: fix gid()

* context.stp: replace gid()'s left shift with a logical right shift.

6 years agoMerge branch 'master' of ssh://sourceware.org/git/systemtap
David Smith [Thu, 8 Mar 2018 22:02:43 +0000 (16:02 -0600)]
Merge branch 'master' of ssh://sourceware.org/git/systemtap

6 years agoUse sysroot when looking for the System.map file.
David Smith [Thu, 8 Mar 2018 22:01:58 +0000 (16:01 -0600)]
Use sysroot when looking for the System.map file.

Add sysroot to system_map_path + "/boot/System.map" case. Otherwise
stap tries to look symbols on host system and it produce error like this:

> Kernel symbol table /boot/System.map-4.9.78-yocto-standard unavailable, (No such file or directory)

6 years agoBPF tapset: use userspace naming conventions for pid(), tid()
Aaron Merey [Thu, 8 Mar 2018 21:42:11 +0000 (16:42 -0500)]
BPF tapset: use userspace naming conventions for pid(), tid()

* context.stp: Undo naming changes made in commit 2c0ba52a181ec.
  pid() now returns the userspace pid of the target process instead
  of its kernel pid. tid() now returns the userspace tid of the target
  process instead of its kernel tgid.

6 years agoBuild fix regression on systems without nss.
Victor Kamensky [Thu, 8 Mar 2018 21:12:22 +0000 (15:12 -0600)]
Build fix regression on systems without nss.

After "eb3896ef0 Add the capability to list http servers." and
"3580be162 Move the code getting a certificate from a server into
each backend." commits on a system where nss-devel is not installed
or one build systemtap with --without-nss configure option, build
fails. Fix is simple add '#if HAVE_NSS' check around new code.

6 years agoBPF tapset: fix pid(), tid()
Aaron Merey [Thu, 8 Mar 2018 19:38:28 +0000 (14:38 -0500)]
BPF tapset: fix pid(), tid()

* context.stp: BPF_FUNC_get_current_pid_tgid returns tgid << 32 | pid,
  so swap the names of pid() and tid(). Also replace tid()'s left shift
  with a logical right shift.

6 years agoBPF translator: add 'in' operator for arrays.
Aaron Merey [Wed, 7 Mar 2018 18:47:44 +0000 (13:47 -0500)]
BPF translator: add 'in' operator for arrays.

* bpf-translate.cxx (bpf_unparser::visit_array_in): add support for
  the 'in' operator.

* bpf_tests/array_in.stp: tests these changes.

6 years agoFix PR22857 by updating vfs.do_mpage_readpage.
David Smith [Mon, 5 Mar 2018 16:43:31 +0000 (10:43 -0600)]
Fix PR22857 by updating vfs.do_mpage_readpage.

* tapset/linux/vfs.stp (vfs.do_mpage_readpage): Add support for ext4,
  which uses its own function (ext4_mpage_readpages).

6 years agoFix BZ1546179 by being careful when accessing sk_buff structures.
David Smith [Fri, 2 Mar 2018 20:03:11 +0000 (14:03 -0600)]
Fix BZ1546179 by being careful when accessing sk_buff structures.

* tapset/linux/networking.stp: Fixed BZ1546179 by putting try/catch around
  sk_buff structure accesses (because the sk_buff structure has become
  quite overloaded with sharing). See block comment (or BZ1546179) for
  more details.
* tapset/linux/ipmib.stp: Ditto.
* tapset/linux/netfilter.stp: Ditto.
* tapset/linux/tcp.stp: Ditto.
* tapset/linux/tcpmib.stp: Ditto.

6 years agoBPF translator: Add register spilling
Aaron Merey [Tue, 27 Feb 2018 19:18:53 +0000 (14:18 -0500)]
BPF translator: Add register spilling

* bpf-base.cxx (program::program): Initialize max_tmp_space.

* bpf-internal.h: Add MAX_BPF_STACK and BPF_REG_SIZE macros.

* bpf-opt.cxx (reg_alloc): Add support for spilling. Move various pieces
  of code into seperate functions for improved readability (finalize_allocation,
  merge, merge_copies, allocate).
  (spill, choose_spill_reg): New functions for spilling.
  (pref_sort_reg::cmp): Now imposes a strict weak ordering (prevents
  undefined behavior when used with std::sort).

* bpf-translate.cxx (emit_store): Add calls to program::use_tmp_space.

* bpf-tests/reg_alloc2.stp: Increase number of spills and improve readability.

6 years agotestsuite: Use /usr/bin/env everywhere.
Mark Wielaard [Mon, 26 Feb 2018 10:31:44 +0000 (11:31 +0100)]
testsuite: Use /usr/bin/env everywhere.

bz5274.stp and bz5274.a.stp where still using /bin/env instead of
/usr/bin/env like every other testsuite file.

The latest coreutils in rawhide dropped old /bin/* provides.
https://bugzilla.redhat.com/show_bug.cgi?id=1549063

6 years agoAdd a minor tweak to testsuite/systemtap.stress/tapset_functions.exp.
David Smith [Fri, 23 Feb 2018 21:46:58 +0000 (15:46 -0600)]
Add a minor tweak to testsuite/systemtap.stress/tapset_functions.exp.

* testsuite/systemtap.stress/tapset_functions.exp: Tweak the way stap is
  started so that it is run the same both times. Otherwise, it can get a
  different list of functions between the two invocations.

6 years agoAdd CentOS support to the http server.
David Smith [Fri, 23 Feb 2018 21:39:03 +0000 (15:39 -0600)]
Add CentOS support to the http server.

* httpd/docker/centos.json: Add JSON config file for CentOS.
* util.cxx (get_distro_info): Handle a blank line in the /etc/os-release
  file properly. Handle quoted strings properly.
* httpd/docker/fedora_install_package.py: Add CentOS support, by fixing
  grabbing debuginfo for systems using yum.

6 years agosession.cxx: bump supported kernel version latest to 4.15.3
Frank Ch. Eigler [Fri, 23 Feb 2018 17:58:22 +0000 (12:58 -0500)]
session.cxx: bump supported kernel version latest to 4.15.3

6 years agoFix a web server memory leak.
David Smith [Thu, 22 Feb 2018 22:45:49 +0000 (16:45 -0600)]
Fix a web server memory leak.

* httpd/nss_funcs.cxx (nss_get_server_cert_info): Fix memory leak causing
  SEC_ERROR_BUSY when shutting down.

6 years agodwflpp::function_entrypc if entry or low pc isn't given use base or start.
Mark Wielaard [Thu, 22 Feb 2018 09:54:36 +0000 (10:54 +0100)]
dwflpp::function_entrypc if entry or low pc isn't given use base or start.

On Fedora rawhide a kernel compiled with GCC8 sometimes has subprograms
without an entry or low pc attribute, but with a ranges attribute. In that
case assume the base address or first start address of the range is the
entry pc to set a probe on.

6 years agoRemove %clean section
Igor Gnatenko [Wed, 14 Feb 2018 08:07:51 +0000 (09:07 +0100)]
Remove %clean section

None of currently supported distributions need that.
Last one was EL5 which is EOL for a while.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
6 years agoRemove BuildRoot definition
Igor Gnatenko [Tue, 13 Feb 2018 23:42:22 +0000 (00:42 +0100)]
Remove BuildRoot definition

None of currently supported distributions need that.
It was needed last for EL5 which is EOL now

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
6 years agoEscape macros in %changelog
Igor Gnatenko [Fri, 9 Feb 2018 08:06:23 +0000 (09:06 +0100)]
Escape macros in %changelog

Reference: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/Y2ZUKK2B7T2IKXPMODNF6HB2O5T5TS6H/
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
6 years agoFix very old Requires
Igor Gnatenko [Wed, 7 Feb 2018 16:44:25 +0000 (17:44 +0100)]
Fix very old Requires

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
6 years agoMake a few small changes to handle Fedora's switch to python 3 as default.
David Smith [Wed, 21 Feb 2018 22:09:18 +0000 (16:09 -0600)]
Make a few small changes to handle Fedora's switch to python 3 as default.

* configure.ac: Prefer 'python2' over 'python' for the python2
  executable.
* configure: Regenerated.
* httpd/backends.cxx (generate_module): Be sure which version of python
  we're calling.
* httpd/docker/stap_build_docker_image.py: Remove python shebang line
  since httpd/backends.cxx knows the right version of python to call.
* httpd/docker/fedora_install_package.py: Add comment about why using
  '/usr/bin/python' is OK.

6 years agoFix the netdev.ioctl probe point for rawhide kernels.
David Smith [Wed, 21 Feb 2018 21:18:26 +0000 (15:18 -0600)]
Fix the netdev.ioctl probe point for rawhide kernels.

* tapset/linux/networking.stp: Fix the netdev.ioctl probe alias for the
  4.16.0-0.rc1.git4.1.fc28.x86_64 kernel.

6 years agosystemtap.spec: Update Python 2 dependency declarations to new packaging standards
Iryna Shcherbina [Wed, 21 Feb 2018 19:15:45 +0000 (14:15 -0500)]
systemtap.spec: Update Python 2 dependency declarations to new packaging standards

6 years agoman error::pass5 - mention stap -t
Frank Ch. Eigler [Sat, 17 Feb 2018 21:46:06 +0000 (16:46 -0500)]
man error::pass5 - mention stap -t

6 years agoAdd undefine __brp_mangle_shebangs
Stan Cox [Wed, 14 Feb 2018 22:35:03 +0000 (17:35 -0500)]
Add undefine __brp_mangle_shebangs

6 years agoAdded strncpy()/strncat() code correctness fixes.
David Smith [Wed, 14 Feb 2018 17:11:55 +0000 (11:11 -0600)]
Added strncpy()/strncat() code correctness fixes.

* doc/SystemTap_Tapset_Reference/docproc.c: gcc version 8 (on rawhide)
  rightly complains that the following code is wrong:
char buf[PATH_MAX];
strncpy(buf, foo, PATH_MAX);
  The code should be:
strncpy(buf, foo, PATH_MAX - 1);
  Note that a similar problem occurs with strncat(). Fix these errors by
  either subtracing one from the buffer length or switching to strlcpy()
  instead of strncpy().
* runtime/task_finder_vma.c: Ditto.
* staplog.c: Ditto.
* staprun/ctl.c: Ditto.
* staprun/staprun.c: Ditto.
* stapvirt.c: Ditto.
* tapset/linux/ip.stp: Ditto.
* tapset/tokenize.stp: Ditto.
* tapset/uconversions.stp: Ditto.
* testsuite/buildok/cmdline01.stp: Ditto.
* testsuite/buildok/two.stp: Ditto.
* testsuite/systemtap.syscall/bind.c: Ditto.
* testsuite/systemtap.syscall/nfsservctl.c: Ditto.

6 years agoAdd a couple of http client/server json-c 0.13 fixes.
David Smith [Wed, 14 Feb 2018 15:20:53 +0000 (09:20 -0600)]
Add a couple of http client/server json-c 0.13 fixes.

* client-http.cxx (unpack_response): Add a json-c 0.13 (from rawhide) fix.
* httpd/server.cxx (get_key_values): Ditto.

6 years agoFixes for gcc 8
Stan Cox [Wed, 14 Feb 2018 03:38:03 +0000 (22:38 -0500)]
Fixes for gcc 8

* includes/sys/sdt.h (__SDT_COND_SIGNED):  Add CT, cast type argument

Author: Will Cohen <wcohen.redhat.com>

* stap-serverd.cxx (generate_mok, handleRequest, handle_connection):
  Catch format overflow

* translate.cxx (translate_pass): Use ref in catch.

6 years agoFix an server error message with odd spacing.
David Smith [Tue, 13 Feb 2018 22:58:01 +0000 (16:58 -0600)]
Fix an server error message with odd spacing.

* nss-server-info.cxx (add_server_trust): Make sure we don't output an
  extra space in an error message.

6 years agoMake sure the user who starts the http server trusts it as an SSL peer.
David Smith [Tue, 13 Feb 2018 19:26:59 +0000 (13:26 -0600)]
Make sure the user who starts the http server trusts it as an SSL peer.

* httpd/nss_funcs.cxx (nss_init): Make sure the server certificate is
  automatically trusted by the user starting the server.

This page took 0.062025 seconds and 5 git commands to generate.