diff -Nru systemtap-1.7/debian/changelog systemtap-1.7/debian/changelog --- systemtap-1.7/debian/changelog 2012-03-14 07:45:25.000000000 -0500 +++ systemtap-1.7/debian/changelog 2012-09-21 15:42:14.000000000 -0500 @@ -1,3 +1,13 @@ +systemtap (1.7-1ubuntu1) quantal; urgency=low + + * Add fix-stap-compile.diff and uprobes-name-change.diff to address + usability issues with systemtap and the newer kernel. This fixes + issues when trying to compile with stap and adjusts for name changes + in the kernel. These are both pulled from upstream commits. + Fixes (LP: #1054274). + + -- Chris J Arges Fri, 21 Sep 2012 15:08:11 -0500 + systemtap (1.7-1) unstable; urgency=low * Explicitly list supported architectures of systemtap-sdt-dev. diff -Nru systemtap-1.7/debian/control systemtap-1.7/debian/control --- systemtap-1.7/debian/control 2012-03-14 07:20:56.000000000 -0500 +++ systemtap-1.7/debian/control 2012-09-21 15:42:16.000000000 -0500 @@ -1,7 +1,8 @@ Source: systemtap Section: devel Priority: optional -Maintainer: Ritesh Raj Sarraf +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Ritesh Raj Sarraf Uploaders: Lucas Nussbaum , Timo Juhani Lindfors Build-Depends: debhelper (>= 7.0.50~), libelf-dev (>= 0.141), libdw-dev (>= 0.141), libsqlite3-dev, texlive-latex-base, texlive-latex-recommended, diff -Nru systemtap-1.7/debian/patches/fix-stap-compile.diff systemtap-1.7/debian/patches/fix-stap-compile.diff --- systemtap-1.7/debian/patches/fix-stap-compile.diff 1969-12-31 18:00:00.000000000 -0600 +++ systemtap-1.7/debian/patches/fix-stap-compile.diff 2012-09-21 15:40:55.000000000 -0500 @@ -0,0 +1,256 @@ +From e14ac0e274c6de3fee1f74cd190ec6248f28e559 Mon Sep 17 00:00:00 2001 +From: David Smith +Date: Wed, 11 Apr 2012 15:01:02 -0500 +Subject: [PATCH] Fix compile problem by changing 'stp_for_each_cpu' to + 'for_each_possible_cpu'. + +* runtime/runtime.h: Removed stp_for_each_cpu() macro definition, since no + longer needed (and 'cpu_possible_map' has been removed from the upstream + kernel). +* runtime/map-stat.c: Replaced 'stp_for_each_cpu()' with + 'for_each_possible_cpu()'. +* runtime/map.c: Ditto. +* runtime/perf.c: Ditto. +* runtime/pmap-gen.c: Ditto. +* runtime/stat.c: Ditto. +* runtime/transport/procfs.c: Ditto. +* translate.cxx: Ditto. + +Origin: upstream, http://sources.redhat.com/git/?p=systemtap.git;a=commit;h=e14ac0e274c6de3fee1f74cd190ec6248f28e559 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/systemtap/+bug/1054274 + +diff --git a/runtime/map-stat.c b/runtime/map-stat.c +index c557d18..262c20b 100644 +--- a/runtime/map-stat.c ++++ b/runtime/map-stat.c +@@ -68,7 +68,7 @@ static PMAP _stp_pmap_new_hstat_linear (unsigned max_entries, int ksize, int sta + if (pmap) { + int i; + MAP m; +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + m = (MAP)per_cpu_ptr (pmap->map, i); + m->hist.type = HIST_LINEAR; + m->hist.start = start; +@@ -95,7 +95,7 @@ static PMAP _stp_pmap_new_hstat_log (unsigned max_entries, int key_size) + if (pmap) { + int i; + MAP m; +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + m = (MAP)per_cpu_ptr (pmap->map, i); + m->hist.type = HIST_LOG; + m->hist.buckets = HIST_LOG_BUCKETS; +diff --git a/runtime/map.c b/runtime/map.c +index f433de8..3618ce2 100644 +--- a/runtime/map.c ++++ b/runtime/map.c +@@ -256,7 +256,7 @@ static PMAP _stp_pmap_new(unsigned max_entries, int type, int key_size, int data + + /* initialize the memory lists first so if allocations fail */ + /* at some point, it is easy to clean up. */ +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + m = per_cpu_ptr (map, i); + INIT_LIST_HEAD(&m->pool); + INIT_LIST_HEAD(&m->head); +@@ -264,7 +264,7 @@ static PMAP _stp_pmap_new(unsigned max_entries, int type, int key_size, int data + INIT_LIST_HEAD(&pmap->agg.pool); + INIT_LIST_HEAD(&pmap->agg.head); + +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + m = per_cpu_ptr (map, i); + if (_stp_map_init(m, max_entries, type, key_size, data_size, i)) { + goto err1; +@@ -277,7 +277,7 @@ static PMAP _stp_pmap_new(unsigned max_entries, int type, int key_size, int data + return pmap; + + err1: +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + m = per_cpu_ptr (map, i); + __stp_map_del(m); + } +@@ -364,7 +364,7 @@ static void _stp_pmap_clear(PMAP pmap) + if (pmap == NULL) + return; + +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + MAP m = per_cpu_ptr (pmap->map, i); + #if NEED_MAP_LOCKS + spin_lock(&m->lock); +@@ -418,7 +418,7 @@ static void _stp_pmap_del(PMAP pmap) + if (pmap == NULL) + return; + +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + MAP m = per_cpu_ptr (pmap->map, i); + __stp_map_del(m); + } +@@ -748,7 +748,7 @@ static MAP _stp_pmap_agg (PMAP pmap) + /* every time we aggregate. which would be best? */ + _stp_map_clear (agg); + +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + m = per_cpu_ptr (pmap->map, i); + #if NEED_MAP_LOCKS + spin_lock(&m->lock); +@@ -924,7 +924,7 @@ static int _stp_pmap_size (PMAP pmap) + { + int i, num = 0; + +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + MAP m = per_cpu_ptr (pmap->map, i); + num += m->num; + } +diff --git a/runtime/perf.c b/runtime/perf.c +index 6cc8880..77aa75b 100644 +--- a/runtime/perf.c ++++ b/runtime/perf.c +@@ -37,7 +37,7 @@ static long _stp_perf_init (struct stap_perf_probe *stp) + } + + /* initialize event on each processor */ +- stp_for_each_cpu(cpu) { ++ for_each_possible_cpu(cpu) { + struct perf_event **event = per_cpu_ptr (stp->events, cpu); + if (cpu_is_offline(cpu)) { + *event = NULL; +@@ -76,7 +76,7 @@ static void _stp_perf_del (struct stap_perf_probe *stp) + if (stp && stp->events) { + int cpu; + /* shut down performance event sampling */ +- stp_for_each_cpu(cpu) { ++ for_each_possible_cpu(cpu) { + struct perf_event **event = per_cpu_ptr (stp->events, cpu); + if (*event) { + perf_event_release_kernel(*event); +diff --git a/runtime/pmap-gen.c b/runtime/pmap-gen.c +index a5064d0..8261c89 100644 +--- a/runtime/pmap-gen.c ++++ b/runtime/pmap-gen.c +@@ -661,7 +661,7 @@ static PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries) + if (pmap) { + int i; + MAP m; +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + m = (MAP)per_cpu_ptr (pmap->map, i); + m->get_key = KEYSYM(pmap_get_key); + m->copy = KEYSYM(pmap_copy_keys); +@@ -714,7 +714,7 @@ static PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries, int htype, ...) + if (pmap) { + int i; + MAP m; +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + m = per_cpu_ptr (pmap->map, i); + m->get_key = KEYSYM(pmap_get_key); + m->copy = KEYSYM(pmap_copy_keys); +@@ -940,7 +940,7 @@ static VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key)) + } + + /* now total each cpu */ +- stp_for_each_cpu(cpu) { ++ for_each_possible_cpu(cpu) { + map = per_cpu_ptr (pmap->map, cpu); + head = &map->hashes[hv]; + +diff --git a/runtime/runtime.h b/runtime/runtime.h +index 53ab10c..2df27f3 100644 +--- a/runtime/runtime.h ++++ b/runtime/runtime.h +@@ -57,10 +57,6 @@ + #define STP_TRANSPORT_VERSION 1 + #endif + +-#ifndef stp_for_each_cpu +-#define stp_for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) +-#endif +- + #ifndef clamp + #define clamp(val, low, high) min(max(low, val), high) + #endif +diff --git a/runtime/stat.c b/runtime/stat.c +index 02b2b5e..31b157d 100644 +--- a/runtime/stat.c ++++ b/runtime/stat.c +@@ -110,7 +110,7 @@ static Stat _stp_stat_init (int type, ...) + #if NEED_STAT_LOCKS == 1 + { + int i; +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + stat *sdp = per_cpu_ptr (sd, i); + spin_lock_init(sdp->lock); + } +@@ -211,7 +211,7 @@ static stat *_stp_stat_get (Stat st, int clear) + STAT_LOCK(agg); + _stp_stat_clear_data (st, agg); + +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + stat *sd = per_cpu_ptr (st->sd, i); + STAT_LOCK(sd); + if (sd->count) { +@@ -246,7 +246,7 @@ static stat *_stp_stat_get (Stat st, int clear) + static void _stp_stat_clear (Stat st) + { + int i; +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + stat *sd = per_cpu_ptr (st->sd, i); + STAT_LOCK(sd); + _stp_stat_clear_data (st, sd); +diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c +index 4910173..ad7900c 100644 +--- a/runtime/transport/procfs.c ++++ b/runtime/transport/procfs.c +@@ -109,7 +109,7 @@ static int _stp_register_ctl_channel_fs(void) + + #ifdef STP_BULKMODE + /* now for each cpu "n", create /proc/systemtap/module_name/n */ +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + snprintf(buf, sizeof(buf), "%d", i); + de = create_proc_entry(buf, 0600, _stp_proc_root); + if (de == NULL) +@@ -141,7 +141,7 @@ err1: + #ifdef STP_BULKMODE + for (de = _stp_proc_root->subdir; de; de = de->next) + _stp_kfree(de->data); +- stp_for_each_cpu(j) { ++ for_each_possible_cpu(j) { + if (j == i) + break; + snprintf(buf, sizeof(buf), "%d", j); +@@ -167,7 +167,7 @@ static void _stp_unregister_ctl_channel_fs(void) + for (de = _stp_proc_root->subdir; de; de = de->next) + _stp_kfree(de->data); + +- stp_for_each_cpu(i) { ++ for_each_possible_cpu(i) { + snprintf(buf, sizeof(buf), "%d", i); + remove_proc_entry(buf, _stp_proc_root); + } +diff --git a/translate.cxx b/translate.cxx +index fc4fb6e..ecc9931 100644 +--- a/translate.cxx ++++ b/translate.cxx +@@ -732,7 +732,7 @@ struct mapvar + if(wrap == true) + { + if(mtype == "pmap") +- suffix = suffix + " else { stp_for_each_cpu(cpu) { MAP mp = per_cpu_ptr(" + value() + "->map, cpu); mp->wrap = 1; }} "; ++ suffix = suffix + " else { for_each_possible_cpu(cpu) { MAP mp = per_cpu_ptr(" + value() + "->map, cpu); mp->wrap = 1; }} "; + else + suffix = suffix + " else " + value() + "->wrap = 1;"; + } +-- +1.7.10.4 + diff -Nru systemtap-1.7/debian/patches/series systemtap-1.7/debian/patches/series --- systemtap-1.7/debian/patches/series 2012-03-14 07:17:32.000000000 -0500 +++ systemtap-1.7/debian/patches/series 2012-09-21 15:41:33.000000000 -0500 @@ -4,3 +4,5 @@ spelling-fixes2.diff manpage-paths1.diff fix.CVE-2012-0875.diff +uprobes-name-change.diff +fix-stap-compile.diff diff -Nru systemtap-1.7/debian/patches/uprobes-name-change.diff systemtap-1.7/debian/patches/uprobes-name-change.diff --- systemtap-1.7/debian/patches/uprobes-name-change.diff 1969-12-31 18:00:00.000000000 -0600 +++ systemtap-1.7/debian/patches/uprobes-name-change.diff 2012-09-21 15:46:11.000000000 -0500 @@ -0,0 +1,165 @@ +From 1312868434fee61eb14d6e3e4aff12a5f1f2647f Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Mon, 12 Mar 2012 14:42:28 -0700 +Subject: [PATCH] Adapt to the inode-uprobes name change in tip + +We now have the functions register_uprobe -> uprobe_register and +unregister_uprobe -> uprobe_unregister. The client API has otherwise +not changed. + +I've made our code reflect the new names as much as possible, treating +the old names as the exceptional case, in case we ever want to remove +that compatibility. For now, it should work in all cases, although I +don't have a full complement of old/new & exported/!exported kernels to +test with. + +Origin: upstream, http://sources.redhat.com/git/?p=systemtap.git;a=commit;h=1312868434fee61eb14d6e3e4aff12a5f1f2647f +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/systemtap/+bug/1054274 + +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -171,6 +171,18 @@ void output_dual_exportconf(systemtap_se + o << ">> $@" << endl; + } + ++void output_either_exportconf(systemtap_session& s, ofstream& o, ++ const char *symbol1, const char *symbol2, ++ const char *deftrue) ++{ ++ o << "\t"; ++ if (s.verbose < 4) ++ o << "@"; ++ if (s.kernel_exports.find(symbol1) != s.kernel_exports.end() ++ || s.kernel_exports.find(symbol2) != s.kernel_exports.end()) ++ o << "echo \"#define " << deftrue << " 1\""; ++ o << ">> $@" << endl; ++} + + int + compile_pass (systemtap_session& s) +@@ -300,8 +312,12 @@ compile_pass (systemtap_session& s) + output_exportconf(s, o, "local_clock", "STAPCONF_LOCAL_CLOCK"); + + // used by runtime/uprobe-inode.c +- output_exportconf(s, o, "register_uprobe", "STAPCONF_REGISTER_UPROBE_EXPORTED"); +- output_exportconf(s, o, "unregister_uprobe", "STAPCONF_UNREGISTER_UPROBE_EXPORTED"); ++ output_either_exportconf(s, o, "uprobe_register", "register_uprobe", ++ "STAPCONF_UPROBE_REGISTER_EXPORTED"); ++ output_either_exportconf(s, o, "uprobe_unregister", "unregister_uprobe", ++ "STAPCONF_UPROBE_UNREGISTER_EXPORTED"); ++ output_autoconf(s, o, "autoconf-old-inode-uprobes.c", "STAPCONF_OLD_INODE_UPROBES", NULL); ++ + // used by runtime/loc2c-runtime.h + output_exportconf(s, o, "task_user_regset_view", "STAPCONF_TASK_USER_REGSET_VIEW_EXPORTED"); + +@@ -582,7 +598,7 @@ make_run_command (systemtap_session& s, + staprun_cmd.push_back(lex_cast(s.buffer_size)); + } + +- if (s.need_uprobes) ++ if (s.need_uprobes && !kernel_built_uprobes(s)) + { + string opt_u = "-u"; + if (!s.uprobes_path.empty() && +--- /dev/null ++++ b/runtime/autoconf-old-inode-uprobes.c +@@ -0,0 +1,12 @@ ++if defined(CONFIG_ARCH_SUPPORTS_UPROBES) && defined(CONFIG_UPROBES) ++#include ++/* Check whether we have the old inode-uprobes api. ++ * (It was later changed to uprobe_register and uprobe_unregister.) ++ */ ++void *reg = register_uprobe; ++void *ureg = unregister_uprobe; ++ ++#else ++#error "not an inode-uprobes kernel" ++#endif ++ +--- a/runtime/runtime.h ++++ b/runtime/runtime.h +@@ -242,14 +242,14 @@ void __ia64_save_stack_nonlocal (void) { + #if !defined(STAPCONF_TASK_USER_REGSET_VIEW_EXPORTED) + void *kallsyms_task_user_regset_view; + #endif +-#if !defined(STAPCONF_REGISTER_UPROBE_EXPORTED) +-void *kallsyms_register_uprobe; ++ ++#if !defined(STAPCONF_UPROBE_REGISTER_EXPORTED) ++void *kallsyms_uprobe_register; + #endif +-#if !defined(STAPCONF_UNREGISTER_UPROBE_EXPORTED) +-void *kallsyms_unregister_uprobe; ++#if !defined(STAPCONF_UPROBE_UNREGISTER_EXPORTED) ++void *kallsyms_uprobe_unregister; + #endif + +- + MODULE_LICENSE("GPL"); + + #endif /* _RUNTIME_H_ */ +--- a/runtime/transport/transport.c ++++ b/runtime/transport/transport.c +@@ -328,17 +328,23 @@ static int _stp_transport_init(void) + } + #endif + #if defined(CONFIG_UPROBES) // i.e., kernel-embedded uprobes +-#if !defined(STAPCONF_REGISTER_UPROBE_EXPORTED) +- kallsyms_register_uprobe = (void*) kallsyms_lookup_name ("register_uprobe"); +- if (kallsyms_register_uprobe == NULL) { +- printk(KERN_ERR "%s can't resolve register_uprobe!", THIS_MODULE->name); ++#if !defined(STAPCONF_UPROBE_REGISTER_EXPORTED) ++ kallsyms_uprobe_register = (void*) kallsyms_lookup_name ("uprobe_register"); ++ if (kallsyms_uprobe_register == NULL) { ++ kallsyms_uprobe_register = (void*) kallsyms_lookup_name ("register_uprobe"); ++ } ++ if (kallsyms_uprobe_register == NULL) { ++ printk(KERN_ERR "%s can't resolve uprobe_register!", THIS_MODULE->name); + goto err0; + } + #endif +-#if !defined(STAPCONF_UNREGISTER_UPROBE_EXPORTED) +- kallsyms_unregister_uprobe = (void*) kallsyms_lookup_name ("unregister_uprobe"); +- if (kallsyms_unregister_uprobe == NULL) { +- printk(KERN_ERR "%s can't resolve unregister_uprobe!", THIS_MODULE->name); ++#if !defined(STAPCONF_UPROBE_UNREGISTER_EXPORTED) ++ kallsyms_uprobe_unregister = (void*) kallsyms_lookup_name ("uprobe_unregister"); ++ if (kallsyms_uprobe_unregister == NULL) { ++ kallsyms_uprobe_unregister = (void*) kallsyms_lookup_name ("unregister_uprobe"); ++ } ++ if (kallsyms_uprobe_unregister == NULL) { ++ printk(KERN_ERR "%s can't resolve uprobe_unregister!", THIS_MODULE->name); + goto err0; + } + #endif +--- a/runtime/uprobes-inode.c ++++ b/runtime/uprobes-inode.c +@@ -19,18 +19,21 @@ + #if !defined(CONFIG_UPROBES) + #error "not to be built without CONFIG_UPROBES" + #endif +-#if !defined(STAPCONF_REGISTER_UPROBE_EXPORTED) +-typedef int (*register_uprobe_fn)(struct inode *inode, loff_t offset, ++#if !defined(STAPCONF_UPROBE_REGISTER_EXPORTED) ++typedef int (*uprobe_register_fn)(struct inode *inode, loff_t offset, + struct uprobe_consumer *consumer); +-#define register_uprobe (* (register_uprobe_fn)kallsyms_register_uprobe) ++#define uprobe_register (* (uprobe_register_fn)kallsyms_uprobe_register) ++#elif defined(STAPCONF_OLD_INODE_UPROBES) ++#define uprobe_register register_uprobe + #endif +-#if !defined(STAPCONF_UNREGISTER_UPROBE_EXPORTED) +-typedef void (*unregister_uprobe_fn)(struct inode *inode, loff_t offset, ++#if !defined(STAPCONF_UPROBE_UNREGISTER_EXPORTED) ++typedef void (*uprobe_unregister_fn)(struct inode *inode, loff_t offset, + struct uprobe_consumer *consumer); +-#define unregister_uprobe (* (unregister_uprobe_fn)kallsyms_unregister_uprobe) ++#define uprobe_unregister (* (uprobe_unregister_fn)kallsyms_uprobe_unregister) ++#elif defined(STAPCONF_OLD_INODE_UPROBES) ++#define uprobe_unregister unregister_uprobe + #endif + +- + struct stp_inode_uprobe_target { + const char * const filename; + struct inode *inode;