From 98eb595ab7c7785d0e792fa63902e4f5a9c0d954 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Fri, 7 Oct 2016 21:17:57 +0200 Subject: [PATCH] systemtap: add patches for kernel >4.6. --- ...pdating-runtime-linux-access_process.patch | 45 +++++++++++ ...pdating-the-runtime-to-handle-a-stru.patch | 76 +++++++++++++++++ ...pdating-the-runtime-for-the-4.6-kern.patch | 81 +++++++++++++++++++ ...-updating-runtime-linux-access_proce.patch | 27 +++++++ srcpkgs/systemtap/template | 5 +- 5 files changed, 232 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/systemtap/patches/0001-Fix-PR19990-by-updating-runtime-linux-access_process.patch create mode 100644 srcpkgs/systemtap/patches/0001-Fix-PR20132-by-updating-the-runtime-to-handle-a-stru.patch create mode 100644 srcpkgs/systemtap/patches/0001-Fix-PR20158-by-updating-the-runtime-for-the-4.6-kern.patch create mode 100644 srcpkgs/systemtap/patches/0001-Fixed-PR19940-by-updating-runtime-linux-access_proce.patch diff --git a/srcpkgs/systemtap/patches/0001-Fix-PR19990-by-updating-runtime-linux-access_process.patch b/srcpkgs/systemtap/patches/0001-Fix-PR19990-by-updating-runtime-linux-access_process.patch new file mode 100644 index 00000000000..93c5cd6ff01 --- /dev/null +++ b/srcpkgs/systemtap/patches/0001-Fix-PR19990-by-updating-runtime-linux-access_process.patch @@ -0,0 +1,45 @@ +From e7c42c3a9fa0c442ae59a15ccf256224c27ef745 Mon Sep 17 00:00:00 2001 +From: David Smith +Date: Mon, 25 Apr 2016 10:02:36 -0500 +Subject: [PATCH] Fix PR19990 by updating runtime/linux/access_process_vm.h. + +* runtime/linux/access_process_vm.h (__access_process_vm_): Use + get_user_pages_remote() when available. +* buildrun.cxx (compile_pass): Added export test for + 'get_user_pages_remote()'. +--- + buildrun.cxx | 1 + + runtime/linux/access_process_vm.h | 4 ++++ + 2 files changed, 5 insertions(+) + +diff --git a/buildrun.cxx b/buildrun.cxx +index cac46d42ff86..30082ac841bf 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -455,6 +455,7 @@ compile_pass (systemtap_session& s) + "STAPCONF_MODULE_LAYOUT", NULL); + output_autoconf(s, o, "autoconf-mod_kallsyms.c", + "STAPCONF_MOD_KALLSYMS", NULL); ++ output_exportconf(s, o, "get_user_pages_remote", "STAPCONF_GET_USER_PAGES_REMOTE"); + + o << module_cflags << " += -include $(STAPCONF_HEADER)" << endl; + +diff --git a/runtime/linux/access_process_vm.h b/runtime/linux/access_process_vm.h +index a2114c60d9c9..214d4e2546bf 100644 +--- a/runtime/linux/access_process_vm.h ++++ b/runtime/linux/access_process_vm.h +@@ -32,7 +32,11 @@ __access_process_vm_ (struct task_struct *tsk, unsigned long addr, void *buf, + int bytes, ret, offset; + void *maddr; + ++#ifdef STAPCONF_GET_USER_PAGES_REMOTE ++ ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma); ++#else + ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma); ++#endif + if (ret <= 0) + break; + +-- +2.8.1 + diff --git a/srcpkgs/systemtap/patches/0001-Fix-PR20132-by-updating-the-runtime-to-handle-a-stru.patch b/srcpkgs/systemtap/patches/0001-Fix-PR20132-by-updating-the-runtime-to-handle-a-stru.patch new file mode 100644 index 00000000000..660cef3ae6e --- /dev/null +++ b/srcpkgs/systemtap/patches/0001-Fix-PR20132-by-updating-the-runtime-to-handle-a-stru.patch @@ -0,0 +1,76 @@ +From 8f888904d8de9a798e4664caa373ea552366b304 Mon Sep 17 00:00:00 2001 +From: David Smith +Date: Mon, 23 May 2016 13:56:29 -0500 +Subject: [PATCH] Fix PR20132 by updating the runtime to handle a 'struct inode' change. + +* runtime/transport/transport.c (_stp_lock_inode): Use the new inode + lock/unlock routines. + (_stp_unlock_inode): Ditto. +* buildrun.cxx (compile_pass): Add autoconf-inode-rwsem test. +* runtime/linux/autoconf-inode-rwsem.c: New 'autoconf' test. +--- + buildrun.cxx | 1 + + runtime/linux/autoconf-inode-rwsem.c | 5 +++++ + runtime/transport/transport.c | 8 ++++++++ + 3 files changed, 14 insertions(+), 0 deletions(-) + create mode 100644 runtime/linux/autoconf-inode-rwsem.c + +diff --git a/buildrun.cxx b/buildrun.cxx +index 8cf4b36..27e2be6 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -321,6 +321,7 @@ compile_pass (systemtap_session& s) + output_autoconf(s, o, "autoconf-generated-compile.c", "STAPCONF_GENERATED_COMPILE", NULL); + output_autoconf(s, o, "autoconf-hrtimer-getset-expires.c", "STAPCONF_HRTIMER_GETSET_EXPIRES", NULL); + output_autoconf(s, o, "autoconf-inode-private.c", "STAPCONF_INODE_PRIVATE", NULL); ++ output_autoconf(s, o, "autoconf-inode-rwsem.c", "STAPCONF_INODE_RWSEM", NULL); + output_autoconf(s, o, "autoconf-constant-tsc.c", "STAPCONF_CONSTANT_TSC", NULL); + output_autoconf(s, o, "autoconf-ktime-get-real.c", "STAPCONF_KTIME_GET_REAL", NULL); + output_autoconf(s, o, "autoconf-x86-uniregs.c", "STAPCONF_X86_UNIREGS", NULL); +diff --git a/runtime/linux/autoconf-inode-rwsem.c b/runtime/linux/autoconf-inode-rwsem.c +new file mode 100644 +index 0000000..8ca4a4a +--- /dev/null ++++ b/runtime/linux/autoconf-inode-rwsem.c +@@ -0,0 +1,5 @@ ++#include ++ ++// check for 4.6 inode patch which changed i_mutex to i_rwsem ++ ++struct inode i __attribute__ ((unused)) = {.i_rwsem=__RWSEM_INITIALIZER(i.i_rwsem)}; +diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c +index bbc61d2..d19eb1e 100644 +--- a/runtime/transport/transport.c ++++ b/runtime/transport/transport.c +@@ -490,20 +490,28 @@ err0: + + static inline void _stp_lock_inode(struct inode *inode) + { ++#ifdef STAPCONF_INODE_RWSEM ++ inode_lock(inode); ++#else + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) + mutex_lock(&inode->i_mutex); + #else + down(&inode->i_sem); + #endif ++#endif + } + + static inline void _stp_unlock_inode(struct inode *inode) + { ++#ifdef STAPCONF_INODE_RWSEM ++ inode_unlock(inode); ++#else + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) + mutex_unlock(&inode->i_mutex); + #else + up(&inode->i_sem); + #endif ++#endif + } + + static struct dentry *_stp_lockfile = NULL; +-- +1.7.1 + diff --git a/srcpkgs/systemtap/patches/0001-Fix-PR20158-by-updating-the-runtime-for-the-4.6-kern.patch b/srcpkgs/systemtap/patches/0001-Fix-PR20158-by-updating-the-runtime-for-the-4.6-kern.patch new file mode 100644 index 00000000000..7c02d27a825 --- /dev/null +++ b/srcpkgs/systemtap/patches/0001-Fix-PR20158-by-updating-the-runtime-for-the-4.6-kern.patch @@ -0,0 +1,81 @@ +From 15de83a3b4b298ea8fa5f86083017d062393c0db Mon Sep 17 00:00:00 2001 +From: David Smith +Date: Fri, 27 May 2016 11:19:03 -0500 +Subject: [PATCH] Fix PR20158 by updating the runtime for the 4.6 kernel. + +* buildrun.cxx (compile_pass): Added autoconf-stacktrace_ops-int-address.c + compile test. +* stack.c: (print_stack_address): If STAPCONF_STACKTRACE_OPS_INT_ADDRESS + is defined, the function returns a int instead of being a void + function. +* runtime/linux/autoconf-stacktrace_ops-int-address.c: New autoconf-style + test. +--- + buildrun.cxx | 2 ++ + runtime/linux/autoconf-stacktrace_ops-int-address.c | 14 ++++++++++++++ + runtime/stack.c | 7 +++++++ + 3 files changed, 23 insertions(+) + create mode 100644 runtime/linux/autoconf-stacktrace_ops-int-address.c + +diff --git a/buildrun.cxx b/buildrun.cxx +index 27e2be6a2dc3..7c68ba03e025 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -371,6 +371,8 @@ compile_pass (systemtap_session& s) + output_autoconf(s, o, "autoconf-walk-stack.c", "STAPCONF_WALK_STACK", NULL); + output_autoconf(s, o, "autoconf-stacktrace_ops-warning.c", + "STAPCONF_STACKTRACE_OPS_WARNING", NULL); ++ output_autoconf(s, o, "autoconf-stacktrace_ops-int-address.c", ++ "STAPCONF_STACKTRACE_OPS_INT_ADDRESS", NULL); + output_autoconf(s, o, "autoconf-mm-context-vdso.c", "STAPCONF_MM_CONTEXT_VDSO", NULL); + output_autoconf(s, o, "autoconf-mm-context-vdso-base.c", "STAPCONF_MM_CONTEXT_VDSO_BASE", NULL); + output_autoconf(s, o, "autoconf-blk-types.c", "STAPCONF_BLK_TYPES", NULL); +diff --git a/runtime/linux/autoconf-stacktrace_ops-int-address.c b/runtime/linux/autoconf-stacktrace_ops-int-address.c +new file mode 100644 +index 000000000000..8ca277a6e1c3 +--- /dev/null ++++ b/runtime/linux/autoconf-stacktrace_ops-int-address.c +@@ -0,0 +1,14 @@ ++#include ++#include ++ ++// check for 4.6 patch which changed the function signature of ++// stacktrace_ops 'address' member. ++ ++int print_stack_address(void *data __attribute__ ((unused)), ++ unsigned long addr __attribute__ ((unused)), ++ int reliable __attribute__ ((unused))) ++{ ++ return 0; ++} ++ ++struct stacktrace_ops ops __attribute__ ((unused)) = {.address=print_stack_address}; +diff --git a/runtime/stack.c b/runtime/stack.c +index a7d03db722d5..a99bad062382 100644 +--- a/runtime/stack.c ++++ b/runtime/stack.c +@@ -111,7 +111,11 @@ static int print_stack_stack(void *data, char *name) + return -1; + } + ++#ifdef STAPCONF_STACKTRACE_OPS_INT_ADDRESS ++static int print_stack_address(void *data, unsigned long addr, int reliable) ++#else + static void print_stack_address(void *data, unsigned long addr, int reliable) ++#endif + { + struct print_stack_data *sdata = data; + if (sdata->skip > 0) +@@ -122,6 +126,9 @@ static void print_stack_address(void *data, unsigned long addr, int reliable) + NULL); + sdata->levels--; + } ++#ifdef STAPCONF_STACKTRACE_OPS_INT_ADDRESS ++ return 0; ++#endif + } + + static const struct stacktrace_ops print_stack_ops = { +-- +2.8.1 + diff --git a/srcpkgs/systemtap/patches/0001-Fixed-PR19940-by-updating-runtime-linux-access_proce.patch b/srcpkgs/systemtap/patches/0001-Fixed-PR19940-by-updating-runtime-linux-access_proce.patch new file mode 100644 index 00000000000..fe7b256f8c9 --- /dev/null +++ b/srcpkgs/systemtap/patches/0001-Fixed-PR19940-by-updating-runtime-linux-access_proce.patch @@ -0,0 +1,27 @@ +From 8acda2cea4688b8fca910ea8780fc29594ba6085 Mon Sep 17 00:00:00 2001 +From: David Smith +Date: Mon, 11 Apr 2016 14:07:25 -0500 +Subject: [PATCH] Fixed PR19940 by updating runtime/linux/access_process_vm.h. + +* runtime/linux/access_process_vm.h: Changed page_cache_release() to + put_page(). +--- + runtime/linux/access_process_vm.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/runtime/linux/access_process_vm.h b/runtime/linux/access_process_vm.h +index fa11baf0276f..a2114c60d9c9 100644 +--- a/runtime/linux/access_process_vm.h ++++ b/runtime/linux/access_process_vm.h +@@ -52,7 +52,7 @@ __access_process_vm_ (struct task_struct *tsk, unsigned long addr, void *buf, + reader (vma, page, addr, buf, maddr + offset, bytes); + } + kunmap (page); +- page_cache_release (page); ++ put_page (page); + len -= bytes; + buf += bytes; + addr += bytes; +-- +2.8.1 + diff --git a/srcpkgs/systemtap/template b/srcpkgs/systemtap/template index 1ac675a9a3b..d51d6f9bac4 100644 --- a/srcpkgs/systemtap/template +++ b/srcpkgs/systemtap/template @@ -1,8 +1,9 @@ # Template file for 'systemtap' pkgname=systemtap version=3.0 -revision=1 +revision=2 build_style=gnu-configure +patch_args="-Np1" makedepends="elfutils-devel" short_desc="Infrastructure to simplify the gathering of information" maintainer="Juan RP " @@ -10,4 +11,4 @@ license="GPL-3" homepage="https://sourceware.org/systemtap/" distfiles="https://sourceware.org/systemtap/ftp/releases/systemtap-${version}.tar.gz" checksum=c1c9dc2f63a1d619f41c4af1b757743c5ffaeb802b4b1b79db41567599f72294 -only_for_archs="i686 x86_64 armv6l armv7l" +only_for_archs="i686 x86_64 armv6l armv7l aarch64"