From 61c8529211735920e727ed23467edd2f276a2fcc Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Thu, 16 Mar 2017 16:48:33 -0400 Subject: [PATCH 01/10] rebuild for dyninst 9.3.1 --- systemtap.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/systemtap.spec b/systemtap.spec index 244fe64..bf9276c 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -72,7 +72,7 @@ Name: systemtap Version: 3.1 -Release: 1%{?dist} +Release: 2%{?dist} # for version, see also configure.ac @@ -1139,6 +1139,9 @@ done # PRERELEASE %changelog +* Thu Mar 16 2017 Stan Cox - 3.1-2 +- Rebuild for dyninst 9.3 + * Fri Feb 17 2017 Frank Ch. Eigler - 3.1-1 - Upstream release. From cdc8fbe05c370db1d552d35ed197296244a122a4 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 6 Apr 2017 17:06:04 -0400 Subject: [PATCH 02/10] rhbz1439914 --- bz1439914.patch | 36 ++++++++++++++++++++++++++++++++++++ systemtap.spec | 8 +++++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 bz1439914.patch diff --git a/bz1439914.patch b/bz1439914.patch new file mode 100644 index 0000000..22d273a --- /dev/null +++ b/bz1439914.patch @@ -0,0 +1,36 @@ +commit 272146660f54786bb61d388f6d3a4eb20e7d9369 (origin/master2, master2) +Author: Jakub Jelinek +Date: Tue Mar 21 17:04:08 2017 -0400 + + gcc PR80115: sys/sdt.h: tweak i386 argument passing + + Use %w[arg] to request that widened forms of register names be passed + to the sys/sdt.h macro operand strings, so as to avoid nominating + sub-registers such as %sil within -m32 code, which gcc <= 6 sometimes + buggily did. + +diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h +index 3b7eda7976d1..eff315bcd885 100644 +--- a/includes/sys/sdt.h ++++ b/includes/sys/sdt.h +@@ -82,9 +82,11 @@ + # define _SDT_ASM_STRING_1(x) _SDT_ASM_1(.asciz #x) + + # define _SDT_ARGFMT(no) %n[_SDT_S##no]@_SDT_ARGTMPL(_SDT_A##no) ++ + # ifndef STAP_SDT_ARG_CONSTRAINT + # define STAP_SDT_ARG_CONSTRAINT nor + # endif ++ + # define _SDT_STRINGIFY(x) #x + # define _SDT_ARG_CONSTRAINT_STRING(x) _SDT_STRINGIFY(x) + # define _SDT_ARG(n, x) \ +@@ -173,6 +175,8 @@ __extension__ extern unsigned long long __sdt_unsp; + + #if defined __powerpc__ || defined __powerpc64__ + # define _SDT_ARGTMPL(id) %I[id]%[id] ++#elif defined __i386__ ++# define _SDT_ARGTMPL(id) %w[id] /* gcc.gnu.org/PR80115 */ + #else + # define _SDT_ARGTMPL(id) %[id] + #endif diff --git a/systemtap.spec b/systemtap.spec index bf9276c..406b28b 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -72,7 +72,7 @@ Name: systemtap Version: 3.1 -Release: 2%{?dist} +Release: 3%{?dist} # for version, see also configure.ac @@ -186,6 +186,8 @@ BuildRequires: python3-devel BuildRequires: python3-setuptools %endif +Patch10: bz1439914.patch + # Install requirements Requires: systemtap-client = %{version}-%{release} Requires: systemtap-devel = %{version}-%{release} @@ -461,6 +463,7 @@ systemtap-runtime-virthost machine to execute systemtap scripts. %prep %setup -q %{?setup_elfutils} +%patch10 -p1 %if %{with_bundled_elfutils} cd elfutils-%{elfutils_version} @@ -1139,6 +1142,9 @@ done # PRERELEASE %changelog +* Thu Apr 06 2017 Frank Ch. Eigler - 3.1-3 +- Backport bz1439914 (sys/sdt.h argument encoding) + * Thu Mar 16 2017 Stan Cox - 3.1-2 - Rebuild for dyninst 9.3 From 43d514b85622d4b7362e4f5e1b7937f924a65b3a Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Mon, 15 May 2017 15:38:09 -0400 Subject: [PATCH 03/10] kernel 4.11 support --- bz1448099.1.patch | 55 +++++++++++++++++ bz1448099.2.patch | 37 ++++++++++++ bz1448099.3.patch | 42 +++++++++++++ bz1448099.4.patch | 43 ++++++++++++++ bz1448099.5.patch | 72 ++++++++++++++++++++++ bz1448099.6.patch | 48 +++++++++++++++ bz1448099.7.1.patch | 36 +++++++++++ bz1448099.7.patch | 142 ++++++++++++++++++++++++++++++++++++++++++++ bz1448099.8.patch | 65 ++++++++++++++++++++ systemtap.spec | 26 +++++++- 10 files changed, 565 insertions(+), 1 deletion(-) create mode 100644 bz1448099.1.patch create mode 100644 bz1448099.2.patch create mode 100644 bz1448099.3.patch create mode 100644 bz1448099.4.patch create mode 100644 bz1448099.5.patch create mode 100644 bz1448099.6.patch create mode 100644 bz1448099.7.1.patch create mode 100644 bz1448099.7.patch create mode 100644 bz1448099.8.patch diff --git a/bz1448099.1.patch b/bz1448099.1.patch new file mode 100644 index 0000000..79c6f13 --- /dev/null +++ b/bz1448099.1.patch @@ -0,0 +1,55 @@ +commit 62640f2ed0deef9355970d216136ad4c49afa3d0 +Author: David Smith +Date: Fri Mar 17 09:36:42 2017 -0500 + + PR21255: Fix missing get_task_mm() declaration. + + * buildrun.cxx (compile_pass): Add autoconf test. This + was caused by the following kernel commit: + + commit 6e84f31522f931027bf695752087ece278c10d3f + Author: Ingo Molnar + Date: Wed Feb 8 18:51:29 2017 +0100 + + sched/headers: Prepare for new header dependencies before moving + code to + * runtime/linux/access_process_vm.h: Include and, if it + exists, . + * runtime/linux/autoconf-sched-mm.c: New file. + +diff --git a/buildrun.cxx b/buildrun.cxx +index aaea64c..644eea9 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -402,6 +402,7 @@ compile_pass (systemtap_session& s) + output_autoconf(s, o, "autoconf-netfilter-4_4.c", "STAPCONF_NETFILTER_V44", NULL); + output_autoconf(s, o, "autoconf-smpcall-5args.c", "STAPCONF_SMPCALL_5ARGS", NULL); + output_autoconf(s, o, "autoconf-smpcall-4args.c", "STAPCONF_SMPCALL_4ARGS", NULL); ++ output_autoconf(s, o, "autoconf-sched-mm.c", "STAPCONF_SCHED_MM_H", NULL); + + // used by tapset/timestamp_monotonic.stp + output_exportconf(s, o, "cpu_clock", "STAPCONF_CPU_CLOCK"); +diff --git a/runtime/linux/access_process_vm.h b/runtime/linux/access_process_vm.h +index 22a1220..a46b86f 100644 +--- a/runtime/linux/access_process_vm.h ++++ b/runtime/linux/access_process_vm.h +@@ -3,6 +3,10 @@ + * some distros export it on some architectures. To workaround this inconsistency, + * we copied and pasted it here. Fortunately, everything it calls is exported. + */ ++#include ++#ifdef STAPCONF_SCHED_MM_H ++#include ++#endif + #include + #include + +diff --git a/runtime/linux/autoconf-sched-mm.c b/runtime/linux/autoconf-sched-mm.c +new file mode 100644 +index 0000000..6d3f1c2 +--- /dev/null ++++ b/runtime/linux/autoconf-sched-mm.c +@@ -0,0 +1,3 @@ ++#include ++#include ++ diff --git a/bz1448099.2.patch b/bz1448099.2.patch new file mode 100644 index 0000000..03f203f --- /dev/null +++ b/bz1448099.2.patch @@ -0,0 +1,37 @@ +commit a477a43122609691ce6ef24f71114cfaa9790392 +Author: David Smith +Date: Fri Mar 17 10:44:12 2017 -0500 + + PR21255: Fix missing __set_task_state() definition. + + * runtime/stp_utrace.c: Fix missing __set_task_state() definition. If we + can't find a __set_task_state() definition, define our own. + +diff --git a/runtime/stp_utrace.c b/runtime/stp_utrace.c +index bb2d663..5924016 100644 +--- a/runtime/stp_utrace.c ++++ b/runtime/stp_utrace.c +@@ -29,6 +29,14 @@ + + #include "stp_helper_lock.h" + ++#if defined(__set_task_state) ++#define __stp_set_task_state(tsk, state_value) \ ++ __set_task_state((tsk), (state_value)) ++#else ++#define __stp_set_task_state(tsk, state_value) \ ++ do { (tsk)->state = (state_value); } while (0) ++#endif ++ + /* + * Per-thread structure private to utrace implementation. + * If task_struct.utrace_flags is nonzero, task_struct.utrace +@@ -1105,7 +1113,7 @@ static bool utrace_do_stop(struct task_struct *target, struct utrace *utrace) + */ + spin_lock_irq(&target->sighand->siglock); + if (likely(task_is_stopped(target))) +- __set_task_state(target, TASK_TRACED); ++ __stp_set_task_state(target, TASK_TRACED); + spin_unlock_irq(&target->sighand->siglock); + } else if (utrace->resume > UTRACE_REPORT) { + utrace->resume = UTRACE_REPORT; diff --git a/bz1448099.3.patch b/bz1448099.3.patch new file mode 100644 index 0000000..acf2f3d --- /dev/null +++ b/bz1448099.3.patch @@ -0,0 +1,42 @@ +commit 030e9465eadf7d3b3a278951264dac83b2f4b4f7 +Author: David Smith +Date: Wed Feb 22 10:04:00 2017 -0600 + + Update the vfs.stp tapset for newer kernels. + + * tapset/linux/vfs.stp: Since the __block_write_begin() function can be + inlined on newer kernels, we'll also probe + __block_write_begin_int(). Also, check to see if '$file' is defined + before using it in _vfs.block_write_begin.return. + +diff --git a/tapset/linux/vfs.stp b/tapset/linux/vfs.stp +index 4572bd7..32db300 100644 +--- a/tapset/linux/vfs.stp ++++ b/tapset/linux/vfs.stp +@@ -1104,7 +1104,8 @@ probe _vfs.generic_commit_write = kernel.function("generic_commit_write") ? + argstr = sprintf("%p, %p, %d, %d", $file, $page, $from, $to) + } + +-probe _vfs.block_prepare_write = kernel.function("__block_write_begin") !, ++probe _vfs.block_prepare_write = kernel.function("__block_write_begin_int") !, ++ kernel.function("__block_write_begin") !, + kernel.function("__block_prepare_write") + { + page = $page +@@ -1134,6 +1135,7 @@ probe _vfs.block_prepare_write = kernel.function("__block_write_begin") !, + } + + probe _vfs.block_prepare_write.return = ++ kernel.function("__block_write_begin_int").return !, + kernel.function("__block_write_begin").return !, + kernel.function("__block_prepare_write").return + { +@@ -1188,7 +1190,7 @@ probe _vfs.block_write_begin.return = + name = "_vfs.block_write_begin" + retstr = sprintf("%d", $return) + +- file = @entry($file) ++ file = @choose_defined(@entry($file), "") + pathname = @defined(@entry($file)) ? fullpath_struct_file(task_current(), @entry($file)) : "" + pos = @entry($pos) + len = @entry($len) diff --git a/bz1448099.4.patch b/bz1448099.4.patch new file mode 100644 index 0000000..158f309 --- /dev/null +++ b/bz1448099.4.patch @@ -0,0 +1,43 @@ +commit 5ab0c875df5011725f9cd2f0804c00bf9e63d492 +Author: David Smith +Date: Thu Mar 2 15:23:28 2017 -0600 + + Fix s390x compile error in runtime/stack-s390.c. + + * runtime/stack-s390.c (__stp_stack_print): Update code to let it compile + on the 4.10 kernel. Kernel commit d5c352c moved 'thread_info' into + task_struct. + +diff --git a/runtime/stack-s390.c b/runtime/stack-s390.c +index 38eb73f..56043fc 100644 +--- a/runtime/stack-s390.c ++++ b/runtime/stack-s390.c +@@ -11,7 +11,6 @@ static unsigned long + __stp_show_stack (unsigned long sp, unsigned long low, + unsigned long high, int verbose) + { +- + struct stack_frame *sf; + struct pt_regs *regs; + unsigned long ip; +@@ -62,9 +61,18 @@ static void __stp_stack_print (struct pt_regs *regs, + + sp = __stp_show_stack(sp, + S390_lowcore.async_stack - ASYNC_SIZE, +- S390_lowcore.async_stack,verbose); ++ S390_lowcore.async_stack, verbose); + ++#ifdef CONFIG_THREAD_INFO_IN_TASK ++ /* FIXME: Note that this CONFIG_THREAD_INFO_IN_TASK ++ * code is untested, since the s390 uses the dwarf ++ * unwinder so this code doesn't get called. */ ++ __stp_show_stack(sp, ((unsigned long)current->stack), ++ (((unsigned long)current->stack) ++ + THREAD_SIZE), verbose); ++#else + __stp_show_stack(sp, + S390_lowcore.thread_info, +- S390_lowcore.thread_info + THREAD_SIZE,verbose); ++ S390_lowcore.thread_info + THREAD_SIZE, verbose); ++#endif + } diff --git a/bz1448099.5.patch b/bz1448099.5.patch new file mode 100644 index 0000000..72a57ed --- /dev/null +++ b/bz1448099.5.patch @@ -0,0 +1,72 @@ +commit 386b8596d721e93ad618e682ecddb323d2bee446 +Author: David Smith +Date: Thu Mar 2 15:25:17 2017 -0600 + + Fix s390x-specific syscall tests. + + * testsuite/buildok/syscalls-arch-detailed.stp: Made s390x probe tests + optional, since the underlying probes don't exist on the 4.10 kernel. + * testsuite/buildok/nd_syscalls-arch-detailed.stp: Ditto. + +diff --git a/testsuite/buildok/nd_syscalls-arch-detailed.stp b/testsuite/buildok/nd_syscalls-arch-detailed.stp +index 364b13e..b927d15 100755 +--- a/testsuite/buildok/nd_syscalls-arch-detailed.stp ++++ b/testsuite/buildok/nd_syscalls-arch-detailed.stp +@@ -429,22 +429,22 @@ probe nd_syscall.ppc64_newuname.return ? + # + + %( arch == "s390" %? +-probe nd_syscall.getresgid16 ++probe nd_syscall.getresgid16 ? + { + printf("%s, %s\n", name, argstr) + printf("%p, %p, %p\n", rgid_uaddr, egid_uaddr, sgid_uaddr) + } +-probe nd_syscall.getresgid16.return ++probe nd_syscall.getresgid16.return ? + { + printf("%s, %s\n", name, retstr) + } + +-probe nd_syscall.getresuid16 ++probe nd_syscall.getresuid16 ? + { + printf("%s, %s\n", name, argstr) + printf("%p, %p, %p\n", ruid_uaddr, euid_uaddr, suid_uaddr) + } +-probe nd_syscall.getresuid16.return ++probe nd_syscall.getresuid16.return ? + { + printf("%s, %s\n", name, retstr) + } +diff --git a/testsuite/buildok/syscalls-arch-detailed.stp b/testsuite/buildok/syscalls-arch-detailed.stp +index 8d7d21e..914da9e 100755 +--- a/testsuite/buildok/syscalls-arch-detailed.stp ++++ b/testsuite/buildok/syscalls-arch-detailed.stp +@@ -429,22 +429,22 @@ probe syscall.ppc64_newuname.return ? + # + + %( arch == "s390" %? +-probe syscall.getresgid16 ++probe syscall.getresgid16 ? + { + printf("%s, %s\n", name, argstr) + printf("%p, %p, %p\n", rgid_uaddr, egid_uaddr, sgid_uaddr) + } +-probe syscall.getresgid16.return ++probe syscall.getresgid16.return ? + { + printf("%s, %s\n", name, retstr) + } + +-probe syscall.getresuid16 ++probe syscall.getresuid16 ? + { + printf("%s, %s\n", name, argstr) + printf("%p, %p, %p\n", ruid_uaddr, euid_uaddr, suid_uaddr) + } +-probe syscall.getresuid16.return ++probe syscall.getresuid16.return ? + { + printf("%s, %s\n", name, retstr) + } diff --git a/bz1448099.6.patch b/bz1448099.6.patch new file mode 100644 index 0000000..a781eba --- /dev/null +++ b/bz1448099.6.patch @@ -0,0 +1,48 @@ +commit 9f1c7a872e7a13d1ee29b692d0f1f4dd18a07baa +Author: David Smith +Date: Tue May 9 16:20:41 2017 -0500 + + Avoid missing "task_stack()" definition on 4.11 kernels. + + * runtime/compatdefs.h: If exists, include + it. This avoids a missing task_stack() definition. + * buildrun.cxx (compile_pass): Add autoconf test for + . + * runtime/linux/autoconf-sched-task_stack.c: New file. + +diff --git a/buildrun.cxx b/buildrun.cxx +index 21ed3c5..6da308a 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -403,6 +403,7 @@ compile_pass (systemtap_session& s) + output_autoconf(s, o, "autoconf-smpcall-5args.c", "STAPCONF_SMPCALL_5ARGS", NULL); + output_autoconf(s, o, "autoconf-smpcall-4args.c", "STAPCONF_SMPCALL_4ARGS", NULL); + output_autoconf(s, o, "autoconf-sched-mm.c", "STAPCONF_SCHED_MM_H", NULL); ++ output_autoconf(s, o, "autoconf-sched-task_stack.c", "STAPCONF_SCHED_TASK_STACK_H", NULL); + + // used by tapset/timestamp_monotonic.stp + output_exportconf(s, o, "cpu_clock", "STAPCONF_CPU_CLOCK"); +diff --git a/runtime/compatdefs.h b/runtime/compatdefs.h +index ba429b5..f261bfd 100644 +--- a/runtime/compatdefs.h ++++ b/runtime/compatdefs.h +@@ -57,6 +57,10 @@ static inline int _stp_is_compat_task(void) + */ + #include + #include ++#include ++#ifdef STAPCONF_SCHED_TASK_STACK_H ++#include ++#endif + + #if !defined(task_pt_regs) + #if defined(__powerpc__) +diff --git a/runtime/linux/autoconf-sched-task_stack.c b/runtime/linux/autoconf-sched-task_stack.c +new file mode 100644 +index 0000000..cdfcc60 +--- /dev/null ++++ b/runtime/linux/autoconf-sched-task_stack.c +@@ -0,0 +1,3 @@ ++#include ++#include ++ diff --git a/bz1448099.7.1.patch b/bz1448099.7.1.patch new file mode 100644 index 0000000..96d1db5 --- /dev/null +++ b/bz1448099.7.1.patch @@ -0,0 +1,36 @@ +diff --git a/tapset/linux/proc_mem.stp b/tapset/linux/proc_mem.stp +index 4b20686..890be69 100644 +--- a/tapset/linux/proc_mem.stp ++++ b/tapset/linux/proc_mem.stp +@@ -155,7 +155,7 @@ function proc_mem_size_pid:long (pid:long) + if (_stp_valid_task(task)) { + mm = task->mm + if (mm != 0) +- return mm->total_vm ++ return @mm(mm)->total_vm + } + return 0 + } +@@ -322,8 +322,8 @@ function proc_mem_txt_pid:long (pid:long) + if (_stp_valid_task(task)) { + mm = task->mm + if (mm != 0) { +- s = mm->start_code +- e = mm->end_code ++ s = @mm(mm)->start_code ++ e = @mm(mm)->end_code + return _stp_mem_txt_adjust (s, e) + } + } +@@ -381,8 +381,9 @@ function proc_mem_data_pid:long (pid:long) + if (_stp_valid_task(task)) { + mm = task->mm + if (mm != 0) { +- return (@defined(&@mm(0)->data_vm) ? (mm->data_vm + mm->stack_vm) +- : (mm->total_vm - mm->shared_vm)) ++ return (@defined(&@mm(0)->data_vm) ++ ? (@mm(mm)->data_vm + @mm(mm)->stack_vm) ++ : (@mm(mm)->total_vm - @mm(mm)->shared_vm)) + } + } + return 0 diff --git a/bz1448099.7.patch b/bz1448099.7.patch new file mode 100644 index 0000000..c2757a8 --- /dev/null +++ b/bz1448099.7.patch @@ -0,0 +1,142 @@ +commit c7029a89f5f1ff6d6a7008e8bccb797046f8af50 +Author: David Smith +Date: Tue May 9 16:32:25 2017 -0500 + + Add missing @cast() calls for 4.11 kernels. + + * tapset/linux/task.stp: Add a "signal_struct" cast to + _task_rlimit_cur(). + * tapset/linux/task.stpm: Fix @mm() macro for kernels >= 2.6.34, where the + mm_struct definition has moved to + * tapset/linux/proc_mem.stp (proc_mem_size): Use the @mm() macro to cast + values to a mm_struct. + (proc_mem_txt): Ditto. + (proc_mem_data): Ditto. + * tapset/linux/context.stp (cmdline_args): Ditto. + * tapset/linux/context-envvar.stp (env_var): Ditto. + +diff --git a/tapset/linux/context-envvar.stp b/tapset/linux/context-envvar.stp +index 4d4c648..2ceb6c8 100644 +--- a/tapset/linux/context-envvar.stp ++++ b/tapset/linux/context-envvar.stp +@@ -28,8 +28,8 @@ function env_var:string(name:string) + mm = task_current()->mm; + if (mm) + { +- env_start = mm->env_start; +- env_end = mm->env_end; ++ env_start = @mm(mm)->env_start; ++ env_end = @mm(mm)->env_end; + if (env_start != 0 && env_end != 0) + { + len = env_end - env_start; +diff --git a/tapset/linux/context.stp b/tapset/linux/context.stp +index e563983..8ab81b4 100644 +--- a/tapset/linux/context.stp ++++ b/tapset/linux/context.stp +@@ -559,8 +559,8 @@ function cmdline_args:string(n:long, m:long, delim:string) + if (__mm == 0) + return ""; + +- __arg_start = __mm->arg_start; +- __arg_end = __mm->arg_end; ++ __arg_start = @mm(__mm)->arg_start; ++ __arg_end = @mm(__mm)->arg_end; + if (__arg_start == 0 || __arg_end == 0) + return ""; + +diff --git a/tapset/linux/proc_mem.stp b/tapset/linux/proc_mem.stp +index de6f423..161033d 100644 +--- a/tapset/linux/proc_mem.stp ++++ b/tapset/linux/proc_mem.stp +@@ -124,7 +124,7 @@ function proc_mem_size:long () + if (_stp_valid_task(task)) { + mm = task->mm + if (mm != 0) +- return mm->total_vm ++ return @mm(mm)->total_vm + } + return 0 + } +@@ -144,7 +144,7 @@ function proc_mem_size:long (pid:long) + if (_stp_valid_task(task)) { + mm = task->mm + if (mm != 0) +- return mm->total_vm ++ return @mm(mm)->total_vm + } + return 0 + } +@@ -260,8 +260,8 @@ function proc_mem_txt:long () + if (_stp_valid_task(task)) { + mm = task->mm + if (mm != 0) { +- s = mm->start_code +- e = mm->end_code ++ s = @mm(mm)->start_code ++ e = @mm(mm)->end_code + return _stp_mem_txt_adjust(s, e) + } + } +@@ -283,8 +283,8 @@ function proc_mem_txt:long (pid:long) + if (_stp_valid_task(task)) { + mm = task->mm + if (mm != 0) { +- s = mm->start_code +- e = mm->end_code ++ s = @mm(mm)->start_code ++ e = @mm(mm)->end_code + return _stp_mem_txt_adjust (s, e) + } + } +@@ -308,8 +308,9 @@ function proc_mem_data:long () + if (_stp_valid_task(task)) { + mm = task->mm + if (mm != 0) { +- return (@defined(&@mm(0)->data_vm) ? (mm->data_vm + mm->stack_vm) +- : (mm->total_vm - mm->shared_vm)) ++ return (@defined(&@mm(0)->data_vm) ++ ? (@mm(mm)->data_vm + @mm(mm)->stack_vm) ++ : (@mm(mm)->total_vm - @mm(mm)->shared_vm)) + } + } + return 0 +@@ -330,8 +331,9 @@ function proc_mem_data:long (pid:long) + if (_stp_valid_task(task)) { + mm = task->mm + if (mm != 0) { +- return (@defined(&@mm(0)->data_vm) ? (mm->data_vm + mm->stack_vm) +- : (mm->total_vm - mm->shared_vm)) ++ return (@defined(&@mm(0)->data_vm) ++ ? (@mm(mm)->data_vm + @mm(mm)->stack_vm) ++ : (@mm(mm)->total_vm - @mm(mm)->shared_vm)) + } + } + return 0 +diff --git a/tapset/linux/task.stp b/tapset/linux/task.stp +index 5467e05..f7c852e 100644 +--- a/tapset/linux/task.stp ++++ b/tapset/linux/task.stp +@@ -40,7 +40,7 @@ function task_current:long () { + return -1; + } + sig = @task(task)->signal; +- return sig->rlim[nd_limit]->rlim_cur; ++ return @cast(sig, "signal_struct")->rlim[nd_limit]->rlim_cur; + } + + /* sfunction task_rlimit - The current resource limit of the task +diff --git a/tapset/linux/task.stpm b/tapset/linux/task.stpm +index 7df04e3..f1bfb8e 100644 +--- a/tapset/linux/task.stpm ++++ b/tapset/linux/task.stpm +@@ -3,5 +3,9 @@ + %) + + @define mm(ptr) %( ++ %( kernel_v >= "2.6.34" %? ++ @cast(@ptr, "mm_struct", "kernel") ++ %: + @cast(@ptr, "mm_struct", "kernel") ++ %) + %) diff --git a/bz1448099.8.patch b/bz1448099.8.patch new file mode 100644 index 0000000..45c8a72 --- /dev/null +++ b/bz1448099.8.patch @@ -0,0 +1,65 @@ +commit 35ea394c93d3c296c0c809d21bc397b531b7e965 +Author: David Smith +Date: Tue May 9 16:39:11 2017 -0500 + + Add small testsuite fixes for 4.11 kernels. + + * testsuite/buildok/twentyseven.stp: Avoid missing inlined function + arguments by probing 'kernel.function("do_execve").call'. + * testsuite/buildok/thirtyone.stp: On 4.11 kernels, handle the vfs_stat() + function being renamed to vfs_statx(). + * testsuite/systemtap.pass1-4/buildok.exp: Add kfails for + buildok/fortyfour.stp and buildok/map_probe_cond.stp if we don't have + uprobes. + * testsuite/systemtap.pass1-4/buildok-interactive.exp: Ditto. + +diff --git a/testsuite/buildok/thirtyone.stp b/testsuite/buildok/thirtyone.stp +index ccba660..e7e102d 100755 +--- a/testsuite/buildok/thirtyone.stp ++++ b/testsuite/buildok/thirtyone.stp +@@ -1,5 +1,5 @@ + #! stap -wp4 + +-probe kprobe.function("vfs_stat") {} ++probe kprobe.function("vfs_stat")!, kprobe.function("vfs_statx") ? {} + probe kprobe.function("do_sys_open") {} + probe kernel.function("filp_close") {} +diff --git a/testsuite/buildok/twentyseven.stp b/testsuite/buildok/twentyseven.stp +index 62900f3..a3cbfde 100755 +--- a/testsuite/buildok/twentyseven.stp ++++ b/testsuite/buildok/twentyseven.stp +@@ -1,6 +1,6 @@ + #! stap -p4 + +-probe kernel.function("do_execve") ++probe kernel.function("do_execve").call + { + print(@defined($__argv) ? $__argv[0] : $argv[0]) + } +diff --git a/testsuite/systemtap.pass1-4/buildok-interactive.exp b/testsuite/systemtap.pass1-4/buildok-interactive.exp +index fc4a019..d15640f 100644 +--- a/testsuite/systemtap.pass1-4/buildok-interactive.exp ++++ b/testsuite/systemtap.pass1-4/buildok-interactive.exp +@@ -188,6 +188,9 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] { + # without utrace. + if {$rc == 1 && ![utrace_p]} { setup_kfail UTRACE *-*-*} } + ++ buildok/fortyfour.stp - ++ buildok/map_probe_cond.stp - ++ buildok/pretty-uprobes.stp - + buildok/pretty-uprobes.stp - + buildok/ucontext-symbols-embedded.stp - + buildok/ucontext-unwind-embedded.stp { +diff --git a/testsuite/systemtap.pass1-4/buildok.exp b/testsuite/systemtap.pass1-4/buildok.exp +index 3926b7f..79f2217 100644 +--- a/testsuite/systemtap.pass1-4/buildok.exp ++++ b/testsuite/systemtap.pass1-4/buildok.exp +@@ -40,6 +40,8 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] { + # without utrace. + if {$rc != 0 && ![utrace_p]} { setup_kfail UTRACE *-*-*} } + ++ buildok/fortyfour.stp - ++ buildok/map_probe_cond.stp - + buildok/pretty-uprobes.stp - + buildok/ucontext-symbols-embedded.stp - + buildok/ucontext-unwind-embedded.stp { diff --git a/systemtap.spec b/systemtap.spec index 406b28b..fe2cbfd 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -72,7 +72,7 @@ Name: systemtap Version: 3.1 -Release: 3%{?dist} +Release: 5%{?dist} # for version, see also configure.ac @@ -187,6 +187,16 @@ BuildRequires: python3-setuptools %endif Patch10: bz1439914.patch +Patch21: bz1448099.1.patch +Patch22: bz1448099.2.patch +Patch23: bz1448099.3.patch +Patch24: bz1448099.4.patch +Patch25: bz1448099.5.patch +Patch26: bz1448099.6.patch +Patch27: bz1448099.7.patch +Patch28: bz1448099.7.1.patch +Patch29: bz1448099.8.patch + # Install requirements Requires: systemtap-client = %{version}-%{release} @@ -475,6 +485,17 @@ find . \( -name configure -o -name config.h.in \) -print | xargs touch cd .. %endif +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch29 -p1 + + %build %if %{with_bundled_elfutils} @@ -1142,6 +1163,9 @@ done # PRERELEASE %changelog +* Mon May 15 2017 Frank Ch. Eigler - 3.1-5 +- Build with dsmith's bz1448099 patches for support of kernel 4.11 + * Thu Apr 06 2017 Frank Ch. Eigler - 3.1-3 - Backport bz1439914 (sys/sdt.h argument encoding) From f6d32ace8fa19c1f583cd4186cd7e200dc50bd46 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 18 Oct 2017 14:20:46 -0400 Subject: [PATCH 04/10] upstream 3.2 release --- bz1439914.patch | 36 ----------- bz1448099.1.patch | 55 ----------------- bz1448099.2.patch | 37 ------------ bz1448099.3.patch | 42 ------------- bz1448099.4.patch | 43 -------------- bz1448099.5.patch | 72 ---------------------- bz1448099.6.patch | 48 --------------- bz1448099.7.1.patch | 36 ----------- bz1448099.7.patch | 142 -------------------------------------------- bz1448099.8.patch | 65 -------------------- sources | 2 +- systemtap.spec | 61 ++++++++----------- 12 files changed, 26 insertions(+), 613 deletions(-) delete mode 100644 bz1439914.patch delete mode 100644 bz1448099.1.patch delete mode 100644 bz1448099.2.patch delete mode 100644 bz1448099.3.patch delete mode 100644 bz1448099.4.patch delete mode 100644 bz1448099.5.patch delete mode 100644 bz1448099.6.patch delete mode 100644 bz1448099.7.1.patch delete mode 100644 bz1448099.7.patch delete mode 100644 bz1448099.8.patch diff --git a/bz1439914.patch b/bz1439914.patch deleted file mode 100644 index 22d273a..0000000 --- a/bz1439914.patch +++ /dev/null @@ -1,36 +0,0 @@ -commit 272146660f54786bb61d388f6d3a4eb20e7d9369 (origin/master2, master2) -Author: Jakub Jelinek -Date: Tue Mar 21 17:04:08 2017 -0400 - - gcc PR80115: sys/sdt.h: tweak i386 argument passing - - Use %w[arg] to request that widened forms of register names be passed - to the sys/sdt.h macro operand strings, so as to avoid nominating - sub-registers such as %sil within -m32 code, which gcc <= 6 sometimes - buggily did. - -diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h -index 3b7eda7976d1..eff315bcd885 100644 ---- a/includes/sys/sdt.h -+++ b/includes/sys/sdt.h -@@ -82,9 +82,11 @@ - # define _SDT_ASM_STRING_1(x) _SDT_ASM_1(.asciz #x) - - # define _SDT_ARGFMT(no) %n[_SDT_S##no]@_SDT_ARGTMPL(_SDT_A##no) -+ - # ifndef STAP_SDT_ARG_CONSTRAINT - # define STAP_SDT_ARG_CONSTRAINT nor - # endif -+ - # define _SDT_STRINGIFY(x) #x - # define _SDT_ARG_CONSTRAINT_STRING(x) _SDT_STRINGIFY(x) - # define _SDT_ARG(n, x) \ -@@ -173,6 +175,8 @@ __extension__ extern unsigned long long __sdt_unsp; - - #if defined __powerpc__ || defined __powerpc64__ - # define _SDT_ARGTMPL(id) %I[id]%[id] -+#elif defined __i386__ -+# define _SDT_ARGTMPL(id) %w[id] /* gcc.gnu.org/PR80115 */ - #else - # define _SDT_ARGTMPL(id) %[id] - #endif diff --git a/bz1448099.1.patch b/bz1448099.1.patch deleted file mode 100644 index 79c6f13..0000000 --- a/bz1448099.1.patch +++ /dev/null @@ -1,55 +0,0 @@ -commit 62640f2ed0deef9355970d216136ad4c49afa3d0 -Author: David Smith -Date: Fri Mar 17 09:36:42 2017 -0500 - - PR21255: Fix missing get_task_mm() declaration. - - * buildrun.cxx (compile_pass): Add autoconf test. This - was caused by the following kernel commit: - - commit 6e84f31522f931027bf695752087ece278c10d3f - Author: Ingo Molnar - Date: Wed Feb 8 18:51:29 2017 +0100 - - sched/headers: Prepare for new header dependencies before moving - code to - * runtime/linux/access_process_vm.h: Include and, if it - exists, . - * runtime/linux/autoconf-sched-mm.c: New file. - -diff --git a/buildrun.cxx b/buildrun.cxx -index aaea64c..644eea9 100644 ---- a/buildrun.cxx -+++ b/buildrun.cxx -@@ -402,6 +402,7 @@ compile_pass (systemtap_session& s) - output_autoconf(s, o, "autoconf-netfilter-4_4.c", "STAPCONF_NETFILTER_V44", NULL); - output_autoconf(s, o, "autoconf-smpcall-5args.c", "STAPCONF_SMPCALL_5ARGS", NULL); - output_autoconf(s, o, "autoconf-smpcall-4args.c", "STAPCONF_SMPCALL_4ARGS", NULL); -+ output_autoconf(s, o, "autoconf-sched-mm.c", "STAPCONF_SCHED_MM_H", NULL); - - // used by tapset/timestamp_monotonic.stp - output_exportconf(s, o, "cpu_clock", "STAPCONF_CPU_CLOCK"); -diff --git a/runtime/linux/access_process_vm.h b/runtime/linux/access_process_vm.h -index 22a1220..a46b86f 100644 ---- a/runtime/linux/access_process_vm.h -+++ b/runtime/linux/access_process_vm.h -@@ -3,6 +3,10 @@ - * some distros export it on some architectures. To workaround this inconsistency, - * we copied and pasted it here. Fortunately, everything it calls is exported. - */ -+#include -+#ifdef STAPCONF_SCHED_MM_H -+#include -+#endif - #include - #include - -diff --git a/runtime/linux/autoconf-sched-mm.c b/runtime/linux/autoconf-sched-mm.c -new file mode 100644 -index 0000000..6d3f1c2 ---- /dev/null -+++ b/runtime/linux/autoconf-sched-mm.c -@@ -0,0 +1,3 @@ -+#include -+#include -+ diff --git a/bz1448099.2.patch b/bz1448099.2.patch deleted file mode 100644 index 03f203f..0000000 --- a/bz1448099.2.patch +++ /dev/null @@ -1,37 +0,0 @@ -commit a477a43122609691ce6ef24f71114cfaa9790392 -Author: David Smith -Date: Fri Mar 17 10:44:12 2017 -0500 - - PR21255: Fix missing __set_task_state() definition. - - * runtime/stp_utrace.c: Fix missing __set_task_state() definition. If we - can't find a __set_task_state() definition, define our own. - -diff --git a/runtime/stp_utrace.c b/runtime/stp_utrace.c -index bb2d663..5924016 100644 ---- a/runtime/stp_utrace.c -+++ b/runtime/stp_utrace.c -@@ -29,6 +29,14 @@ - - #include "stp_helper_lock.h" - -+#if defined(__set_task_state) -+#define __stp_set_task_state(tsk, state_value) \ -+ __set_task_state((tsk), (state_value)) -+#else -+#define __stp_set_task_state(tsk, state_value) \ -+ do { (tsk)->state = (state_value); } while (0) -+#endif -+ - /* - * Per-thread structure private to utrace implementation. - * If task_struct.utrace_flags is nonzero, task_struct.utrace -@@ -1105,7 +1113,7 @@ static bool utrace_do_stop(struct task_struct *target, struct utrace *utrace) - */ - spin_lock_irq(&target->sighand->siglock); - if (likely(task_is_stopped(target))) -- __set_task_state(target, TASK_TRACED); -+ __stp_set_task_state(target, TASK_TRACED); - spin_unlock_irq(&target->sighand->siglock); - } else if (utrace->resume > UTRACE_REPORT) { - utrace->resume = UTRACE_REPORT; diff --git a/bz1448099.3.patch b/bz1448099.3.patch deleted file mode 100644 index acf2f3d..0000000 --- a/bz1448099.3.patch +++ /dev/null @@ -1,42 +0,0 @@ -commit 030e9465eadf7d3b3a278951264dac83b2f4b4f7 -Author: David Smith -Date: Wed Feb 22 10:04:00 2017 -0600 - - Update the vfs.stp tapset for newer kernels. - - * tapset/linux/vfs.stp: Since the __block_write_begin() function can be - inlined on newer kernels, we'll also probe - __block_write_begin_int(). Also, check to see if '$file' is defined - before using it in _vfs.block_write_begin.return. - -diff --git a/tapset/linux/vfs.stp b/tapset/linux/vfs.stp -index 4572bd7..32db300 100644 ---- a/tapset/linux/vfs.stp -+++ b/tapset/linux/vfs.stp -@@ -1104,7 +1104,8 @@ probe _vfs.generic_commit_write = kernel.function("generic_commit_write") ? - argstr = sprintf("%p, %p, %d, %d", $file, $page, $from, $to) - } - --probe _vfs.block_prepare_write = kernel.function("__block_write_begin") !, -+probe _vfs.block_prepare_write = kernel.function("__block_write_begin_int") !, -+ kernel.function("__block_write_begin") !, - kernel.function("__block_prepare_write") - { - page = $page -@@ -1134,6 +1135,7 @@ probe _vfs.block_prepare_write = kernel.function("__block_write_begin") !, - } - - probe _vfs.block_prepare_write.return = -+ kernel.function("__block_write_begin_int").return !, - kernel.function("__block_write_begin").return !, - kernel.function("__block_prepare_write").return - { -@@ -1188,7 +1190,7 @@ probe _vfs.block_write_begin.return = - name = "_vfs.block_write_begin" - retstr = sprintf("%d", $return) - -- file = @entry($file) -+ file = @choose_defined(@entry($file), "") - pathname = @defined(@entry($file)) ? fullpath_struct_file(task_current(), @entry($file)) : "" - pos = @entry($pos) - len = @entry($len) diff --git a/bz1448099.4.patch b/bz1448099.4.patch deleted file mode 100644 index 158f309..0000000 --- a/bz1448099.4.patch +++ /dev/null @@ -1,43 +0,0 @@ -commit 5ab0c875df5011725f9cd2f0804c00bf9e63d492 -Author: David Smith -Date: Thu Mar 2 15:23:28 2017 -0600 - - Fix s390x compile error in runtime/stack-s390.c. - - * runtime/stack-s390.c (__stp_stack_print): Update code to let it compile - on the 4.10 kernel. Kernel commit d5c352c moved 'thread_info' into - task_struct. - -diff --git a/runtime/stack-s390.c b/runtime/stack-s390.c -index 38eb73f..56043fc 100644 ---- a/runtime/stack-s390.c -+++ b/runtime/stack-s390.c -@@ -11,7 +11,6 @@ static unsigned long - __stp_show_stack (unsigned long sp, unsigned long low, - unsigned long high, int verbose) - { -- - struct stack_frame *sf; - struct pt_regs *regs; - unsigned long ip; -@@ -62,9 +61,18 @@ static void __stp_stack_print (struct pt_regs *regs, - - sp = __stp_show_stack(sp, - S390_lowcore.async_stack - ASYNC_SIZE, -- S390_lowcore.async_stack,verbose); -+ S390_lowcore.async_stack, verbose); - -+#ifdef CONFIG_THREAD_INFO_IN_TASK -+ /* FIXME: Note that this CONFIG_THREAD_INFO_IN_TASK -+ * code is untested, since the s390 uses the dwarf -+ * unwinder so this code doesn't get called. */ -+ __stp_show_stack(sp, ((unsigned long)current->stack), -+ (((unsigned long)current->stack) -+ + THREAD_SIZE), verbose); -+#else - __stp_show_stack(sp, - S390_lowcore.thread_info, -- S390_lowcore.thread_info + THREAD_SIZE,verbose); -+ S390_lowcore.thread_info + THREAD_SIZE, verbose); -+#endif - } diff --git a/bz1448099.5.patch b/bz1448099.5.patch deleted file mode 100644 index 72a57ed..0000000 --- a/bz1448099.5.patch +++ /dev/null @@ -1,72 +0,0 @@ -commit 386b8596d721e93ad618e682ecddb323d2bee446 -Author: David Smith -Date: Thu Mar 2 15:25:17 2017 -0600 - - Fix s390x-specific syscall tests. - - * testsuite/buildok/syscalls-arch-detailed.stp: Made s390x probe tests - optional, since the underlying probes don't exist on the 4.10 kernel. - * testsuite/buildok/nd_syscalls-arch-detailed.stp: Ditto. - -diff --git a/testsuite/buildok/nd_syscalls-arch-detailed.stp b/testsuite/buildok/nd_syscalls-arch-detailed.stp -index 364b13e..b927d15 100755 ---- a/testsuite/buildok/nd_syscalls-arch-detailed.stp -+++ b/testsuite/buildok/nd_syscalls-arch-detailed.stp -@@ -429,22 +429,22 @@ probe nd_syscall.ppc64_newuname.return ? - # - - %( arch == "s390" %? --probe nd_syscall.getresgid16 -+probe nd_syscall.getresgid16 ? - { - printf("%s, %s\n", name, argstr) - printf("%p, %p, %p\n", rgid_uaddr, egid_uaddr, sgid_uaddr) - } --probe nd_syscall.getresgid16.return -+probe nd_syscall.getresgid16.return ? - { - printf("%s, %s\n", name, retstr) - } - --probe nd_syscall.getresuid16 -+probe nd_syscall.getresuid16 ? - { - printf("%s, %s\n", name, argstr) - printf("%p, %p, %p\n", ruid_uaddr, euid_uaddr, suid_uaddr) - } --probe nd_syscall.getresuid16.return -+probe nd_syscall.getresuid16.return ? - { - printf("%s, %s\n", name, retstr) - } -diff --git a/testsuite/buildok/syscalls-arch-detailed.stp b/testsuite/buildok/syscalls-arch-detailed.stp -index 8d7d21e..914da9e 100755 ---- a/testsuite/buildok/syscalls-arch-detailed.stp -+++ b/testsuite/buildok/syscalls-arch-detailed.stp -@@ -429,22 +429,22 @@ probe syscall.ppc64_newuname.return ? - # - - %( arch == "s390" %? --probe syscall.getresgid16 -+probe syscall.getresgid16 ? - { - printf("%s, %s\n", name, argstr) - printf("%p, %p, %p\n", rgid_uaddr, egid_uaddr, sgid_uaddr) - } --probe syscall.getresgid16.return -+probe syscall.getresgid16.return ? - { - printf("%s, %s\n", name, retstr) - } - --probe syscall.getresuid16 -+probe syscall.getresuid16 ? - { - printf("%s, %s\n", name, argstr) - printf("%p, %p, %p\n", ruid_uaddr, euid_uaddr, suid_uaddr) - } --probe syscall.getresuid16.return -+probe syscall.getresuid16.return ? - { - printf("%s, %s\n", name, retstr) - } diff --git a/bz1448099.6.patch b/bz1448099.6.patch deleted file mode 100644 index a781eba..0000000 --- a/bz1448099.6.patch +++ /dev/null @@ -1,48 +0,0 @@ -commit 9f1c7a872e7a13d1ee29b692d0f1f4dd18a07baa -Author: David Smith -Date: Tue May 9 16:20:41 2017 -0500 - - Avoid missing "task_stack()" definition on 4.11 kernels. - - * runtime/compatdefs.h: If exists, include - it. This avoids a missing task_stack() definition. - * buildrun.cxx (compile_pass): Add autoconf test for - . - * runtime/linux/autoconf-sched-task_stack.c: New file. - -diff --git a/buildrun.cxx b/buildrun.cxx -index 21ed3c5..6da308a 100644 ---- a/buildrun.cxx -+++ b/buildrun.cxx -@@ -403,6 +403,7 @@ compile_pass (systemtap_session& s) - output_autoconf(s, o, "autoconf-smpcall-5args.c", "STAPCONF_SMPCALL_5ARGS", NULL); - output_autoconf(s, o, "autoconf-smpcall-4args.c", "STAPCONF_SMPCALL_4ARGS", NULL); - output_autoconf(s, o, "autoconf-sched-mm.c", "STAPCONF_SCHED_MM_H", NULL); -+ output_autoconf(s, o, "autoconf-sched-task_stack.c", "STAPCONF_SCHED_TASK_STACK_H", NULL); - - // used by tapset/timestamp_monotonic.stp - output_exportconf(s, o, "cpu_clock", "STAPCONF_CPU_CLOCK"); -diff --git a/runtime/compatdefs.h b/runtime/compatdefs.h -index ba429b5..f261bfd 100644 ---- a/runtime/compatdefs.h -+++ b/runtime/compatdefs.h -@@ -57,6 +57,10 @@ static inline int _stp_is_compat_task(void) - */ - #include - #include -+#include -+#ifdef STAPCONF_SCHED_TASK_STACK_H -+#include -+#endif - - #if !defined(task_pt_regs) - #if defined(__powerpc__) -diff --git a/runtime/linux/autoconf-sched-task_stack.c b/runtime/linux/autoconf-sched-task_stack.c -new file mode 100644 -index 0000000..cdfcc60 ---- /dev/null -+++ b/runtime/linux/autoconf-sched-task_stack.c -@@ -0,0 +1,3 @@ -+#include -+#include -+ diff --git a/bz1448099.7.1.patch b/bz1448099.7.1.patch deleted file mode 100644 index 96d1db5..0000000 --- a/bz1448099.7.1.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/tapset/linux/proc_mem.stp b/tapset/linux/proc_mem.stp -index 4b20686..890be69 100644 ---- a/tapset/linux/proc_mem.stp -+++ b/tapset/linux/proc_mem.stp -@@ -155,7 +155,7 @@ function proc_mem_size_pid:long (pid:long) - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) -- return mm->total_vm -+ return @mm(mm)->total_vm - } - return 0 - } -@@ -322,8 +322,8 @@ function proc_mem_txt_pid:long (pid:long) - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) { -- s = mm->start_code -- e = mm->end_code -+ s = @mm(mm)->start_code -+ e = @mm(mm)->end_code - return _stp_mem_txt_adjust (s, e) - } - } -@@ -381,8 +381,9 @@ function proc_mem_data_pid:long (pid:long) - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) { -- return (@defined(&@mm(0)->data_vm) ? (mm->data_vm + mm->stack_vm) -- : (mm->total_vm - mm->shared_vm)) -+ return (@defined(&@mm(0)->data_vm) -+ ? (@mm(mm)->data_vm + @mm(mm)->stack_vm) -+ : (@mm(mm)->total_vm - @mm(mm)->shared_vm)) - } - } - return 0 diff --git a/bz1448099.7.patch b/bz1448099.7.patch deleted file mode 100644 index c2757a8..0000000 --- a/bz1448099.7.patch +++ /dev/null @@ -1,142 +0,0 @@ -commit c7029a89f5f1ff6d6a7008e8bccb797046f8af50 -Author: David Smith -Date: Tue May 9 16:32:25 2017 -0500 - - Add missing @cast() calls for 4.11 kernels. - - * tapset/linux/task.stp: Add a "signal_struct" cast to - _task_rlimit_cur(). - * tapset/linux/task.stpm: Fix @mm() macro for kernels >= 2.6.34, where the - mm_struct definition has moved to - * tapset/linux/proc_mem.stp (proc_mem_size): Use the @mm() macro to cast - values to a mm_struct. - (proc_mem_txt): Ditto. - (proc_mem_data): Ditto. - * tapset/linux/context.stp (cmdline_args): Ditto. - * tapset/linux/context-envvar.stp (env_var): Ditto. - -diff --git a/tapset/linux/context-envvar.stp b/tapset/linux/context-envvar.stp -index 4d4c648..2ceb6c8 100644 ---- a/tapset/linux/context-envvar.stp -+++ b/tapset/linux/context-envvar.stp -@@ -28,8 +28,8 @@ function env_var:string(name:string) - mm = task_current()->mm; - if (mm) - { -- env_start = mm->env_start; -- env_end = mm->env_end; -+ env_start = @mm(mm)->env_start; -+ env_end = @mm(mm)->env_end; - if (env_start != 0 && env_end != 0) - { - len = env_end - env_start; -diff --git a/tapset/linux/context.stp b/tapset/linux/context.stp -index e563983..8ab81b4 100644 ---- a/tapset/linux/context.stp -+++ b/tapset/linux/context.stp -@@ -559,8 +559,8 @@ function cmdline_args:string(n:long, m:long, delim:string) - if (__mm == 0) - return ""; - -- __arg_start = __mm->arg_start; -- __arg_end = __mm->arg_end; -+ __arg_start = @mm(__mm)->arg_start; -+ __arg_end = @mm(__mm)->arg_end; - if (__arg_start == 0 || __arg_end == 0) - return ""; - -diff --git a/tapset/linux/proc_mem.stp b/tapset/linux/proc_mem.stp -index de6f423..161033d 100644 ---- a/tapset/linux/proc_mem.stp -+++ b/tapset/linux/proc_mem.stp -@@ -124,7 +124,7 @@ function proc_mem_size:long () - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) -- return mm->total_vm -+ return @mm(mm)->total_vm - } - return 0 - } -@@ -144,7 +144,7 @@ function proc_mem_size:long (pid:long) - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) -- return mm->total_vm -+ return @mm(mm)->total_vm - } - return 0 - } -@@ -260,8 +260,8 @@ function proc_mem_txt:long () - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) { -- s = mm->start_code -- e = mm->end_code -+ s = @mm(mm)->start_code -+ e = @mm(mm)->end_code - return _stp_mem_txt_adjust(s, e) - } - } -@@ -283,8 +283,8 @@ function proc_mem_txt:long (pid:long) - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) { -- s = mm->start_code -- e = mm->end_code -+ s = @mm(mm)->start_code -+ e = @mm(mm)->end_code - return _stp_mem_txt_adjust (s, e) - } - } -@@ -308,8 +308,9 @@ function proc_mem_data:long () - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) { -- return (@defined(&@mm(0)->data_vm) ? (mm->data_vm + mm->stack_vm) -- : (mm->total_vm - mm->shared_vm)) -+ return (@defined(&@mm(0)->data_vm) -+ ? (@mm(mm)->data_vm + @mm(mm)->stack_vm) -+ : (@mm(mm)->total_vm - @mm(mm)->shared_vm)) - } - } - return 0 -@@ -330,8 +331,9 @@ function proc_mem_data:long (pid:long) - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) { -- return (@defined(&@mm(0)->data_vm) ? (mm->data_vm + mm->stack_vm) -- : (mm->total_vm - mm->shared_vm)) -+ return (@defined(&@mm(0)->data_vm) -+ ? (@mm(mm)->data_vm + @mm(mm)->stack_vm) -+ : (@mm(mm)->total_vm - @mm(mm)->shared_vm)) - } - } - return 0 -diff --git a/tapset/linux/task.stp b/tapset/linux/task.stp -index 5467e05..f7c852e 100644 ---- a/tapset/linux/task.stp -+++ b/tapset/linux/task.stp -@@ -40,7 +40,7 @@ function task_current:long () { - return -1; - } - sig = @task(task)->signal; -- return sig->rlim[nd_limit]->rlim_cur; -+ return @cast(sig, "signal_struct")->rlim[nd_limit]->rlim_cur; - } - - /* sfunction task_rlimit - The current resource limit of the task -diff --git a/tapset/linux/task.stpm b/tapset/linux/task.stpm -index 7df04e3..f1bfb8e 100644 ---- a/tapset/linux/task.stpm -+++ b/tapset/linux/task.stpm -@@ -3,5 +3,9 @@ - %) - - @define mm(ptr) %( -+ %( kernel_v >= "2.6.34" %? -+ @cast(@ptr, "mm_struct", "kernel") -+ %: - @cast(@ptr, "mm_struct", "kernel") -+ %) - %) diff --git a/bz1448099.8.patch b/bz1448099.8.patch deleted file mode 100644 index 45c8a72..0000000 --- a/bz1448099.8.patch +++ /dev/null @@ -1,65 +0,0 @@ -commit 35ea394c93d3c296c0c809d21bc397b531b7e965 -Author: David Smith -Date: Tue May 9 16:39:11 2017 -0500 - - Add small testsuite fixes for 4.11 kernels. - - * testsuite/buildok/twentyseven.stp: Avoid missing inlined function - arguments by probing 'kernel.function("do_execve").call'. - * testsuite/buildok/thirtyone.stp: On 4.11 kernels, handle the vfs_stat() - function being renamed to vfs_statx(). - * testsuite/systemtap.pass1-4/buildok.exp: Add kfails for - buildok/fortyfour.stp and buildok/map_probe_cond.stp if we don't have - uprobes. - * testsuite/systemtap.pass1-4/buildok-interactive.exp: Ditto. - -diff --git a/testsuite/buildok/thirtyone.stp b/testsuite/buildok/thirtyone.stp -index ccba660..e7e102d 100755 ---- a/testsuite/buildok/thirtyone.stp -+++ b/testsuite/buildok/thirtyone.stp -@@ -1,5 +1,5 @@ - #! stap -wp4 - --probe kprobe.function("vfs_stat") {} -+probe kprobe.function("vfs_stat")!, kprobe.function("vfs_statx") ? {} - probe kprobe.function("do_sys_open") {} - probe kernel.function("filp_close") {} -diff --git a/testsuite/buildok/twentyseven.stp b/testsuite/buildok/twentyseven.stp -index 62900f3..a3cbfde 100755 ---- a/testsuite/buildok/twentyseven.stp -+++ b/testsuite/buildok/twentyseven.stp -@@ -1,6 +1,6 @@ - #! stap -p4 - --probe kernel.function("do_execve") -+probe kernel.function("do_execve").call - { - print(@defined($__argv) ? $__argv[0] : $argv[0]) - } -diff --git a/testsuite/systemtap.pass1-4/buildok-interactive.exp b/testsuite/systemtap.pass1-4/buildok-interactive.exp -index fc4a019..d15640f 100644 ---- a/testsuite/systemtap.pass1-4/buildok-interactive.exp -+++ b/testsuite/systemtap.pass1-4/buildok-interactive.exp -@@ -188,6 +188,9 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] { - # without utrace. - if {$rc == 1 && ![utrace_p]} { setup_kfail UTRACE *-*-*} } - -+ buildok/fortyfour.stp - -+ buildok/map_probe_cond.stp - -+ buildok/pretty-uprobes.stp - - buildok/pretty-uprobes.stp - - buildok/ucontext-symbols-embedded.stp - - buildok/ucontext-unwind-embedded.stp { -diff --git a/testsuite/systemtap.pass1-4/buildok.exp b/testsuite/systemtap.pass1-4/buildok.exp -index 3926b7f..79f2217 100644 ---- a/testsuite/systemtap.pass1-4/buildok.exp -+++ b/testsuite/systemtap.pass1-4/buildok.exp -@@ -40,6 +40,8 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] { - # without utrace. - if {$rc != 0 && ![utrace_p]} { setup_kfail UTRACE *-*-*} } - -+ buildok/fortyfour.stp - -+ buildok/map_probe_cond.stp - - buildok/pretty-uprobes.stp - - buildok/ucontext-symbols-embedded.stp - - buildok/ucontext-unwind-embedded.stp { diff --git a/sources b/sources index 9a80683..eabc5df 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (systemtap-3.1.tar.gz) = 07b322d5745f570296e287db80f1e370da87eb65073815cf24d532827900453c1cb9ee74b5496b4f3919d176b960caad4479edc2dadf27b5c58898fb7398264d +SHA512 (systemtap-3.2.tar.gz) = 6036ed1b5189fd3fcfdeeaa526a3539ac632d0b687a063b5e3424e8f613bfc2c8d079742b0262b547128e97e30e4beb61898b23761657aee519e61346ac92e94 diff --git a/systemtap.spec b/systemtap.spec index fe2cbfd..3f3d039 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -1,4 +1,4 @@ -%{!?with_sqlite: %global with_sqlite 1} +%{!?with_sqlite: %global with_sqlite 0%{?fedora} >= 17 || 0%{?rhel} >= 7} %{!?with_docs: %global with_docs 1} %{!?with_htmldocs: %global with_htmldocs 0} %{!?with_monitor: %global with_monitor 1} @@ -18,6 +18,7 @@ %else %{!?with_dyninst: %global with_dyninst 0} %endif +%{!?with_bpf: %global with_bpf 0%{?fedora} >= 22 || 0%{?rhel} >= 8} %{!?with_systemd: %global with_systemd 0%{?fedora} >= 19 || 0%{?rhel} >= 7} %{!?with_emacsvim: %global with_emacsvim 0%{?fedora} >= 19 || 0%{?rhel} >= 7} %{!?with_java: %global with_java 0%{?fedora} >= 19 || 0%{?rhel} >= 7} @@ -35,6 +36,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_httpd: %global with_httpd 0} %ifarch ppc64le aarch64 %global with_virthost 0 @@ -71,8 +73,8 @@ %endif Name: systemtap -Version: 3.1 -Release: 5%{?dist} +Version: 3.2 +Release: 1%{?dist} # for version, see also configure.ac @@ -120,7 +122,7 @@ BuildRequires: dyninst-devel >= 8.0 BuildRequires: pkgconfig(libselinux) %endif %if %{with_sqlite} -BuildRequires: sqlite-devel +BuildRequires: sqlite-devel > 3.7 %endif %if %{with_monitor} BuildRequires: pkgconfig(json-c) @@ -186,17 +188,10 @@ BuildRequires: python3-devel BuildRequires: python3-setuptools %endif -Patch10: bz1439914.patch -Patch21: bz1448099.1.patch -Patch22: bz1448099.2.patch -Patch23: bz1448099.3.patch -Patch24: bz1448099.4.patch -Patch25: bz1448099.5.patch -Patch26: bz1448099.6.patch -Patch27: bz1448099.7.patch -Patch28: bz1448099.7.1.patch -Patch29: bz1448099.8.patch - +%if %{with_httpd} +BuildRequires: libmicrohttpd-devel +BuildRequires: libuuid-devel +%endif # Install requirements Requires: systemtap-client = %{version}-%{release} @@ -473,7 +468,6 @@ systemtap-runtime-virthost machine to execute systemtap scripts. %prep %setup -q %{?setup_elfutils} -%patch10 -p1 %if %{with_bundled_elfutils} cd elfutils-%{elfutils_version} @@ -485,17 +479,6 @@ find . \( -name configure -o -name config.h.in \) -print | xargs touch cd .. %endif -%patch21 -p1 -%patch22 -p1 -%patch23 -p1 -%patch24 -p1 -%patch25 -p1 -%patch26 -p1 -%patch27 -p1 -%patch28 -p1 -%patch29 -p1 - - %build %if %{with_bundled_elfutils} @@ -593,10 +576,16 @@ cd .. %global dracut_config %{nil} %endif +%if %{with_httpd} +%global httpd_config --enable-httpd +%else +%global httpd_config --disable-httpd +%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} --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} --disable-silent-rules --with-extra-version="rpm %{version}-%{release}" make %{?_smp_mflags} %if %{with_emacsvim} @@ -1031,6 +1020,9 @@ done %if %{with_dyninst} %{_bindir}/stapdyn %endif +%if %{with_bpf} +%{_bindir}/stapbpf +%endif %dir %{_libexecdir}/systemtap %{_libexecdir}/systemtap/stapio %{_libexecdir}/systemtap/stap-authorize-cert @@ -1047,6 +1039,9 @@ done %if %{with_dyninst} %{_mandir}/man8/stapdyn.8* %endif +%if %{with_bpf} +%{_mandir}/man8/stapbpf.8* +%endif %doc README README.security AUTHORS NEWS %{!?_licensedir:%global license %%doc} %license COPYING @@ -1163,14 +1158,8 @@ done # PRERELEASE %changelog -* Mon May 15 2017 Frank Ch. Eigler - 3.1-5 -- Build with dsmith's bz1448099 patches for support of kernel 4.11 - -* Thu Apr 06 2017 Frank Ch. Eigler - 3.1-3 -- Backport bz1439914 (sys/sdt.h argument encoding) - -* Thu Mar 16 2017 Stan Cox - 3.1-2 -- Rebuild for dyninst 9.3 +* Wed Oct 18 2017 Frank Ch. Eigler - 3.2-1 +- Upstream release. * Fri Feb 17 2017 Frank Ch. Eigler - 3.1-1 - Upstream release. From 64e8afca44d261faebb82f20620d8561b64f59c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= Date: Sun, 10 Dec 2017 20:50:43 +0100 Subject: [PATCH 05/10] Rebuilt for libjson-c.so.3 --- systemtap.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/systemtap.spec b/systemtap.spec index fd53194..f12e70c 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -74,7 +74,7 @@ Name: systemtap Version: 3.2 -Release: 2%{?dist} +Release: 3%{?dist} # for version, see also configure.ac Patch10: rhbz1504009.patch @@ -1161,6 +1161,9 @@ done # PRERELEASE %changelog +* Sun Dec 10 2017 Björn Esser - 3.2-3 +- Rebuilt for libjson-c.so.3 + * Fri Oct 20 2017 Frank Ch. Eigler - 3.2-2 - rhbz1504009 (dtrace -G -o /dev/null) From ac3f11bfc657843f2fceafda1afc1d99b9d38f15 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 7 Feb 2018 17:44:25 +0100 Subject: [PATCH 06/10] Fix very old Requires Signed-off-by: Igor Gnatenko --- systemtap.spec | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/systemtap.spec b/systemtap.spec index f12e70c..230f918 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -74,7 +74,7 @@ Name: systemtap Version: 3.2 -Release: 3%{?dist} +Release: 4%{?dist} # for version, see also configure.ac Patch10: rhbz1504009.patch @@ -212,10 +212,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 @@ -1161,6 +1158,9 @@ done # PRERELEASE %changelog +* Wed Feb 07 2018 Igor Gnatenko - 3.2-4 +- Fix very old Requires + * Sun Dec 10 2017 Björn Esser - 3.2-3 - Rebuilt for libjson-c.so.3 From 9be34952bfc43f541cfc3fedc8cf97a0b64fc01a Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 9 Feb 2018 09:06:23 +0100 Subject: [PATCH 07/10] Escape macros in %changelog Reference: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/Y2ZUKK2B7T2IKXPMODNF6HB2O5T5TS6H/ Signed-off-by: Igor Gnatenko --- systemtap.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/systemtap.spec b/systemtap.spec index 230f918..cf5a5f2 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -74,7 +74,7 @@ Name: systemtap Version: 3.2 -Release: 4%{?dist} +Release: 5%{?dist} # for version, see also configure.ac Patch10: rhbz1504009.patch @@ -1158,6 +1158,9 @@ done # PRERELEASE %changelog +* Fri Feb 09 2018 Igor Gnatenko - 3.2-5 +- Escape macros in %%changelog + * Wed Feb 07 2018 Igor Gnatenko - 3.2-4 - Fix very old Requires @@ -1189,7 +1192,7 @@ done - Upstream release. * Mon Jul 07 2014 Josh Stone -- Flip with_dyninst to an %ifarch whitelist. +- Flip with_dyninst to an %%ifarch whitelist. * Wed Apr 30 2014 Jonathan Lebon - 2.5-1 - Upstream release. From 2c11815ddbf610cdf215811c5841c139de3fa10e Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 14 Feb 2018 00:42:22 +0100 Subject: [PATCH 08/10] 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 --- systemtap.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/systemtap.spec b/systemtap.spec index cf5a5f2..e446894 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -113,7 +113,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) From 75c387b28ce945855d473ea8df6c668d0d44708b Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 14 Feb 2018 09:07:51 +0100 Subject: [PATCH 09/10] 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 --- systemtap.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/systemtap.spec b/systemtap.spec index e446894..7f2317a 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -701,9 +701,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 From f70df36055e93c534ac344c33d386b70ad4679af Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Wed, 14 Feb 2018 11:12:36 -0500 Subject: [PATCH 10/10] Fixes for gcc 8.0.1 --- rhbz1544711.patch | 208 ++++++++++++++++++++++++++++++++++++++++++++++ systemtap.spec | 11 ++- 2 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 rhbz1544711.patch diff --git a/rhbz1544711.patch b/rhbz1544711.patch new file mode 100644 index 0000000..434fc53 --- /dev/null +++ b/rhbz1544711.patch @@ -0,0 +1,208 @@ +commit a8e317b60 (HEAD -> master, origin/master, origin/HEAD) +Author: Stan Cox +Date: Tue Feb 13 22:38:03 2018 -0500 + + Fixes for gcc 8 + + * includes/sys/sdt.h (__SDT_COND_SIGNED): Add CT, cast type argument + + Author: Will Cohen + + * stap-serverd.cxx (generate_mok, handleRequest, handle_connection): + Catch format overflow + + * translate.cxx (translate_pass): Use ref in catch. + +diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h +index 940f74483..c0c5a492c 100644 +--- a/includes/sys/sdt.h ++++ b/includes/sys/sdt.h +@@ -119,8 +119,8 @@ struct __sdt_type + + #define __SDT_ALWAYS_SIGNED(T) \ + template<> struct __sdt_type { static const bool __sdt_signed = true; }; +-#define __SDT_COND_SIGNED(T) \ +-template<> struct __sdt_type { static const bool __sdt_signed = ((T)(-1) < 1); }; ++#define __SDT_COND_SIGNED(T,CT) \ ++template<> struct __sdt_type { static const bool __sdt_signed = ((CT)(-1) < 1); }; + __SDT_ALWAYS_SIGNED(signed char) + __SDT_ALWAYS_SIGNED(short) + __SDT_ALWAYS_SIGNED(int) +@@ -141,14 +141,14 @@ __SDT_ALWAYS_SIGNED(const volatile short) + __SDT_ALWAYS_SIGNED(const volatile int) + __SDT_ALWAYS_SIGNED(const volatile long) + __SDT_ALWAYS_SIGNED(const volatile long long) +-__SDT_COND_SIGNED(char) +-__SDT_COND_SIGNED(wchar_t) +-__SDT_COND_SIGNED(volatile char) +-__SDT_COND_SIGNED(volatile wchar_t) +-__SDT_COND_SIGNED(const char) +-__SDT_COND_SIGNED(const wchar_t) +-__SDT_COND_SIGNED(const volatile char) +-__SDT_COND_SIGNED(const volatile wchar_t) ++__SDT_COND_SIGNED(char, char) ++__SDT_COND_SIGNED(wchar_t, wchar_t) ++__SDT_COND_SIGNED(volatile char, char) ++__SDT_COND_SIGNED(volatile wchar_t, wchar_t) ++__SDT_COND_SIGNED(const char, char) ++__SDT_COND_SIGNED(const wchar_t, wchar_t) ++__SDT_COND_SIGNED(const volatile char, char) ++__SDT_COND_SIGNED(const volatile wchar_t, wchar_t) + #if defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) + /* __SDT_COND_SIGNED(char16_t) */ + /* __SDT_COND_SIGNED(char32_t) */ +diff --git a/stap-serverd.cxx b/stap-serverd.cxx +index b8f70114c..063c3c587 100644 +--- a/stap-serverd.cxx ++++ b/stap-serverd.cxx +@@ -1607,6 +1607,7 @@ generate_mok(string &mok_fingerprint) + char tmpdir[PATH_MAX] = { '\0' }; + string public_cert_path, private_cert_path, destdir; + mode_t old_umask; ++ int retlen; + + mok_fingerprint.clear (); + +@@ -1631,7 +1632,14 @@ generate_mok(string &mok_fingerprint) + } + + // Make a temporary directory to store results in. +- snprintf (tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", mok_path.c_str ()); ++ retlen = snprintf (tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", mok_path.c_str ()); ++ if (retlen < 0 || retlen >= PATH_MAX) ++ { ++ server_error (_F("Could not create %s name", "temporary directory")); ++ tmpdir[0] = '\0'; ++ goto cleanup; ++ } ++ + if (mkdtemp (tmpdir) == NULL) + { + server_error (_F("Could not create temporary directory %s: %s", tmpdir, +@@ -1704,6 +1712,7 @@ handleRequest (const string &requestDirName, const string &responseDirName, stri + unsigned u; + unsigned i; + FILE* f; ++ int retlen; + + // Save the server version. Do this early, so the client knows what version of the server + // it is dealing with, even if the request is not fully completed. +@@ -1782,7 +1791,12 @@ handleRequest (const string &requestDirName, const string &responseDirName, stri + struct stat st; + char *arg; + +- snprintf (stapargfile, PATH_MAX, "%s/argv%d", requestDirName.c_str (), i); ++ retlen = snprintf (stapargfile, PATH_MAX, "%s/argv%d", requestDirName.c_str (), i); ++ if (retlen < 0 || retlen >= PATH_MAX) ++ { ++ server_error (_F("Error creating %s name", "path")); ++ return; ++ } + + rc = stat(stapargfile, & st); + if (rc) break; +@@ -1888,7 +1902,15 @@ handleRequest (const string &requestDirName, const string &responseDirName, stri + { + glob_t globber; + char pattern[PATH_MAX]; +- snprintf (pattern, PATH_MAX, "%s/*.ko", new_staptmpdir.c_str()); ++ int retlen; ++ ++ retlen = snprintf (pattern, PATH_MAX, "%s/*.ko", new_staptmpdir.c_str()); ++ if (retlen < 0 || retlen >= PATH_MAX) ++ { ++ server_error (_F("Error creating %s name", "pattern")); ++ return; ++ } ++ + rc = glob (pattern, GLOB_ERR, NULL, &globber); + if (rc) + server_error (_F("Unable to find a module in %s", new_staptmpdir.c_str())); +@@ -2164,6 +2186,7 @@ handle_connection (void *arg) + copy for each connection.*/ + vector argv; + PRInt32 bytesRead; ++ int retlen; + + /* Detatch to avoid a memory leak */ + if(max_threads > 0) +@@ -2213,7 +2236,13 @@ handle_connection (void *arg) + #endif + + secStatus = SECFailure; +- snprintf(tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", getenv("TMPDIR") ?: "/tmp"); ++ retlen = snprintf(tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", getenv("TMPDIR") ?: "/tmp"); ++ if (retlen < 0 || retlen >= PATH_MAX) ++ { ++ server_error (_F("Error creating %s name", "temporary directory")); ++ tmpdir[0]=0; /* prevent /bin/rm */ ++ goto cleanup; ++ } + rc1 = mkdtemp(tmpdir); + if (! rc1) + { +@@ -2223,9 +2252,20 @@ handle_connection (void *arg) + } + + /* Create a temporary files names and directories. */ +- snprintf (requestFileName, PATH_MAX, "%s/request.zip", tmpdir); ++ retlen = snprintf (requestFileName, PATH_MAX, "%s/request.zip", tmpdir); ++ if (retlen < 0 || retlen >= PATH_MAX) ++ { ++ server_error (_F("Error creating %s name", "request.zip path")); ++ goto cleanup; ++ } ++ ++ retlen = snprintf (requestDirName, PATH_MAX, "%s/request", tmpdir); ++ if (retlen < 0 || retlen >= PATH_MAX) ++ { ++ server_error (_F("Error creating %s name", "request directory path")); ++ goto cleanup; ++ } + +- snprintf (requestDirName, PATH_MAX, "%s/request", tmpdir); + rc = mkdir(requestDirName, 0700); + if (rc) + { +@@ -2233,7 +2273,13 @@ handle_connection (void *arg) + goto cleanup; + } + +- snprintf (responseDirName, PATH_MAX, "%s/response", tmpdir); ++ retlen = snprintf (responseDirName, PATH_MAX, "%s/response", tmpdir); ++ if (retlen < 0 || retlen >= PATH_MAX) ++ { ++ server_error (_F("Error creating %s name", "response directory path")); ++ goto cleanup; ++ } ++ + rc = mkdir(responseDirName, 0700); + if (rc) + { +@@ -2243,7 +2289,12 @@ handle_connection (void *arg) + // Set this early, since it gets used for errors to be returned to the client. + stapstderr = string(responseDirName) + "/stderr"; + +- snprintf (responseFileName, PATH_MAX, "%s/response.zip", tmpdir); ++ retlen = snprintf (responseFileName, PATH_MAX, "%s/response.zip", tmpdir); ++ if (retlen < 0 || retlen >= PATH_MAX) ++ { ++ server_error (_F("Error creating %s name", "response.zip path")); ++ goto cleanup; ++ } + + /* Read data from the socket. + * If the user is requesting/requiring authentication, authenticate +diff --git a/translate.cxx b/translate.cxx +index 1240a80ec..4ade06fdd 100644 +--- a/translate.cxx ++++ b/translate.cxx +@@ -7860,7 +7860,7 @@ translate_pass (systemtap_session& s) + if (versions.size() >= 3 && s.verbose > 1) + clog << _F("ignoring extra parts of compat version: %s", s.compatible.c_str()) << endl; + } +- catch (const runtime_error) ++ catch (const runtime_error&) + { + throw SEMANTIC_ERROR(_F("parse error in compatibility version: %s", s.compatible.c_str())); + } diff --git a/systemtap.spec b/systemtap.spec index cf5a5f2..e61740d 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -72,12 +72,16 @@ %define dracutbindir %{_bindir} %endif +# To avoid testsuite/*/*.stp has shebang which doesn't start with '/' +%undefine __brp_mangle_shebangs + Name: systemtap Version: 3.2 -Release: 5%{?dist} +Release: 6%{?dist} # for version, see also configure.ac Patch10: rhbz1504009.patch +Patch11: rhbz1544711.patch # Packaging abstract: # @@ -479,6 +483,8 @@ cd .. %patch10 -p1 +%patch11 -p1 + %build %if %{with_bundled_elfutils} @@ -1158,6 +1164,9 @@ done # PRERELEASE %changelog +* Tue Feb 13 2018 Stan Cox - 3.2-6 +- rebuilt + * Fri Feb 09 2018 Igor Gnatenko - 3.2-5 - Escape macros in %%changelog