diff --git a/.gitignore b/.gitignore index 0afdc3e..d41f27e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/systemtap-3.2.tar.gz +SOURCES/systemtap-3.3.tar.gz diff --git a/.systemtap.metadata b/.systemtap.metadata index c68e40b..ba55853 100644 --- a/.systemtap.metadata +++ b/.systemtap.metadata @@ -1 +1 @@ -cd4482870015b9429f9945588ea8846d4ace20d1 SOURCES/systemtap-3.2.tar.gz +cc065bb1047f75ae0255709185e1e7ba889e7e5e SOURCES/systemtap-3.3.tar.gz diff --git a/SOURCES/rhbz1490862.patch b/SOURCES/rhbz1490862.patch deleted file mode 100644 index fe9390a..0000000 --- a/SOURCES/rhbz1490862.patch +++ /dev/null @@ -1,20 +0,0 @@ -commit b9ede742ef4021380f50f93f33c4013a0fe8d80c -Author: David Smith -Date: Tue Nov 28 15:35:06 2017 -0500 - - rhbz1490862: more kernel f2fs tracepoint header file workarounds - -diff --git a/tapsets.cxx b/tapsets.cxx -index f571b88..e1318ec 100644 ---- a/tapsets.cxx -+++ b/tapsets.cxx -@@ -11270,6 +11270,9 @@ static vector tracepoint_extra_decls (systemtap_session& s, - they_live.push_back ("struct f2fs_sb_info;"); - they_live.push_back ("struct extent_info;"); - they_live.push_back ("struct extent_node;"); -+ they_live.push_back ("struct super_block;"); -+ they_live.push_back ("struct buffer_head;"); -+ they_live.push_back ("struct bio;"); - } - - if (header.find("radeon") != string::npos) diff --git a/SOURCES/rhbz1504009.patch b/SOURCES/rhbz1504009.patch deleted file mode 100644 index 7643891..0000000 --- a/SOURCES/rhbz1504009.patch +++ /dev/null @@ -1,49 +0,0 @@ -commit 9f81f10b0caf6dfc49c4b7ceb7902f45d37b532a (HEAD -> master, origin/master, origin/HEAD) -Author: Frank Ch. Eigler -Date: Fri Oct 20 10:01:58 2017 -0400 - - rhbz1504009: let dtrace -G -o /dev/null run, as in autoconf - - commit c245153ca193c471a8c broke the ability of dtrace to be tested in - autoconf "-G -o /dev/null" usage, because its output file name was too - simple a function of the input name, and normal users can't write to - /dev/null.dtrace-temp.c . Now we back down to mkstemp, like before, - upon a failure of the simple concatenated name. - -diff --git a/dtrace.in b/dtrace.in -index 2e2e002a5c56..25efc253b708 100644 ---- a/dtrace.in -+++ b/dtrace.in -@@ -410,8 +410,12 @@ from tempfile import mkstemp - else: - print("header: " + fname) - -- fname = filename + ".dtrace-temp.c" -- fdesc = open(fname, mode='w') -+ try: # for reproducible-builds purposes, prefer a fixed path name pattern -+ fname = filename + ".dtrace-temp.c" -+ fdesc = open(fname, mode='w') -+ except: # but that doesn't work for -o /dev/null - see rhbz1504009 -+ (ignore,fname) = mkstemp(suffix=".c") -+ fdesc = open(fname, mode='w') - providers.semaphore_write(fdesc) - fdesc.close() - cc1 = os.environ.get("CC", "gcc") -diff --git a/testsuite/systemtap.base/dtrace.exp b/testsuite/systemtap.base/dtrace.exp -index fa6b3ec3f6d3..7c60f09d70b8 100644 ---- a/testsuite/systemtap.base/dtrace.exp -+++ b/testsuite/systemtap.base/dtrace.exp -@@ -83,6 +83,13 @@ if {[file exists /tmp/XXX.o]} then { - } - exec rm -f /tmp/XXX.o - -+verbose -log "$dtrace -G -s $dpath -o /dev/null" -+if [as_non_root "$python $dtrace -G -s $dpath -o /dev/null"] { -+ fail "$test -G -o /dev/null" -+} else { -+ pass "$test -G -o /dev/null" -+} -+ - verbose -log "$dtrace -G -s $dpath -o /tmp/XXX" - catch {exec $python $dtrace -G -s $dpath -o /tmp/XXX} res - if {[file exists /tmp/XXX]} then { diff --git a/SOURCES/rhbz1506230.patch b/SOURCES/rhbz1506230.patch deleted file mode 100644 index 824242a..0000000 --- a/SOURCES/rhbz1506230.patch +++ /dev/null @@ -1,20 +0,0 @@ -commit 94b3978aa1d01f09b29dbc2d61e1a2bddec313df -Author: Lukas Herbolt -Date: Wed Oct 25 15:47:18 2017 -0500 - - Fix BZ1506230 by fixing netdev.receive probe to work on kernels after v3.14. - -diff --git a/tapset/linux/networking.stp b/tapset/linux/networking.stp -index 76174c7..17cba9c 100644 ---- a/tapset/linux/networking.stp -+++ b/tapset/linux/networking.stp -@@ -59,7 +59,8 @@ function get_netdev_name:string (addr:long) { - /// - // Main device receive routine, be called when packet arrives on network device - probe netdev.receive -- = kernel.function("netif_receive_skb") -+ = kernel.function("netif_receive_skb_internal") !, -+ kernel.function("netif_receive_skb") - { - dev_name = kernel_string($skb->dev->name) - length = $skb->len diff --git a/SOURCES/rhbz1527809.patch b/SOURCES/rhbz1527809.patch deleted file mode 100644 index 56d5a63..0000000 --- a/SOURCES/rhbz1527809.patch +++ /dev/null @@ -1,325 +0,0 @@ -commit b8d11c5e07aa1dcc8e7ec4ffff645d0589579dea -Author: David Smith -Date: Fri Jan 26 09:24:51 2018 -0600 - - BZ1527809 - Fix detaching from modules using SIGQUIT. - - * staprun/mainloop.c: Put a "/* NOTREACHED */" comment after all calls to - cleanup_and_exit() to remind the reader that cleanup_and_exit() doesn't - return. - (stp_main_loop): If we've got a pending interrupt, - but 'load_only' is set, just detach instead of sending STP_EXIT to - the module. Otherwise using SIGQUIT to detach fails and unloads the - module. - * staprun/monitor.c: Put a "/* NOTREACHED */" comment after all calls to - cleanup_and_exit() to remind the reader that cleanup_and_exit() doesn't - return. - * testsuite/systemtap.base/attach_detach.exp: New test. - -diff --git a/staprun/mainloop.c b/staprun/mainloop.c -index a60372e..63b72cc 100644 ---- a/staprun/mainloop.c -+++ b/staprun/mainloop.c -@@ -648,6 +648,7 @@ int stp_main_loop(void) - if (rc != 0) { - perror ("Unable to send STP_READY"); - cleanup_and_exit(0, rc); -+ /* NOTREACHED */ - } - - flags = fcntl(control_channel, F_GETFL); -@@ -695,12 +696,28 @@ int stp_main_loop(void) - - if (pending_interrupts) { - int btype = STP_EXIT; -- int rc = write(control_channel, &btype, sizeof(btype)); -+ int rc; -+ -+ /* If 'load_only' is set, we don't want to send STP_EXIT, -+ * which would cause any 'probe end' processing to be -+ * done. Instead, we'll just detach by calling -+ * cleanup_and_exit(). This should let the module continue to -+ * run. */ -+ if (load_only) -+ { -+ cleanup_and_exit(load_only /* = detach */, 0); -+ /* NOTREACHED */ -+ } -+ -+ rc = write(control_channel, &btype, sizeof(btype)); - dbug(2, "signal-triggered %d exit rc %d\n", pending_interrupts, rc); -- if (monitor || (pending_interrupts > 2)) /* user mashing on ^C multiple times */ -- cleanup_and_exit (load_only /* = detach */, 0); -+ if (monitor || (pending_interrupts > 2)) -+ { /* user mashing on ^C multiple times */ -+ cleanup_and_exit (load_only /* = detach */, 0); -+ /* NOTREACHED */ -+ } - else -- {} /* await STP_EXIT reply message to kill staprun */ -+ {} /* await STP_EXIT reply message to kill staprun */ - } - - /* If the runtime does not implement select() on the command -@@ -719,6 +736,7 @@ int stp_main_loop(void) - if (nb >= 0 || (errno != EINTR && errno != EAGAIN)) { - _perr(_("Unexpected EOF in read (nb=%ld)"), (long)nb); - cleanup_and_exit(0, 1); -+ /* NOTREACHED */ - } - - if (!select_supported) { -@@ -736,6 +754,7 @@ int stp_main_loop(void) - { - _perr(_("Unexpected error in select")); - cleanup_and_exit(0, 1); -+ /* NOTREACHED */ - } - } - continue; -@@ -750,6 +769,7 @@ int stp_main_loop(void) - if (write_realtime_data(recvbuf.payload.data, nb)) { - _perr(_("write error (nb=%ld)"), (long)nb); - cleanup_and_exit(0, 1); -+ /* NOTREACHED */ - } - break; - #endif -@@ -841,8 +861,10 @@ int stp_main_loop(void) - dbug(2, "got STP_EXIT\n"); - if (monitor) - monitor_exited(); -- else -+ else { - cleanup_and_exit(0, error_detected); -+ /* NOTREACHED */ -+ } - /* monitor mode exit handled elsewhere, later. */ - break; - } -@@ -863,6 +885,7 @@ int stp_main_loop(void) - if (target_cmd) - kill(target_pid, SIGKILL); - cleanup_and_exit(0, 1); -+ /* NOTREACHED */ - } else if (target_cmd) { - dbug(1, "detaching pid %d\n", target_pid); - #if WORKAROUND_BZ467568 -@@ -878,6 +901,7 @@ int stp_main_loop(void) - if (target_cmd) - kill(target_pid, SIGKILL); - cleanup_and_exit(0, 1); -+ /* NOTREACHED */ - } - #endif - } -@@ -901,20 +925,24 @@ int stp_main_loop(void) - struct _stp_msg_start ts; - struct _stp_msg_ns_pid nspid; - if (use_old_transport) { -- if (init_oldrelayfs() < 0) -+ if (init_oldrelayfs() < 0) { - cleanup_and_exit(0, 1); -+ /* NOTREACHED */ -+ } - } else { - if (init_relayfs() < 0) - cleanup_and_exit(0, 1); -+ /* NOTREACHED */ - } - - if (target_namespaces_pid > 0) { - nspid.target = target_namespaces_pid; - rc = send_request(STP_NAMESPACES_PID, &nspid, sizeof(nspid)); - if (rc != 0) { -- perror ("Unable to send STP_NAMESPACES_PID"); -- cleanup_and_exit (1, rc); -- } -+ perror ("Unable to send STP_NAMESPACES_PID"); -+ cleanup_and_exit (1, rc); -+ /* NOTREACHED */ -+ } - } - - ts.target = target_pid; -@@ -922,9 +950,12 @@ int stp_main_loop(void) - if (rc != 0) { - perror ("Unable to send STP_START"); - cleanup_and_exit(0, rc); -+ /* NOTREACHED */ - } -- if (load_only) -+ if (load_only) { - cleanup_and_exit(1, 0); -+ /* NOTREACHED */ -+ } - break; - } - default: -diff --git a/staprun/monitor.c b/staprun/monitor.c -index 6b8bb11..478634c 100644 ---- a/staprun/monitor.c -+++ b/staprun/monitor.c -@@ -598,7 +598,10 @@ void monitor_input(void) - break; - case 'q': - if (monitor_state == exited) -- cleanup_and_exit(0, 0 /* error_detected unavailable here */ ); -+ { -+ cleanup_and_exit(0, 0 /* error_detected unavailable here */ ); -+ /* NOTREACHED */ -+ } - else - write_command("quit"); - break; -diff --git a/testsuite/systemtap.base/attach_detach.exp b/testsuite/systemtap.base/attach_detach.exp -new file mode 100644 -index 0000000..ef23615 ---- /dev/null -+++ b/testsuite/systemtap.base/attach_detach.exp -@@ -0,0 +1,145 @@ -+set test "attach_detach" -+if {![installtest_p]} { untested $test; return } -+ -+set test_script { " -+ probe begin { printf(\"begin probe fired\\n\") } -+ probe timer.s(5) { printf(\"timer probe fired\\n\") } -+ probe end { printf(\"end probe fired\\n\") } -+" } -+ -+# First, compile a module. -+stap_compile $test 1 $test_script -m attach_detach -+ -+# stap_compile does pass/fail, but doesn't return a status. So, if -+# attach_detach.ko exists, it worked. -+if {! [file exists attach_detach.ko]} { -+ return -+} -+ -+# Load the module and detach. -+set subtest "initial load" -+spawn staprun -L attach_detach.ko -+set fail 0 -+set pass 0 -+expect { -+ -timeout 120 -+ -re "^begin probe fired\r\n" { incr fail; exp_continue } -+ -re "^\r\n" { exp_continue } -+ -re "^Disconnecting from systemtap module.\r\n" { -+ incr pass; exp_continue -+ } -+ -re "^To reconnect, type \"staprun -A attach_detach\"\r\n" { -+ incr pass -+ } -+ eof { fail "$test ($subtest) - EOF"; incr fail } -+ timeout { fail "$test ($subtest) - unexpected timeout"; incr fail } -+} -+catch {close}; catch {wait} -+ -+if {$fail == 0 && $pass == 2} { -+ pass "$test ($subtest) - disconnect seen" -+} else { -+ fail "$test ($subtest) - begin seen ($fail $pass)" -+} -+ -+# Make sure the module is still loaded. -+if {[catch { exec lsmod | grep attach_detach >/dev/null }]} { -+ fail "$test ($subtest) - module still present" -+ return -+} -+pass "$test ($subtest) - module still present" -+ -+# Attach to the module, then use SIGQUIT to detach again. -+set subtest "attach and SIGQUIT" -+spawn staprun -A attach_detach -+set fail 0 -+set pass 0 -+set timer_probe_seen 0 -+expect { -+ -timeout 120 -+ -re "^begin probe fired\r\n" { incr pass; exp_continue } -+ -re "^end probe fired\r\n" { incr fail; exp_continue } -+ -re "^timer probe fired\r\n" { -+ if {!$timer_probe_seen} { -+ set timer_probe_seen 1 -+ incr pass -+ -+ # Send our staprun process a SIGQUIT, to make it detach. -+ kill SIGQUIT [exp_pid] -+ } -+ exp_continue -+ } -+ -re "^\r\n" { exp_continue } -+ -re "^Disconnecting from systemtap module.\r\n" { -+ incr pass; exp_continue -+ } -+ -re "^To reconnect, type \"staprun -A attach_detach\"\r\n" { -+ incr pass -+ } -+ eof { fail "$test ($subtest) - EOF"; incr fail } -+ timeout { fail "$test ($subtest) - unexpected timeout"; incr fail } -+} -+catch {close}; catch {wait} -+ -+if {$fail == 0 && $pass == 4} { -+ pass "$test ($subtest) - disconnect seen" -+} else { -+ fail "$test ($subtest) - no disconnect seen ($fail $pass)" -+} -+ -+# Make sure the module is still loaded. -+if {[catch { exec lsmod | grep attach_detach >/dev/null}]} { -+ fail "$test ($subtest) - module still present" -+ return -+} -+pass "$test ($subtest) - module still present" -+ -+# Attach one last time, then use SIGTERM to unload the module and quit. -+set subtest "attach and SIGTERM" -+spawn staprun -A attach_detach -+set fail 0 -+set pass 0 -+set timer_probe_seen 0 -+expect { -+ -timeout 120 -+ -re "^begin probe fired\r\n" { incr fail; exp_continue } -+ -re "^end probe fired\r\n" { incr pass } -+ -re "^timer probe fired\r\n" { -+ if {!$timer_probe_seen} { -+ set timer_probe_seen 1 -+ incr pass -+ -+ # Send our staprun process a SIGTERM, to make it quit and -+ # unload. -+ kill SIGTERM [exp_pid] -+ } -+ exp_continue -+ } -+ -re "^\r\n" { exp_continue } -+ -re "^Disconnecting from systemtap module.\r\n" { -+ incr fail; exp_continue -+ } -+ -re "^To reconnect, type \"staprun -A attach_detach\"\r\n" { -+ incr fail; exp_continue -+ } -+ eof { fail "$test ($subtest) - EOF"; incr fail } -+ timeout { fail "$test ($subtest) - unexpected timeout"; incr fail } -+} -+catch {close}; catch {wait} -+ -+if {$fail == 0 && $pass == 2} { -+ pass "$test ($subtest) - quit seen" -+} else { -+ fail "$test ($subtest) - no quit seen ($fail $pass)" -+} -+ -+# Make sure the module isn't still loaded. -+if {[catch { exec lsmod | grep attach_detach >/dev/null}]} { -+ pass "$test ($subtest) - module is gone" -+} else { -+ fail "$test ($subtest) - module is gone" -+ -+ # If for some odd reason the module is still loaded, try to unload -+ # it. -+ catch { exec staprun -d attach_detach } -+} diff --git a/SOURCES/rhbz1544689.patch b/SOURCES/rhbz1544689.patch new file mode 100644 index 0000000..066150b --- /dev/null +++ b/SOURCES/rhbz1544689.patch @@ -0,0 +1,101 @@ +commit 98b21b2bcf013f59b67b8c4c5944282fa93a6be5 +Author: Frank Ch. Eigler +Date: Tue Jun 26 12:16:04 2018 -0400 + + configury: add --without-bpf configure option + + Fully autoconf'ing bpf capabilities is error-prone, so provide a blunt + instrument. + +diff --git a/configure b/configure +index 9a8a41b..b7a8790 100755 +--- a/configure ++++ b/configure +@@ -917,6 +917,7 @@ with_dyninst + enable_virt + with_python2_probes + with_python3_probes ++with_bpf + with_selinux + with_java + with_extra_version +@@ -1639,6 +1640,7 @@ Optional Packages: + --without-python3-probes + Disable building python version 3 probe support, + even if it is available ++ --without-bpf Do not try to build BPF components + --without-selinux Do not use libselinux even if present + --with-java=DIRECTORY Specify JDK directory to compile libHelperSDT.so + against (default is /usr/lib/jvm/java) +@@ -12297,9 +12299,16 @@ if test $stap_cv_sectionq = yes; then + fi + + +-$as_echo "#define HAVE_BPF_DECLS 0" >>confdefs.h + +-ac_fn_c_check_decl "$LINENO" "BPF_PROG_TYPE_PERF_EVENT" "ac_cv_have_decl_BPF_PROG_TYPE_PERF_EVENT" "#include ++# Check whether --with-bpf was given. ++if test "${with_bpf+set}" = set; then : ++ withval=$with_bpf; ++fi ++ ++ ++if test "x$with_bpf" != "xno"; then : ++ ++ ac_fn_c_check_decl "$LINENO" "BPF_PROG_TYPE_PERF_EVENT" "ac_cv_have_decl_BPF_PROG_TYPE_PERF_EVENT" "#include + " + if test "x$ac_cv_have_decl_BPF_PROG_TYPE_PERF_EVENT" = xyes; then : + ac_have_decl=1 +@@ -12311,10 +12320,13 @@ cat >>confdefs.h <<_ACEOF + #define HAVE_DECL_BPF_PROG_TYPE_PERF_EVENT $ac_have_decl + _ACEOF + if test $ac_have_decl = 1; then : +- $as_echo "#define HAVE_BPF_DECLS 1" >>confdefs.h ++ ++$as_echo "#define HAVE_BPF_DECLS 1" >>confdefs.h + + fi + ++ ++fi + if test "x$ac_cv_have_decl_BPF_PROG_TYPE_PERF_EVENT" == "xyes"; then + HAVE_BPF_DECLS_TRUE= + HAVE_BPF_DECLS_FALSE='#' +@@ -12323,7 +12335,6 @@ else + HAVE_BPF_DECLS_FALSE= + fi + +- + ac_config_files="$ac_config_files includes/sys/sdt-config.h po/Makefile.in" + + +diff --git a/configure.ac b/configure.ac +index ea7ffdc..12fc337 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -789,14 +789,20 @@ if test $stap_cv_sectionq = yes; then + support_section_question=1 + fi + +-dnl Check if we have for bpf backend. +-AC_DEFINE([HAVE_BPF_DECLS], [0], [Define to 1 if you have the necessary declarations in bpf.h]) +-AC_CHECK_DECLS([BPF_PROG_TYPE_PERF_EVENT], +- [AC_DEFINE([HAVE_BPF_DECLS], [1])], ++ ++AC_ARG_WITH([bpf], ++ AS_HELP_STRING([--without-bpf],[Do not try to build BPF components])) ++ ++dnl Allow --without-bpf to disable this autodetection, as some kernels ++dnl have some headers but missing some decls like __NR_bpf. Too hard ++dnl to detect all the prereqs here. ++AS_IF([test "x$with_bpf" != "xno"], [ ++ AC_CHECK_DECLS([BPF_PROG_TYPE_PERF_EVENT], ++ [AC_DEFINE([HAVE_BPF_DECLS], [1], [Define to 1 if you have the necessary declarations in bpf.h])], + [], + [#include ]) ++ ]) + AM_CONDITIONAL(HAVE_BPF_DECLS, [test "x$ac_cv_have_decl_BPF_PROG_TYPE_PERF_EVENT" == "xyes"]) +- + AC_CONFIG_FILES([includes/sys/sdt-config.h po/Makefile.in]) + + if test $build_elfutils = yes -a $enable_translator = yes; then diff --git a/SOURCES/rhbz1547238.patch b/SOURCES/rhbz1547238.patch new file mode 100644 index 0000000..89ba2d7 --- /dev/null +++ b/SOURCES/rhbz1547238.patch @@ -0,0 +1,64 @@ +commit e40b26c5bbaab6fc8068fe5c111bdfeff0963408 +Author: Paulo Andrade +Date: Tue Jun 12 18:48:26 2018 -0400 + + rhbz1547238: adapt vfs.add_to_page_cache probes + + The add_to_page_cache_lru variant should also be probed, along with + kernel.function("add_to_page_cache_locked"), but if present, not the + add_to_page_cache variant. This backward compatibility needed a + little bit of tapset probe point operator jiujitsu to go beyond + Paulo's initial patch. + +diff --git a/tapset/linux/vfs.stp b/tapset/linux/vfs.stp +index 6f5fe77..1fe71ae 100644 +--- a/tapset/linux/vfs.stp ++++ b/tapset/linux/vfs.stp +@@ -908,9 +908,16 @@ probe __vfs.ext4_mpage_readpages.return = + size = @entry($nr_pages) + } + ++ ++/* newer style */ ++probe vfs.__add_to_page_cache = ++ kernel.function("add_to_page_cache_locked"), ++ kernel.function("add_to_page_cache_lru") ++ { } ++ + probe vfs.add_to_page_cache = +- kernel.function("add_to_page_cache_locked") !, +- kernel.function("add_to_page_cache") ++ vfs.__add_to_page_cache !, ++ kernel.function("add_to_page_cache") /* older style */ + { + dev = $mapping->host->i_sb->s_dev + devname = __find_bdevname(dev, $mapping->host->i_sb->s_bdev) +@@ -925,9 +932,16 @@ probe vfs.add_to_page_cache = + argstr = sprintf("%d, %d", ino, $offset) + } + ++ ++/* newer style */ ++probe vfs.__add_to_page_cache.return = ++ kernel.function("add_to_page_cache_locked").return, ++ kernel.function("add_to_page_cache_lru").return ++ { } ++ + probe vfs.add_to_page_cache.return = +- kernel.function("add_to_page_cache_locked").return !, +- kernel.function("add_to_page_cache").return ++ vfs.__add_to_page_cache.return !, ++ kernel.function("add_to_page_cache").return /* older style */ + { + name = "vfs.add_to_page_cache" + retstr = sprintf("%d", $return) +diff --git a/testsuite/semok/vfs_add_to_page_cache.stp b/testsuite/semok/vfs_add_to_page_cache.stp +new file mode 100755 +index 0000000..5edea75 +--- /dev/null ++++ b/testsuite/semok/vfs_add_to_page_cache.stp +@@ -0,0 +1,4 @@ ++#! stap -p2 ++ ++probe vfs.add_to_page_cache { println(name, argstr) } ++probe vfs.add_to_page_cache.return { println(name, retstr) } diff --git a/SOURCES/rhbz1558350.patch b/SOURCES/rhbz1558350.patch deleted file mode 100644 index d9b7b55..0000000 --- a/SOURCES/rhbz1558350.patch +++ /dev/null @@ -1,21 +0,0 @@ -commit 4b308597838f0fbfdcc3d11845c3065ba61eb57b -Author: Serhei Makarov -Date: Tue Apr 10 16:13:36 2018 -0400 - - RHBZ1558350: fix typo in linux/nfsd.stp - - * linux/nfsd.stp (probe nfsd.proc2.create): fix typo. - -diff --git a/tapset/linux/nfsd.stp b/tapset/linux/nfsd.stp -index 5a70e84..74124df 100644 ---- a/tapset/linux/nfsd.stp -+++ b/tapset/linux/nfsd.stp -@@ -901,7 +901,7 @@ probe nfsd.proc2.create = kernel.function("nfsd_proc_create") !, - - if (@defined($rqstp->rq_argp)) { - fh = & @nfsd2_createargs($rqstp->rq_argp)->fh -- filelen = @nfsd2_createargs($rqstp->rq_argp->len) -+ filelen = @nfsd2_createargs($rqstp->rq_argp)->len - filename = kernel_string_n(@nfsd2_createargs($rqstp->rq_argp)->name, - @nfsd2_createargs($rqstp->rq_argp)->len) - } diff --git a/SOURCES/rhbz1560044.1.patch b/SOURCES/rhbz1560044.1.patch new file mode 100644 index 0000000..c8e647d --- /dev/null +++ b/SOURCES/rhbz1560044.1.patch @@ -0,0 +1,26 @@ +commit c7a952858e846738ee9983796a20585b6635429c +Author: Aaron Merey +Date: Wed Jun 20 18:26:36 2018 -0400 + + bpf translator: binary operations now act on copy of left operand. + + Needed for cases where evaluating right operand causes side effects that + mutate the left (ex. x + x++). + +diff --git a/bpf-translate.cxx b/bpf-translate.cxx +index fd9021e70..adfef97a5 100644 +--- a/bpf-translate.cxx ++++ b/bpf-translate.cxx +@@ -1008,7 +1008,11 @@ bpf_unparser::visit_binary_expression (binary_expression* e) + else + throw SEMANTIC_ERROR (_("unhandled binary operator"), e->tok); + +- value *s0 = emit_expr (e->left); ++ value *s0 = this_prog.new_reg(); ++ // copy e->left into a seperate reg incase evaluating e->right ++ // causes e->left to mutate (ex. x + x++). ++ this_prog.mk_mov(this_ins, s0, emit_expr (e->left)); ++ + value *s1 = emit_expr (e->right); + value *d = this_prog.new_reg (); + this_prog.mk_binary (this_ins, code, d, s0, s1); diff --git a/SOURCES/rhbz1560044.2.patch b/SOURCES/rhbz1560044.2.patch new file mode 100644 index 0000000..1cacfb6 --- /dev/null +++ b/SOURCES/rhbz1560044.2.patch @@ -0,0 +1,19 @@ +commit 8f316871901ec2f54b5ef66416303ef5e87f1226 +Author: Serhei Makarov +Date: Fri Sep 14 14:15:05 2018 -0400 + + update man/stap.1.in with a note that stapbpf(8) is only present on x86_64 + +diff --git a/man/stap.1.in b/man/stap.1.in +index 4db25479f..a0f0d5814 100644 +--- a/man/stap.1.in ++++ b/man/stap.1.in +@@ -2538,7 +2538,7 @@ Filter (eBPF) programs instead of a kernel module. eBPF programs are verified + by the kernel for safety and are executed by an in-kernel virtual machine. + This runtime is in an early stage of development and currently lacks support + for a number of features available in the default runtime. Please see the +-\fIstapbpf\fR(8) man page for more information. ++\fIstapbpf\fR(8) man page for more information (only on x86_64 systems). + + .SH EXIT STATUS + diff --git a/SOURCES/rhbz1560044.3.patch b/SOURCES/rhbz1560044.3.patch new file mode 100644 index 0000000..cbb28df --- /dev/null +++ b/SOURCES/rhbz1560044.3.patch @@ -0,0 +1,70 @@ +commit 488adf462bbbba541d2ee4448a9c30458084cfb8 +Author: Aaron Merey +Date: Wed Jun 20 18:42:53 2018 -0400 + + testsuite: fix formatting of bpf test increment2.stp + +diff --git a/testsuite/systemtap.bpf/bpf_tests/increment2.stp b/testsuite/systemtap.bpf/bpf_tests/increment2.stp +index ccc2609fa..89c5f1d07 100644 +--- a/testsuite/systemtap.bpf/bpf_tests/increment2.stp ++++ b/testsuite/systemtap.bpf/bpf_tests/increment2.stp +@@ -1,18 +1,48 @@ ++global flag + probe begin { ++ printf("BEGIN\n") + a = 0; b = 0; c = 0; + d = 0; e = 0; f = 0; + g = 0; h = 0 + +-# a = a + a++ +-# b = b + ++b +-# c = ++c + c +-# d = ++d + ++c +-# e = ++e + e++ +-# f = f++ + f +-# g = g++ + ++g +-# h = h++ + h++ +- printf("%d %d %d ", a,b,c) +- printf("%d %d %d ", d,e,f) +- printf("%d %d\n", g,h) ++ a = a + a++ ++ b = b + ++b ++ c = ++c + c ++ d = ++d + ++c ++ e = ++e + e++ ++ f = f++ + f ++ g = g++ + ++g ++ h = h++ + h++ ++ ++ if (a == 0 && b == 1 && c == 3 && d == 4 ++ && e == 2 && f == 1 && g == 2 && h == 1) ++ flag = 1 ++} ++ ++probe kernel.function("sys_read") { ++ a = 0; b = 0; c = 0; ++ d = 0; e = 0; f = 0; ++ g = 0; h = 0 ++ ++ a = a + a++ ++ b = b + ++b ++ c = ++c + c ++ d = ++d + ++c ++ e = ++e + e++ ++ f = f++ + f ++ g = g++ + ++g ++ h = h++ + h++ ++ ++ if (a != 0 || b != 1 || c != 3 || d != 4 ++ || e != 2 || f != 1 || g != 2 || h != 1) ++ flag = 0 ++ + exit() + } ++ ++probe end { ++ if (flag) ++ printf("END PASS\n") ++ else ++ printf("END FAIL\n") ++} diff --git a/SOURCES/rhbz1563052.patch b/SOURCES/rhbz1563052.patch deleted file mode 100644 index 2d752dc..0000000 --- a/SOURCES/rhbz1563052.patch +++ /dev/null @@ -1,60 +0,0 @@ -commit 3b2cf9012d600bf61aaeff855e9dc95200859b1d -Author: Serhei Makarov -Date: Tue Apr 10 14:40:19 2018 -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. - -diff --git a/runtime/linux/loc2c-runtime.h b/runtime/linux/loc2c-runtime.h -index 39dece0..fd736bd 100644 ---- a/runtime/linux/loc2c-runtime.h -+++ b/runtime/linux/loc2c-runtime.h -@@ -722,7 +722,7 @@ static inline char *kderef_buffer_(char *dst, void *addr, size_t len) - * - * dst: read the string into this address - * addr: address to read from -- * len: maximum number of bytes to read -+ * len: maximum number of bytes to store in dst, including the trailing NUL - * seg: memory segment to use, either kernel (KERNEL_DS) or user - * (USER_DS) - * -@@ -745,7 +745,8 @@ static inline long _stp_deref_string_nofault(char *dst, const char *addr, - err = 1; - else - { -- for (i = 0; i < len; ++i) -+ /* Reduce len by 1 to leave room for '\0' terminator. */ -+ for (i = 0; i + 1 < len; ++i) - { - u8 v; - err = __stp_get_user(v, (u8 *)addr + i); -diff --git a/testsuite/systemtap.base/set_kernel.stp b/testsuite/systemtap.base/set_kernel.stp -index 729b477..dc93582 100644 ---- a/testsuite/systemtap.base/set_kernel.stp -+++ b/testsuite/systemtap.base/set_kernel.stp -@@ -62,6 +62,20 @@ probe end(1) - assert_not_reached(test) - } catch {} - -+ /* Be sure to also test in the other direction: */ -+ test = "kernel_string_n" -+ addr = get_buffer() -+ if (assert_string(test, "", kernel_string_n(addr, 0))) { -+ set_kernel_string_n(addr, 7, "potatoe") -+ if (assert_string(test, "potatoe", kernel_string_n(addr, 7))) { -+ assert_string(test, "potato", kernel_string_n(addr, 6)) -+ } -+ } -+ try { -+ println(kernel_string_n(-1, 10)) -+ assert_not_reached(test) -+ } catch {} -+ - test = "set_kernel_long" - addr = get_buffer() - long_val = %( CONFIG_64BIT == "y" %? 0x123456789ABCDEF0 %: 0x12345678 %) diff --git a/SOURCES/rhbz1566422.patch b/SOURCES/rhbz1566422.patch deleted file mode 100644 index 494e4c9..0000000 --- a/SOURCES/rhbz1566422.patch +++ /dev/null @@ -1,46 +0,0 @@ -commit db9c9d6e30c6cfd7b85475b5c79ee2cc51201934 -Author: Serhei Makarov -Date: Tue Apr 17 11:35:00 2018 -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'). - -diff --git a/runtime/sym.c b/runtime/sym.c -index c11a35a..b6e0fd6 100644 ---- a/runtime/sym.c -+++ b/runtime/sym.c -@@ -1045,7 +1045,7 @@ static void _stp_kmodule_update_address(const char* module, - if (strcmp (_stp_modules[mi]->name, module)) - continue; - -- if (reloc && !strcmp (note_sectname, reloc)) { -+ if (!reloc || !strcmp (note_sectname, reloc)) { - dbug_sym(1, "module %s special section %s address %#lx\n", - _stp_modules[mi]->name, - note_sectname, -diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c -index 64c2aeb..076c562 100644 ---- a/runtime/transport/symbols.c -+++ b/runtime/transport/symbols.c -@@ -167,6 +167,11 @@ static int _stp_module_notifier (struct notifier_block * nb, - /* Verify build-id. */ - _stp_kmodule_check (mod->name); - } -+ else if (val == MODULE_STATE_GOING) { -+ /* Unregister all sections. */ -+ dbug_sym(2, "unregister sections\n"); -+ _stp_kmodule_update_address(mod->name, NULL, 0); -+ } - else if (val != MODULE_STATE_GOING) { - return NOTIFY_DONE; - } diff --git a/SOURCES/rhbz1567356.patch b/SOURCES/rhbz1567356.patch deleted file mode 100644 index cf8fd2c..0000000 --- a/SOURCES/rhbz1567356.patch +++ /dev/null @@ -1,272 +0,0 @@ -commit 553b6df07c9b7ab30ed468a6a4374cbdf73d1c0d -Author: Mark Wielaard -Date: Tue Apr 17 14:36:13 2018 +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. - -diff --git a/buildrun.cxx b/buildrun.cxx -index 403fa71..59b9e88 100644 ---- a/buildrun.cxx -+++ b/buildrun.cxx -@@ -365,6 +365,8 @@ compile_pass (systemtap_session& s) - "STAPCONF_KERNEL_STACKTRACE", NULL); - output_autoconf(s, o, "autoconf-save-stack-trace-no-bp.c", - "STAPCONF_KERNEL_STACKTRACE_NO_BP", NULL); -+ output_autoconf(s, o, "autoconf-unwind-stack-trace.c", -+ "STAPCONF_KERNEL_UNWIND_STACK", NULL); - output_autoconf(s, o, "autoconf-asm-syscall.c", - "STAPCONF_ASM_SYSCALL_H", NULL); - output_autoconf(s, o, "autoconf-ring_buffer-flags.c", "STAPCONF_RING_BUFFER_FLAGS", NULL); -diff --git a/runtime/linux/autoconf-unwind-stack-trace.c b/runtime/linux/autoconf-unwind-stack-trace.c -new file mode 100644 -index 0000000..2ec399e ---- /dev/null -+++ b/runtime/linux/autoconf-unwind-stack-trace.c -@@ -0,0 +1,16 @@ -+#include -+#include -+ -+void unwind_stack_trace (void) -+{ -+ struct unwind_state state; -+ unwind_start (&state, current, 0, 0); -+ while (! unwind_done (&state)) -+ { -+ unsigned long addr = unwind_get_return_address (&state); -+ if (addr == 0) -+ break; -+ unwind_next_frame (&state); -+ } -+} -+ -diff --git a/runtime/stack.c b/runtime/stack.c -index c9d2c0c..43f98ef 100644 ---- a/runtime/stack.c -+++ b/runtime/stack.c -@@ -43,7 +43,11 @@ - #include - #endif - --static void _stp_stack_print_fallback(unsigned long, int, int, int); -+#if defined(STAPCONF_KERNEL_UNWIND_STACK) -+#include -+#endif -+ -+static void _stp_stack_print_fallback(unsigned long, struct pt_regs*, int, int, int); - - #ifdef STP_USE_DWARF_UNWINDER - #ifdef STAPCONF_LINUX_UACCESS_H -@@ -128,7 +132,7 @@ static const struct stacktrace_ops print_stack_ops = { - }; - - /* Used for kernel backtrace printing when other mechanisms fail. */ --static void _stp_stack_print_fallback(unsigned long stack, -+static void _stp_stack_print_fallback(unsigned long stack, struct pt_regs *regs, - int sym_flags, int levels, int skip) - { - struct print_stack_data print_data; -@@ -136,20 +140,55 @@ static void _stp_stack_print_fallback(unsigned long stack, - print_data.levels = levels; - print_data.skip = skip; - #if defined(STAPCONF_KERNEL_STACKTRACE) -+ dbug_unwind(1, "fallback kernel stacktrace\n"); - dump_trace(current, NULL, (long *)stack, 0, &print_stack_ops, - &print_data); - #else - /* STAPCONF_KERNEL_STACKTRACE_NO_BP */ -+ dbug_unwind(1, "fallback kernel stacktrace (no bp)\n"); - dump_trace(current, NULL, (long *)stack, &print_stack_ops, - &print_data); - #endif - } - #else --static void _stp_stack_print_fallback(unsigned long s, int v, int l, int k) { -+#if defined(STAPCONF_KERNEL_UNWIND_STACK) -+static void _stp_stack_print_fallback(unsigned long sp, struct pt_regs *regs, -+ int sym_flags, -+ int levels, int skip) { -+ struct unwind_state state; -+ unwind_start (&state, current, regs, (unsigned long *) sp); -+ dbug_unwind(1, "fallback kernel stacktrace (unwind)\n"); -+ while (levels > 0 && ! unwind_done (&state)) -+ { -+ if (skip == 0) -+ { -+ unsigned long addr = unwind_get_return_address (&state); -+ /* When we have frame pointers, the unwind addresses can be -+ (mostly) trusted, otherwise it is all guesswork. */ -+#ifdef CONFIG_FRAME_POINTER -+ _stp_print_addr(addr, sym_flags, NULL); -+#else -+ _stp_print_addr(addr, sym_flags | _STP_SYM_INEXACT, NULL); -+#endif -+ if (addr == 0) -+ break; -+ levels--; -+ } -+ else -+ { -+ dbug_unwind(1, "skipping frame\n"); -+ skip--; -+ } -+ unwind_next_frame(&state); -+ } -+} -+#else /* no new unwind */ -+static void _stp_stack_print_fallback(unsigned long s, struct pt_regs *r, int v, int l, int k) { - /* Don't guess, just give up. */ -+ dbug_unwind(1, "no fallback kernel stacktrace (giving up)\n"); - _stp_print_addr(0, v | _STP_SYM_INEXACT, NULL); - } -- -+#endif /* new unwind */ - #endif /* defined(STAPCONF_KERNEL_STACKTRACE) || defined(STAPCONF_KERNEL_STACKTRACE_NO_BP) */ - - -@@ -382,6 +421,7 @@ static void _stp_stack_kernel_print(struct context *c, int sym_flags) - if (l == 0) { - remaining = MAXBACKTRACE - n; - _stp_stack_print_fallback(UNW_SP(&c->uwcontext_kernel.info), -+ &c->uwcontext_kernel.info.regs, - sym_flags, remaining, 0); - break; - } else { -@@ -408,7 +448,7 @@ static void _stp_stack_kernel_print(struct context *c, int sym_flags) - sp = 0; - skip = 5; /* yes, that many framework frames. */ - #endif -- _stp_stack_print_fallback(sp, sym_flags, -+ _stp_stack_print_fallback(sp, NULL, sym_flags, - MAXBACKTRACE, skip); - #else - if (sym_flags & _STP_SYM_SYMBOL) -diff --git a/runtime/unwind.c b/runtime/unwind.c -index ec7cd58..3a2d991 100644 ---- a/runtime/unwind.c -+++ b/runtime/unwind.c -@@ -235,7 +235,7 @@ static int parse_fde_cie(const u32 *fde, const u32 *cie, - - #define REG_STATE state->reg[state->stackDepth] - --static int advance_loc(unsigned long delta, struct unwind_state *state) -+static int advance_loc(unsigned long delta, struct uw_state *state) - { - state->loc += delta * state->codeAlign; - dbug_unwind(1, "state->loc=%lx\n", state->loc); -@@ -244,7 +244,7 @@ static int advance_loc(unsigned long delta, struct unwind_state *state) - - /* Set Same or Nowhere rule for register. */ - static void set_no_state_rule(uleb128_t reg, enum item_location where, -- struct unwind_state *state) -+ struct uw_state *state) - { - dbug_unwind(1, "reg=%lx, where=%d\n", reg, where); - if (reg < ARRAY_SIZE(REG_STATE.regs)) { -@@ -254,7 +254,7 @@ static void set_no_state_rule(uleb128_t reg, enum item_location where, - - /* Memory or Value rule */ - static void set_offset_rule(uleb128_t reg, enum item_location where, -- sleb128_t svalue, struct unwind_state *state) -+ sleb128_t svalue, struct uw_state *state) - { - dbug_unwind(1, "reg=%lx, where=%d, svalue=%lx\n", reg, where, svalue); - if (reg < ARRAY_SIZE(REG_STATE.regs)) { -@@ -265,7 +265,7 @@ static void set_offset_rule(uleb128_t reg, enum item_location where, - - /* Register rule. */ - static void set_register_rule(uleb128_t reg, uleb128_t value, -- struct unwind_state *state) -+ struct uw_state *state) - { - dbug_unwind(1, "reg=%lx, value=%lx\n", reg, value); - if (reg < ARRAY_SIZE(REG_STATE.regs)) { -@@ -277,7 +277,7 @@ static void set_register_rule(uleb128_t reg, uleb128_t value, - /* Expr or ValExpr rule. */ - static void set_expr_rule(uleb128_t reg, enum item_location where, - const u8 **expr, const u8 *end, -- struct unwind_state *state) -+ struct uw_state *state) - { - const u8 *const start = *expr; - uleb128_t len = get_uleb128(expr, end); -@@ -296,7 +296,7 @@ static void set_expr_rule(uleb128_t reg, enum item_location where, - #define MAX_CFI 512 - - static int processCFI(const u8 *start, const u8 *end, unsigned long targetLoc, -- signed ptrType, int user, struct unwind_state *state, int compat_task) -+ signed ptrType, int user, struct uw_state *state, int compat_task) - { - union { - const u8 *p8; -@@ -1169,7 +1169,7 @@ static int unwind_frame(struct unwind_context *context, - unsigned i; - signed ptrType = -1, call_frame = 1; - uleb128_t retAddrReg = 0; -- struct unwind_state *state = &context->state; -+ struct uw_state *state = &context->state; - unsigned long addr; - - if (unlikely(table_len == 0)) { -diff --git a/runtime/unwind/unwind.h b/runtime/unwind/unwind.h -index 9d66732..b3ff786 100644 ---- a/runtime/unwind/unwind.h -+++ b/runtime/unwind/unwind.h -@@ -492,7 +492,7 @@ struct unwind_reg_state { - unsigned cfa_is_expr:1; - }; - --struct unwind_state { -+struct uw_state { - uleb128_t loc; - uleb128_t codeAlign; - sleb128_t dataAlign; -@@ -503,7 +503,7 @@ struct unwind_state { - - struct unwind_context { - struct unwind_frame_info info; -- struct unwind_state state; -+ struct uw_state state; - }; - - static const struct cfa badCFA = { ARRAY_SIZE(reg_info), 1 }; - -commit 17ee540dd61113fe4f557f191db3480db875cca1 -Author: Mark Wielaard -Date: Wed Apr 18 15:00:24 2018 +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. - -diff --git a/runtime/unwind.c b/runtime/unwind.c -index 3a2d991..4c360d2 100644 ---- a/runtime/unwind.c -+++ b/runtime/unwind.c -@@ -724,10 +724,15 @@ adjustStartLoc (unsigned long startLoc, - dbug_unwind(2, "adjustStartLoc=%lx, ptrType=%s, m=%s, s=%s eh=%d\n", - startLoc, _stp_eh_enc_name(ptrType), m->path, s->name, is_ehframe); - if (startLoc == 0 -- || strcmp (m->name, "kernel") == 0 - || (strcmp (s->name, ".absolute") == 0 && !is_ehframe)) - return startLoc; - -+ /* 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). */ -+ if (strcmp (m->name, "kernel") == 0) -+ return startLoc - s->sec_load_offset + s->static_addr; -+ - /* eh_frame data has been loaded in the kernel, so readjust offset. */ - if (is_ehframe) { - dbug_unwind(2, "eh_frame=%lx, eh_frame_addr=%lx\n", (unsigned long) m->eh_frame, m->eh_frame_addr); diff --git a/SOURCES/rhbz1591267.patch b/SOURCES/rhbz1591267.patch new file mode 100644 index 0000000..325e6be --- /dev/null +++ b/SOURCES/rhbz1591267.patch @@ -0,0 +1,50 @@ +commit 97a9ceb2a294ee3218987daf84a5ab3d9d361e27 +Author: Martin Cermak +Date: Thu Jun 14 14:35:26 2018 +0200 + + Improve the foreach_limit(2).exp test results. + + Without this update, one can observe following issue with rhel7 + powerpc kernels: + + ======= + # stap -p4 testsuite/systemtap.maps/foreach_limit.stp + ... + /usr/local/share/systemtap/runtime/map.c:275:26: error: ‘a’ may be used uninitialized in this function [-Werror=maybe-uninitialized] + struct mlist_head *c, *a, *last, *tmp; + ^ + /usr/local/share/systemtap/runtime/map.c:275:26: error: ‘a’ may be used uninitialized in this function [-Werror=maybe-uninitialized] + cc1: all warnings being treated as errors + ======= + + This problem turns out to start happening after the powerpc kernel + build system started using -O3 instead of -O2 as one can see in + http://vault.centos.org/7.5.1804/os/Source/SPackages/kernel-3.10.0-862.el7.src.rpm + + ======= + # powerpc is compiled with -O3, via specfile rpmbuild -- see rhbz1051067. + # we need to keep consistency here, however, for out of tree kmod builds -- + # see rhbz1431029 for reference + ifeq ($(SRCARCH), powerpc) + KBUILD_CFLAGS += -O3 + else + KBUILD_CFLAGS += -O2 + endif + ======= + + Reverting this change (using -O2 instead of -O3) works the problem around + as well as this systemtap-side update. For more details, see rhbz1591267. + +diff --git a/runtime/map.c b/runtime/map.c +index 5caf739..ef91456 100644 +--- a/runtime/map.c ++++ b/runtime/map.c +@@ -272,7 +272,7 @@ static void _stp_map_sortn(MAP map, int n, int keynum, int dir, + _stp_map_sort(map, keynum, dir, get_key); + } else { + struct mlist_head *head = &map->head; +- struct mlist_head *c, *a, *last, *tmp; ++ struct mlist_head *c, *a = 0, *last, *tmp; + int num, swaps = 1; + + if (mlist_empty(head)) diff --git a/SPECS/systemtap.spec b/SPECS/systemtap.spec index 041f42c..1b86b50 100644 --- a/SPECS/systemtap.spec +++ b/SPECS/systemtap.spec @@ -1,5 +1,6 @@ %{!?with_sqlite: %global with_sqlite 0%{?fedora} >= 17 || 0%{?rhel} >= 7} -%{!?with_docs: %global with_docs 1} +# prefer prebuilt docs +%{!?with_docs: %global with_docs 0} %{!?with_htmldocs: %global with_htmldocs 0} %{!?with_monitor: %global with_monitor 1} # crash is not available @@ -18,11 +19,10 @@ %else %{!?with_dyninst: %global with_dyninst 0} %endif -%ifarch aarch64 -# aarch64 rhel7 kernel is new enough to have linux/bpf.h -%{!?with_bpf: %global with_bpf 0%{?fedora} >= 22 || 0%{?rhel} >= 7} +%ifarch x86_64 +%{!?with_bpf: %global with_bpf 1} %else -%{!?with_bpf: %global with_bpf 0%{?fedora} >= 22 || 0%{?rhel} >= 8} +%{!?with_bpf: %global with_bpf 0} %endif %{!?with_systemd: %global with_systemd 0%{?fedora} >= 19 || 0%{?rhel} >= 7} %{!?with_emacsvim: %global with_emacsvim 0%{?fedora} >= 19 || 0%{?rhel} >= 7} @@ -38,9 +38,9 @@ %{!?with_openssl: %global with_openssl 0} %endif %{!?with_pyparsing: %global with_pyparsing 0%{?fedora} >= 18 || 0%{?rhel} >= 7} -%{!?with_python3: %global with_python3 0%{?fedora} >= 23} -%{!?with_python2_probes: %global with_python2_probes 1} -%{!?with_python3_probes: %global with_python3_probes 0%{?fedora} >= 23} +%{!?with_python3: %global with_python3 0%{?fedora} >= 23 || 0%{?rhel} > 7} +%{!?with_python2_probes: %global with_python2_probes (0%{?fedora} <= 28 && 0%{?rhel} <= 7)} +%{!?with_python3_probes: %global with_python3_probes (0%{?fedora} >= 23 || 0%{?rhel} > 7)} %{!?with_httpd: %global with_httpd 0} %ifarch ppc64le aarch64 @@ -71,25 +71,26 @@ %define dracutstap %{_prefix}/share/dracut/modules.d/99stap %endif -%if 0%{?rhel} >= 6 +%if 0%{?rhel} == 6 || 0%{?rhel} == 7 %define dracutbindir /sbin %else %define dracutbindir %{_bindir} %endif +%if 0%{?rhel} == 6 + %{!?_rpmmacrodir: %define _rpmmacrodir /etc/rpm/} +%else + %{!?_rpmmacrodir: %define _rpmmacrodir %{_rpmconfigdir}/macros.d} +%endif + +# To avoid testsuite/*/*.stp has shebang which doesn't start with '/' +%undefine __brp_mangle_shebangs + Name: systemtap -Version: 3.2 -Release: 8%{?dist} +Version: 3.3 +Release: 3%{?dist} # for version, see also configure.ac -Patch10: rhbz1504009.patch -Patch11: rhbz1506230.patch -Patch12: rhbz1490862.patch -Patch13: rhbz1527809.patch -Patch14: rhbz1558350.patch -Patch15: rhbz1567356.patch -Patch16: rhbz1566422.patch -Patch17: rhbz1563052.patch # Packaging abstract: # @@ -125,7 +126,6 @@ URL: http://sourceware.org/systemtap/ Source: ftp://sourceware.org/pub/systemtap/releases/systemtap-%{version}.tar.gz # Build* -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: gcc-c++ BuildRequires: gettext-devel BuildRequires: pkgconfig(nss) @@ -193,9 +193,13 @@ BuildRequires: readline-devel BuildRequires: pkgconfig(ncurses) %endif %if %{with_python2_probes} -BuildRequires: python-devel +BuildRequires: python2-devel +%if 0%{?fedora} >= 1 +BuildRequires: python2-setuptools +%else BuildRequires: python-setuptools %endif +%endif %if %{with_python3_probes} BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -210,6 +214,14 @@ BuildRequires: libuuid-devel Requires: systemtap-client = %{version}-%{release} Requires: systemtap-devel = %{version}-%{release} +Patch10: rhbz1547238.patch +Patch11: rhbz1591267.patch +Patch12: rhbz1544689.patch +Patch13: rhbz1560044.1.patch +Patch14: rhbz1560044.2.patch +Patch15: rhbz1560044.3.patch + + %description SystemTap is an instrumentation system for systems running Linux. Developers can write instrumentation scripts to collect data on @@ -224,10 +236,7 @@ Group: Development/System License: GPLv2+ URL: http://sourceware.org/systemtap/ Requires: systemtap-devel = %{version}-%{release} -# On RHEL[45], /bin/mktemp comes from the 'mktemp' package. On newer -# distributions, /bin/mktemp comes from the 'coreutils' package. To -# avoid a specific RHEL[45] Requires, we'll do a file-based require. -Requires: nss /bin/mktemp +Requires: nss coreutils Requires: zip unzip Requires(pre): shadow-utils Requires(post): chkconfig @@ -330,7 +339,11 @@ URL: http://sourceware.org/systemtap/ %if %{with_python3} Requires: python3-pyparsing %else +%if 0%{?rhel} >= 7 Requires: pyparsing +%else +Requires: python2-pyparsing +%endif %endif %endif @@ -406,7 +419,7 @@ License: GPLv2+ URL: http://sourceware.org/systemtap/ Requires: systemtap-runtime = %{version}-%{release} Requires: byteman > 2.0 -Requires: net-tools +Requires: iproute %description runtime-java This package includes support files needed to run systemtap scripts @@ -435,6 +448,11 @@ License: GPLv2+ URL: http://sourceware.org/systemtap/ Requires: systemtap-runtime = %{version}-%{release} +%if ! (%{with_python2_probes}) +# Provide an clean upgrade path when the python2 package is removed +Obsoletes: %{name}-runtime-python2 < %{version}-%{release} +%endif + %description runtime-python3 This package includes support files needed to run systemtap scripts that probe python 3 processes. @@ -498,8 +516,7 @@ cd .. %patch13 -p1 %patch14 -p1 %patch15 -p1 -%patch16 -p1 -%patch17 -p1 + %build @@ -553,7 +570,7 @@ cd .. %global docs_config --enable-docs --disable-htmldocs %endif %else -%global docs_config --disable-docs +%global docs_config --enable-docs=prebuilt %endif # Enable pie as configure defaults to disabling it @@ -604,10 +621,16 @@ cd .. %global httpd_config --disable-httpd %endif +%if %{with_bpf} +%global bpf_config --with-bpf +%else +%global bpf_config --without-bpf +%endif + # We don't ship compileworthy python code, just oddball samples %global py_auto_byte_compile 0 -%configure %{?elfutils_config} %{dyninst_config} %{sqlite_config} %{crash_config} %{docs_config} %{pie_config} %{rpm_config} %{java_config} %{virt_config} %{dracut_config} %{python3_config} %{python2_probes_config} %{python3_probes_config} %{httpd_config} --disable-silent-rules --with-extra-version="rpm %{version}-%{release}" +%configure %{?elfutils_config} %{dyninst_config} %{sqlite_config} %{crash_config} %{docs_config} %{pie_config} %{rpm_config} %{java_config} %{virt_config} %{dracut_config} %{python3_config} %{python2_probes_config} %{python3_probes_config} %{httpd_config} %{bpf_config} --disable-silent-rules --with-extra-version="rpm %{version}-%{release}" make %{?_smp_mflags} %if %{with_emacsvim} @@ -644,19 +667,21 @@ install -c -m 755 stap-prep $RPM_BUILD_ROOT%{_bindir}/stap-prep # Copy over the testsuite cp -rp testsuite $RPM_BUILD_ROOT%{_datadir}/systemtap -%if %{with_docs} # We want the manuals in the special doc dir, not the generic doc install dir. # We build it in place and then move it away so it doesn't get installed # twice. rpm can specify itself where the (versioned) docs go with the # %doc directive. mkdir docs.installed mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/*.pdf docs.installed/ +%if %{with_docs} %if %{with_htmldocs} mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/tapsets docs.installed/ mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/SystemTap_Beginners_Guide docs.installed/ %endif %endif +install -D -m 644 macros.systemtap $RPM_BUILD_ROOT%{_rpmmacrodir}/macros.systemtap + mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/stap-server mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/stap-server mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/stap-server/.systemtap @@ -724,9 +749,6 @@ done touch $RPM_BUILD_ROOT%{dracutstap}/params.conf %endif -%clean -rm -rf ${RPM_BUILD_ROOT} - %pre runtime getent group stapusr >/dev/null || groupadd -g 156 -r stapusr 2>/dev/null || groupadd -r stapusr getent group stapsys >/dev/null || groupadd -g 157 -r stapsys 2>/dev/null || groupadd -r stapsys @@ -739,6 +761,15 @@ getent passwd stap-server >/dev/null || \ useradd -c "Systemtap Compile Server" -u 155 -g stap-server -d %{_localstatedir}/lib/stap-server -r -s /sbin/nologin stap-server 2>/dev/null || \ useradd -c "Systemtap Compile Server" -g stap-server -d %{_localstatedir}/lib/stap-server -r -s /sbin/nologin stap-server +%pre testsuite +getent passwd stapusr >/dev/null || \ + useradd -c "Systemtap 'stapusr' User" -g stapusr -r -s /sbin/nologin stapusr +getent passwd stapsys >/dev/null || \ + useradd -c "Systemtap 'stapsys' User" -g stapsys -G stapusr -r -s /sbin/nologin stapsys +getent passwd stapdev >/dev/null || \ + useradd -c "Systemtap 'stapdev' User" -g stapdev -G stapusr -r -s /sbin/nologin stapdev +exit 0 + %post server # We have some duplication between the %files listings for the @@ -1075,8 +1106,8 @@ done %{_datadir}/systemtap/examples %{!?_licensedir:%global license %%doc} %license COPYING -%if %{with_docs} %doc docs.installed/*.pdf +%if %{with_docs} %if %{with_htmldocs} %doc docs.installed/tapsets/*.html %doc docs.installed/SystemTap_Beginners_Guide @@ -1121,6 +1152,7 @@ done %{_includedir}/sys/sdt.h %{_includedir}/sys/sdt-config.h %{_mandir}/man1/dtrace.1* +%{_rpmmacrodir}/macros.systemtap %doc README AUTHORS NEWS %{!?_licensedir:%global license %%doc} %license COPYING @@ -1180,6 +1212,19 @@ done # PRERELEASE %changelog +* Fri Sep 14 2018 Serhei Makarov - 3.3-3 +- Add BPF left-operand fix (rhbz1560044) (x86-64 only) +- Add stap.1 note on missing stapbpf.8 (rhbz1560044) +- Fix RHEL-ALT build (rhbz1544689) + +* Tue Jun 26 2018 Frank Ch. Eigler - 3.3-2 +- Enable BPF build (rhbz1544689, rhbz1311586) (x86-64 only) +- Fix vfs.add_to_page_cache probe (rhbz1547238) +- Fix foreach_limit.exp compilability (rhbz1591267) + +* Sat Jun 09 2018 Frank Ch. Eigler - 3.3-1 +- Upstream release. + * Tue Apr 24 2018 Frank Ch. Eigler - 3.2-8 - rhbz1563052 (stp_deref string truncation off-by-one error)