summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/ChangeLog20
-rw-r--r--runtime/autoconf-procfs-owner.c8
-rw-r--r--runtime/autoconf-vm-area.c9
-rw-r--r--runtime/procfs.c6
-rw-r--r--runtime/task_finder.c24
-rw-r--r--runtime/transport/ChangeLog7
-rw-r--r--runtime/transport/transport.c9
7 files changed, 82 insertions, 1 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index 1c8f33b4..df765169 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,3 +1,23 @@
+2009-02-10 David Smith <dsmith@redhat.com>
+
+ * task_finder.c (stap_utrace_detach_ops): Fixed typo.
+ (__stp_utrace_attach): Ditto.
+
+ * task_finder.c (stap_utrace_detach): Ignores kernel threads by
+ checking task's flags for PF_KTHREAD.
+ (stap_utrace_detach_ops): Ditto.
+ (__stp_utrace_attach): Ditto.
+
+2009-02-06 Frank Ch. Eigler <fche@elastic.org>
+
+ * autoconf-procfs-owner.c: New test.
+ * procfs.c (_stp_mkdir_proc_module, _stp_create_procfs): Use it.
+
+2009-02-05 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 9740/9816?
+ * autoconf-vm-area.c: New test.
+
2009-02-02 Mark Wielaard <mjw@redhat.com>
* sdt.h: Add STAP_PROBE7, 8 and 9 variants.
diff --git a/runtime/autoconf-procfs-owner.c b/runtime/autoconf-procfs-owner.c
new file mode 100644
index 00000000..d64bf5e8
--- /dev/null
+++ b/runtime/autoconf-procfs-owner.c
@@ -0,0 +1,8 @@
+#include <linux/proc_fs.h>
+
+/* kernel commit 4d38a69c6 */
+
+void bar (void) {
+ struct proc_dir_entry foo;
+ foo.owner = (void*) 0;
+}
diff --git a/runtime/autoconf-vm-area.c b/runtime/autoconf-vm-area.c
new file mode 100644
index 00000000..920d103d
--- /dev/null
+++ b/runtime/autoconf-vm-area.c
@@ -0,0 +1,9 @@
+#include <linux/vmalloc.h>
+#include <asm/page.h>
+
+void foo (void)
+{
+ void *dummy;
+ dummy = alloc_vm_area (PAGE_SIZE);
+ free_vm_area (dummy);
+}
diff --git a/runtime/procfs.c b/runtime/procfs.c
index 98d0af98..4011ebfc 100644
--- a/runtime/procfs.c
+++ b/runtime/procfs.c
@@ -1,7 +1,7 @@
/* -*- linux-c -*-
*
* /proc command channels
- * Copyright (C) 2007 Red Hat Inc.
+ * Copyright (C) 2007-2009 Red Hat Inc.
*
* This file is part of systemtap, and is free software. You can
* redistribute it and/or modify it under the terms of the GNU General
@@ -105,8 +105,10 @@ static int _stp_mkdir_proc_module(void)
}
_stp_proc_root = proc_mkdir(THIS_MODULE->name, _stp_proc_stap);
+#ifdef AUTOCONF_PROCFS_OWNER
if (_stp_proc_root != NULL)
_stp_proc_root->owner = THIS_MODULE;
+#endif
_stp_unlock_debugfs();
}
@@ -161,7 +163,9 @@ static int _stp_create_procfs(const char *path, int num)
goto err;
}
_stp_pde[_stp_num_pde++] = last_dir;
+#ifdef AUTOCONF_PROCFS_OWNER
last_dir->owner = THIS_MODULE;
+#endif
last_dir->uid = _stp_uid;
last_dir->gid = _stp_gid;
} else {
diff --git a/runtime/task_finder.c b/runtime/task_finder.c
index d9a4cedb..e058c191 100644
--- a/runtime/task_finder.c
+++ b/runtime/task_finder.c
@@ -220,6 +220,14 @@ stap_utrace_detach(struct task_struct *tsk,
if (tsk == NULL || tsk->pid <= 1)
return 0;
+#ifdef PF_KTHREAD
+ // Ignore kernel threads. On systems without PF_KTHREAD,
+ // we're ok, since kernel threads won't be matched by the
+ // utrace_attach_task() call below.
+ if (tsk->flags & PF_KTHREAD)
+ return 0;
+#endif
+
// Notice we're not calling get_task_mm() here. Normally we
// avoid tasks with no mm, because those are kernel threads.
// So, why is this function different? When a thread is in
@@ -292,6 +300,14 @@ stap_utrace_detach_ops(struct utrace_engine_ops *ops)
rcu_read_lock();
do_each_thread(grp, tsk) {
+#ifdef PF_KTHREAD
+ // Ignore kernel threads. On systems without
+ // PF_KTHREAD, we're ok, since kernel threads won't be
+ // matched by the stap_utrace_detach() call.
+ if (tsk->flags & PF_KTHREAD)
+ continue;
+#endif
+
rc = stap_utrace_detach(tsk, ops);
if (rc != 0)
goto udo_err;
@@ -397,18 +413,26 @@ __stp_utrace_attach(struct task_struct *tsk,
enum utrace_resume_action action)
{
struct utrace_attached_engine *engine;
+#ifndef PF_KTHREAD
struct mm_struct *mm;
+#endif
int rc = 0;
// Ignore init
if (tsk == NULL || tsk->pid <= 1)
return EPERM;
+#ifdef PF_KTHREAD
+ // Ignore kernel threads
+ if (tsk->flags & PF_KTHREAD)
+ return EPERM;
+#else
// Ignore threads with no mm (which are kernel threads).
mm = get_task_mm(tsk);
if (! mm)
return EPERM;
mmput(mm);
+#endif
engine = utrace_attach_task(tsk, UTRACE_ATTACH_CREATE, ops, data);
if (IS_ERR(engine)) {
diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog
index e8e2a047..02f9f119 100644
--- a/runtime/transport/ChangeLog
+++ b/runtime/transport/ChangeLog
@@ -1,3 +1,10 @@
+2009-02-05 Frank Ch. Eigler <fche@elastic.org>
+
+ PR9740/9816?
+ * transport.c (_stp_handle_start): Run alloc/free_vm_area() dummy
+ calls as workaround for kernel valloc/vfree bug. Suggested by
+ Masami Hiramat <mhiramat@redhat.com>.
+
2009-01-06 Frank Ch. Eigler <fche@elastic.org>
PR9699.
diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c
index a572ef9c..97fbf860 100644
--- a/runtime/transport/transport.c
+++ b/runtime/transport/transport.c
@@ -64,6 +64,15 @@ static struct workqueue_struct *_stp_wq;
static void _stp_handle_start(struct _stp_msg_start *st)
{
dbug_trans(1, "stp_handle_start\n");
+
+#ifdef STAPCONF_VM_AREA
+ { /* PR9740: workaround for kernel valloc bug. */
+ void *dummy;
+ dummy = alloc_vm_area (PAGE_SIZE);
+ free_vm_area (dummy);
+ }
+#endif
+
_stp_target = st->target;
st->res = probe_start();
if (st->res >= 0)