summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2008-07-12 19:10:22 -0400
committerFrank Ch. Eigler <fche@elastic.org>2008-07-12 19:10:22 -0400
commitf1743f00e6058d2dee44510f3ef165c549a6291e (patch)
tree00286e777fefe26691e14be0e77536f0c9737214
parentad125a746537f806424fbad8d36eff332dffc25a (diff)
downloadsystemtap-steved-f1743f00e6058d2dee44510f3ef165c549a6291e.tar.gz
systemtap-steved-f1743f00e6058d2dee44510f3ef165c549a6291e.tar.xz
systemtap-steved-f1743f00e6058d2dee44510f3ef165c549a6291e.zip
PR6738: restore support for rhel4-era (2.6.9) kernels
-rw-r--r--ChangeLog7
-rw-r--r--buildrun.cxx1
-rw-r--r--runtime/ChangeLog8
-rw-r--r--runtime/autoconf-uaccess.c2
-rw-r--r--runtime/loc2c-runtime.h4
-rw-r--r--runtime/transport/ChangeLog10
-rw-r--r--runtime/transport/procfs.c201
-rw-r--r--runtime/transport/relayfs.c6
-rw-r--r--runtime/transport/transport.h1
-rw-r--r--runtime/unwind/i386.h9
-rw-r--r--runtime/unwind/unwind.h5
-rw-r--r--runtime/unwind/x86_64.h4
-rw-r--r--translate.cxx3
13 files changed, 70 insertions, 191 deletions
diff --git a/ChangeLog b/ChangeLog
index f42ee8c3..1251dada 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2008-07-12 Frank Ch. Eigler <fche@elastic.org>
+ PR 6738.
+ * buildrun.cxx (compile_pass): Add autoconf-uaccess.c.
+ * translate.cxx (translate_pass): #include <linux/vermagic.h> for
+ maximum version compatibility for UTS_RELEASE.
+
+2008-07-12 Frank Ch. Eigler <fche@elastic.org>
+
By Andy Fitzsimon <afitzsim@redhat.com>:
* smileytap.svg: New file.
diff --git a/buildrun.cxx b/buildrun.cxx
index 3183fe6b..72c0d1c7 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -97,6 +97,7 @@ compile_pass (systemtap_session& s)
o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-unregister-kprobes.c, -DSTAPCONF_UNREGISTER_KPROBES,)" << endl;
o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-module-nsections.c, -DSTAPCONF_MODULE_NSECTIONS,)" << endl;
o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-real-parent.c, -DSTAPCONF_REAL_PARENT,)" << endl;
+ o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-uaccess.c, -DSTAPCONF_LINUX_UACCESS_H,)" << endl;
#if 0
/* NB: For now, the performance hit of probe_kernel_read/write (vs. our
* homegrown safe-access functions) is deemed undesireable, so we'll skip
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index de988561..4fe2d033 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,3 +1,11 @@
+2008-07-12 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 6738.
+ * loc2c-runtime.h: #include {asm,linux}/uaccess.h as autoconf'd.
+ * unwind/i386.h (user_mode_vm, FIX_VDSO): #ifdef for older kernels.
+ * unwind/x86_64.h (VSYSCALL_START): speculative #ifdef for same.
+ * unwind/unwind.h (BUILD_BUG_ON_ZER): Ditto.
+
2008-07-10 Frank Ch. Eigler <fche@elastic.org>
PR 6736.
diff --git a/runtime/autoconf-uaccess.c b/runtime/autoconf-uaccess.c
new file mode 100644
index 00000000..400acf99
--- /dev/null
+++ b/runtime/autoconf-uaccess.c
@@ -0,0 +1,2 @@
+#include <linux/uaccess.h>
+
diff --git a/runtime/loc2c-runtime.h b/runtime/loc2c-runtime.h
index a7472691..215676ee 100644
--- a/runtime/loc2c-runtime.h
+++ b/runtime/loc2c-runtime.h
@@ -9,7 +9,11 @@
* later version.
*/
+#ifdef STAPCONF_LINUX_UACCESS_H
#include <linux/uaccess.h>
+#else
+#include <asm/uaccess.h>
+#endif
#include <linux/types.h>
#define intptr_t long
#define uintptr_t unsigned long
diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog
index 58431e54..f766e138 100644
--- a/runtime/transport/ChangeLog
+++ b/runtime/transport/ChangeLog
@@ -1,3 +1,13 @@
+2008-07-12 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 6738.
+ * procfs.c (*): Remove code/data associated with symbol/unwind data
+ uploading.
+ (_stp_ctl_write_cmd): Support STP_RELOCATION message.
+ (kbug): Replace calls with dbug_trans().
+ * relayfs.c (kbug): Ditto.
+ * transport.h: Corresponding changes.
+
2008-07-10 Frank Ch. Eigler <fche@elastic.org>
PR 6736.
diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c
index 750e1994..e0ecd9b3 100644
--- a/runtime/transport/procfs.c
+++ b/runtime/transport/procfs.c
@@ -14,9 +14,7 @@ static int _stp_current_buffers = STP_DEFAULT_BUFFERS;
static _stp_mempool_t *_stp_pool_q;
static struct list_head _stp_ctl_ready_q;
-static struct list_head _stp_sym_ready_q;
DEFINE_SPINLOCK(_stp_ctl_ready_lock);
-DEFINE_SPINLOCK(_stp_sym_ready_lock);
#ifdef STP_BULKMODE
extern int _stp_relay_flushing;
@@ -62,54 +60,6 @@ static struct file_operations _stp_proc_fops = {
};
#endif /* STP_BULKMODE */
-static ssize_t _stp_sym_write_cmd(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
-{
- static int saved_type = 0;
- int type;
-
- if (count < sizeof(int32_t))
- return 0;
-
- /* Allow sending of packet type followed by data in the next packet. */
- if (count == sizeof(int32_t)) {
- if (get_user(saved_type, (int __user *)buf))
- return -EFAULT;
- return count;
- } else if (saved_type) {
- type = saved_type;
- saved_type = 0;
- } else {
- if (get_user(type, (int __user *)buf))
- return -EFAULT;
- count -= sizeof(int);
- buf += sizeof(int);
- }
-
-#if DEBUG_TRANSPORT > 0
- if (type < STP_MAX_CMD)
- _dbug("Got %s. len=%d\n", _stp_command_name[type], (int)count);
-#endif
-
- switch (type) {
- case STP_SYMBOLS:
- count = _stp_do_symbols(buf, count);
- break;
- case STP_MODULE:
- if (count > 1)
- count = _stp_do_module(buf, count);
- else {
- /* count == 1 indicates end of initial modules list */
- _stp_ctl_send(STP_TRANSPORT, NULL, 0);
- }
- break;
- default:
- errk("invalid symbol command type %d\n", type);
- return -EINVAL;
- }
-
- return count;
-
-}
static ssize_t _stp_ctl_write_cmd(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
@@ -142,13 +92,18 @@ static ssize_t _stp_ctl_write_cmd(struct file *file, const char __user *buf, siz
started = 1;
}
break;
+
case STP_EXIT:
_stp_exit_flag = 1;
break;
+
+ case STP_RELOCATION:
+ _stp_do_relocation (buf, count);
+ break;
+
case STP_READY:
- /* request symbolic information */
- _stp_ask_for_symbols();
break;
+
default:
errk("invalid command type %d\n", type);
return -EINVAL;
@@ -165,7 +120,6 @@ struct _stp_buffer {
};
static DECLARE_WAIT_QUEUE_HEAD(_stp_ctl_wq);
-static DECLARE_WAIT_QUEUE_HEAD(_stp_sym_wq);
#if DEBUG_TRANSPORT > 0
static void _stp_ctl_write_dbug(int type, void *data, int len)
@@ -194,20 +148,6 @@ static void _stp_ctl_write_dbug(int type, void *data, int len)
break;
}
}
-static void _stp_sym_write_dbug(int type, void *data, int len)
-{
- switch (type) {
- case STP_SYMBOLS:
- _dbug("sending STP_SYMBOLS\n");
- break;
- case STP_MODULE:
- _dbug("sending STP_MODULE\n");
- break;
- default:
- _dbug("ERROR: unknown message type: %d\n", type);
- break;
- }
-}
#endif
static int _stp_ctl_write(int type, void *data, int len)
@@ -256,95 +196,20 @@ static int _stp_ctl_write(int type, void *data, int len)
return len;
}
-static int _stp_sym_write(int type, void *data, unsigned len)
-{
- struct _stp_buffer *bptr;
- unsigned long flags;
-
-#if DEBUG_TRANSPORT > 0
- _stp_sym_write_dbug(type, data, len);
-#endif
-
- /* make sure we won't overflow the buffer */
- if (unlikely(len > STP_BUFFER_SIZE))
- return 0;
-
- /* get a buffer from the free pool */
- bptr = _stp_mempool_alloc(_stp_pool_q);
- if (unlikely(bptr == NULL))
- return -1;
-
- bptr->type = type;
- memcpy(bptr->buf, data, len);
- bptr->len = len;
-
- /* put it on the pool of ready buffers */
- spin_lock_irqsave(&_stp_sym_ready_lock, flags);
- list_add_tail(&bptr->list, &_stp_sym_ready_q);
- spin_unlock_irqrestore(&_stp_sym_ready_lock, flags);
-
- /* OK, it's queued. Now signal any waiters. */
- wake_up_interruptible(&_stp_sym_wq);
-
- return len;
-}
/* send commands with timeout and retry */
static int _stp_ctl_send(int type, void *data, int len)
{
int err, trylimit = 50;
- kbug(DEBUG_TRANSPORT, "ctl_send: type=%d len=%d\n", type, len);
- if (unlikely(type == STP_SYMBOLS || type == STP_MODULE)) {
- while ((err = _stp_sym_write(type, data, len)) < 0 && trylimit--)
- msleep(5);
- } else {
- while ((err = _stp_ctl_write(type, data, len)) < 0 && trylimit--)
- msleep(5);
- if (err > 0)
- wake_up_interruptible(&_stp_ctl_wq);
- }
- kbug(DEBUG_TRANSPORT, "returning %d\n", err);
+ dbug_trans(1, "ctl_send: type=%d len=%d\n", type, len);
+ while ((err = _stp_ctl_write(type, data, len)) < 0 && trylimit--)
+ msleep(5);
+ if (err > 0)
+ wake_up_interruptible(&_stp_ctl_wq);
+ dbug_trans(1, "returning %d\n", err);
return err;
}
-static ssize_t _stp_sym_read_cmd(struct file *file, char __user *buf, size_t count, loff_t *ppos)
-{
- struct _stp_buffer *bptr;
- int len;
- unsigned long flags;
-
- /* wait for nonempty ready queue */
- spin_lock_irqsave(&_stp_sym_ready_lock, flags);
- while (list_empty(&_stp_sym_ready_q)) {
- spin_unlock_irqrestore(&_stp_sym_ready_lock, flags);
- if (file->f_flags & O_NONBLOCK)
- return -EAGAIN;
- if (wait_event_interruptible(_stp_sym_wq, !list_empty(&_stp_sym_ready_q)))
- return -ERESTARTSYS;
- spin_lock_irqsave(&_stp_sym_ready_lock, flags);
- }
-
- /* get the next buffer off the ready list */
- bptr = (struct _stp_buffer *)_stp_sym_ready_q.next;
- list_del_init(&bptr->list);
- spin_unlock_irqrestore(&_stp_sym_ready_lock, flags);
-
- /* write it out */
- len = bptr->len + 4;
- if (len > count || copy_to_user(buf, &bptr->type, len)) {
- /* now what? We took it off the queue then failed to send it */
- /* we can't put it back on the queue because it will likely be out-of-order */
- /* fortunately this should never happen */
- /* FIXME need to mark this as a transport failure */
- errk("Supplied buffer too small. count:%d len:%d\n", (int)count, len);
- return -EFAULT;
- }
-
- /* put it on the pool of free buffers */
- _stp_mempool_free(bptr);
-
- return len;
-}
static ssize_t _stp_ctl_read_cmd(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{
@@ -385,24 +250,6 @@ static ssize_t _stp_ctl_read_cmd(struct file *file, char __user *buf, size_t cou
return len;
}
-static int _stp_sym_opens = 0;
-static int _stp_sym_open_cmd(struct inode *inode, struct file *file)
-{
- /* only allow one reader */
- if (_stp_sym_opens)
- return -1;
-
- _stp_sym_opens++;
- return 0;
-}
-
-static int _stp_sym_close_cmd(struct inode *inode, struct file *file)
-{
- if (_stp_sym_opens)
- _stp_sym_opens--;
- return 0;
-}
-
static int _stp_ctl_open_cmd(struct inode *inode, struct file *file)
{
if (_stp_attached)
@@ -426,13 +273,6 @@ static struct file_operations _stp_proc_fops_cmd = {
.open = _stp_ctl_open_cmd,
.release = _stp_ctl_close_cmd,
};
-static struct file_operations _stp_sym_fops_cmd = {
- .owner = THIS_MODULE,
- .read = _stp_sym_read_cmd,
- .write = _stp_sym_write_cmd,
- .open = _stp_sym_open_cmd,
- .release = _stp_sym_close_cmd,
-};
/* copy since proc_match is not MODULE_EXPORT'd */
static int my_proc_match(int len, const char *name, struct proc_dir_entry *de)
@@ -445,7 +285,7 @@ static int my_proc_match(int len, const char *name, struct proc_dir_entry *de)
/* set the number of buffers to use to 'num' */
static int _stp_set_buffers(int num)
{
- kbug(DEBUG_TRANSPORT, "stp_set_buffers %d\n", num);
+ dbug_trans(1, "stp_set_buffers %d\n", num);
return _stp_mempool_resize(_stp_pool_q, num);
}
@@ -476,7 +316,6 @@ static int _stp_register_ctl_channel(void)
struct list_head *p, *tmp;
INIT_LIST_HEAD(&_stp_ctl_ready_q);
- INIT_LIST_HEAD(&_stp_sym_ready_q);
/* allocate buffers */
_stp_pool_q = _stp_mempool_init(sizeof(struct _stp_buffer), STP_DEFAULT_BUFFERS);
@@ -515,12 +354,6 @@ static int _stp_register_ctl_channel(void)
de->gid = _stp_gid;
de->proc_fops = &_stp_proc_fops_cmd;
- /* create /proc/systemtap/module_name/.symbols */
- de = create_proc_entry(".symbols", 0600, _stp_proc_root);
- if (de == NULL)
- goto err2;
- de->proc_fops = &_stp_sym_fops_cmd;
-
return 0;
err2:
remove_proc_entry(".cmd", _stp_proc_root);
@@ -552,7 +385,7 @@ static void _stp_unregister_ctl_channel(void)
#ifdef STP_BULKMODE
int i;
struct proc_dir_entry *de;
- kbug("unregistering procfs\n");
+ dbug_trans(1, "unregistering procfs\n");
for (de = _stp_proc_root->subdir; de; de = de->next)
_stp_kfree(de->data);
@@ -568,10 +401,6 @@ static void _stp_unregister_ctl_channel(void)
_stp_rmdir_proc_module();
/* Return memory to pool and free it. */
- list_for_each_safe(p, tmp, &_stp_sym_ready_q) {
- list_del(p);
- _stp_mempool_free(p);
- }
list_for_each_safe(p, tmp, &_stp_ctl_ready_q) {
list_del(p);
_stp_mempool_free(p);
diff --git a/runtime/transport/relayfs.c b/runtime/transport/relayfs.c
index 375c8e59..6c516d66 100644
--- a/runtime/transport/relayfs.c
+++ b/runtime/transport/relayfs.c
@@ -2,7 +2,7 @@
* relayfs.c - relayfs transport functions
*
* Copyright (C) IBM Corporation, 2005, 2006
- * Copyright (C) Red Hat Inc, 2005, 2006, 2007
+ * Copyright (C) 2005-2008 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
@@ -94,7 +94,7 @@ struct utt_trace *utt_trace_setup(struct utt_trace_setup *utts)
if (!utt->dir)
goto err;
- kbug("relay_open %d %d\n", utts->buf_size, utts->buf_nr);
+ dbug_trans(1, "relay_open %d %d\n", utts->buf_size, utts->buf_nr);
utt->rchan = relay_open("trace", utt->dir, utts->buf_size,
utts->buf_nr, 0, &stp_rchan_callbacks);
@@ -165,7 +165,7 @@ int utt_trace_startstop(struct utt_trace *utt, int start,
int utt_trace_remove(struct utt_trace *utt)
{
- kbug("removing relayfs files. %d\n", utt->trace_state);
+ dbug_trans(1, "removing relayfs files. %d\n", utt->trace_state);
if (utt && (utt->trace_state == Utt_trace_setup || utt->trace_state == Utt_trace_stopped)) {
if (utt->rchan)
relay_close(utt->rchan);
diff --git a/runtime/transport/transport.h b/runtime/transport/transport.h
index dc499961..421a65c2 100644
--- a/runtime/transport/transport.h
+++ b/runtime/transport/transport.h
@@ -33,7 +33,6 @@ extern void _stp_print_cleanup(void);
static struct dentry *_stp_get_root_dir(const char *name);
static int _stp_lock_debugfs(void);
static void _stp_unlock_debugfs(void);
-static int _stp_ctl_send(int type, void *data, int len);
static void _stp_attach(void);
static void _stp_detach(void);
void _stp_handle_start(struct _stp_msg_start *st);
diff --git a/runtime/unwind/i386.h b/runtime/unwind/i386.h
index 79e6ba73..9f488f07 100644
--- a/runtime/unwind/i386.h
+++ b/runtime/unwind/i386.h
@@ -68,6 +68,13 @@ struct unwind_frame_info
((raItem).where == Memory && \
!((raItem).value * (dataAlign) + 4))
+
+/* 2.6.9-era compatibility */
+#ifndef user_mode_vm
+#define user_mode_vm(regs) user_mode(regs)
+#endif
+
+
static inline void arch_unw_init_frame_info(struct unwind_frame_info *info,
/*const*/ struct pt_regs *regs)
{
@@ -125,8 +132,10 @@ static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
|| info->regs.sp < PAGE_OFFSET;
#else
return info->regs.eip < PAGE_OFFSET
+#ifdef FIX_VDSO /* newer kernel? */
|| (info->regs.eip >= __fix_to_virt(FIX_VDSO)
&& info->regs.eip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE)
+#endif
|| info->regs.esp < PAGE_OFFSET;
#endif
#endif
diff --git a/runtime/unwind/unwind.h b/runtime/unwind/unwind.h
index ae5e75d3..78a4bfef 100644
--- a/runtime/unwind/unwind.h
+++ b/runtime/unwind/unwind.h
@@ -25,6 +25,11 @@
#define MAX_STACK_DEPTH 8
+#ifndef BUILD_BUG_ON_ZERO
+#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
+#endif
+
+
#define EXTRA_INFO(f) { \
BUILD_BUG_ON_ZERO(offsetof(struct unwind_frame_info, f) \
% FIELD_SIZEOF(struct unwind_frame_info, f)) \
diff --git a/runtime/unwind/x86_64.h b/runtime/unwind/x86_64.h
index 5eb3a58f..3c70f206 100644
--- a/runtime/unwind/x86_64.h
+++ b/runtime/unwind/x86_64.h
@@ -137,11 +137,15 @@ static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
#else
#ifdef STAPCONF_X86_UNIREGS
return (long)info->regs.ip >= 0
+#ifdef VSYSCALL_START
|| (info->regs.ip >= VSYSCALL_START && info->regs.ip < VSYSCALL_END)
+#endif
|| (long)info->regs.sp >= 0;
#else
return (long)info->regs.rip >= 0
+#ifdef VSYSCALL_START
|| (info->regs.rip >= VSYSCALL_START && info->regs.rip < VSYSCALL_END)
+#endif
|| (long)info->regs.rsp >= 0;
#endif
#endif
diff --git a/translate.cxx b/translate.cxx
index c52171e1..215d7ffb 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4651,7 +4651,8 @@ translate_pass (systemtap_session& s)
s.op->newline() << "#include <linux/delay.h>";
s.op->newline() << "#include <linux/profile.h>";
s.op->newline() << "#include <linux/random.h>";
- s.op->newline() << "#include <linux/utsrelease.h>";
+ // s.op->newline() << "#include <linux/utsrelease.h>"; // newer kernels only
+ s.op->newline() << "#include <linux/vermagic.h>";
s.op->newline() << "#include <linux/utsname.h>";
s.op->newline() << "#include <linux/version.h>";
// s.op->newline() << "#include <linux/compile.h>";