From e2de7195efa37921953248d2a4af565e99bfd249 Mon Sep 17 00:00:00 2001 From: fche Date: Sun, 27 Jan 2008 18:27:40 +0000 Subject: 2008-01-27 Frank Ch. Eigler * stack-i386.c (__stp_stack_print): Correct #elif->#else typo. --- runtime/ChangeLog | 4 ++++ runtime/stack-i386.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 7536cc88..020d2176 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,7 @@ +2008-01-27 Frank Ch. Eigler + + * stack-i386.c (__stp_stack_print): Correct #elif->#else typo. + 2008-01-14 Martin Hunt * print.c (_stp_print_kernel_info): New function. diff --git a/runtime/stack-i386.c b/runtime/stack-i386.c index d73f4c84..b46ff06b 100644 --- a/runtime/stack-i386.c +++ b/runtime/stack-i386.c @@ -23,7 +23,7 @@ static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels) { #ifdef STAPCONF_X86_UNIREGS unsigned long ebp = regs->bp; - #elif + #else unsigned long ebp = regs->ebp; #endif -- cgit From a2fac8e8d1899b7e12b98fbc83639d321f3f182e Mon Sep 17 00:00:00 2001 From: hunt Date: Mon, 28 Jan 2008 19:20:48 +0000 Subject: 2008-01-28 Martin Hunt * control.c, procfs.c, symbols.c: Use DEFINE_SPINLOCK --- runtime/transport/ChangeLog | 4 ++++ runtime/transport/control.c | 8 ++++---- runtime/transport/procfs.c | 6 +++--- runtime/transport/symbols.c | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) (limited to 'runtime') diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog index e7bbabd8..764e3579 100644 --- a/runtime/transport/ChangeLog +++ b/runtime/transport/ChangeLog @@ -1,3 +1,7 @@ +2008-01-28 Martin Hunt + + * control.c, procfs.c, symbols.c: Use DEFINE_SPINLOCK + 2008-01-15 Martin Hunt PR4037 and fixes to better synchronize staprun and stapio. diff --git a/runtime/transport/control.c b/runtime/transport/control.c index 3179f507..0bf99fc8 100644 --- a/runtime/transport/control.c +++ b/runtime/transport/control.c @@ -1,7 +1,7 @@ /* -*- linux-c -*- * * debugfs control channel - * Copyright (C) 2007 Red Hat Inc. + * Copyright (C) 2007-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 @@ -15,9 +15,9 @@ static int _stp_current_buffers = STP_DEFAULT_BUFFERS; static struct list_head _stp_ctl_ready_q; static struct list_head _stp_sym_ready_q; static struct list_head _stp_pool_q; -spinlock_t _stp_pool_lock = SPIN_LOCK_UNLOCKED; -spinlock_t _stp_ctl_ready_lock = SPIN_LOCK_UNLOCKED; -spinlock_t _stp_sym_ready_lock = SPIN_LOCK_UNLOCKED; +DEFINE_SPINLOCK(_stp_pool_lock); +DEFINE_SPINLOCK(_stp_ctl_ready_lock); +DEFINE_SPINLOCK(_stp_sym_ready_lock); static ssize_t _stp_sym_write_cmd (struct file *file, const char __user *buf, size_t count, loff_t *ppos) diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c index 85e97d15..33f6db33 100644 --- a/runtime/transport/procfs.c +++ b/runtime/transport/procfs.c @@ -15,9 +15,9 @@ static int _stp_current_buffers = STP_DEFAULT_BUFFERS; static struct list_head _stp_ctl_ready_q; static struct list_head _stp_sym_ready_q; static struct list_head _stp_pool_q; -spinlock_t _stp_pool_lock = SPIN_LOCK_UNLOCKED; -spinlock_t _stp_ctl_ready_lock = SPIN_LOCK_UNLOCKED; -spinlock_t _stp_sym_ready_lock = SPIN_LOCK_UNLOCKED; +DEFINE_SPINLOCK(_stp_pool_lock); +DEFINE_SPINLOCK(_stp_ctl_ready_lock); +DEFINE_SPINLOCK(_stp_sym_ready_lock); #ifdef STP_BULKMODE extern int _stp_relay_flushing; diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c index dde0f967..e740dde8 100644 --- a/runtime/transport/symbols.c +++ b/runtime/transport/symbols.c @@ -16,7 +16,7 @@ #define _SYMBOLS_C_ #include "../sym.h" -spinlock_t _stp_module_lock = SPIN_LOCK_UNLOCKED; +DEFINE_SPINLOCK(_stp_module_lock); #define STP_TRYLOCK_MODULES ({ \ int numtrylock = 0; \ while (!spin_trylock_irqsave (&_stp_module_lock, flags) && (++numtrylock < MAXTRYLOCK)) \ -- cgit From 395d6cf1121410e4795193ee42fb1890d1695907 Mon Sep 17 00:00:00 2001 From: hunt Date: Mon, 28 Jan 2008 19:22:51 +0000 Subject: 2008-01-28 Martin Hunt * alloc.c: Use DEFINE_SPINLOCK. * counter.c: Ditto. * pmap-gen.c: Ditto. * print_new.c: Ditto. * stat.c: Ditto. --- runtime/ChangeLog | 8 ++++++++ runtime/alloc.c | 2 +- runtime/counter.c | 4 ++-- runtime/pmap-gen.c | 6 +++--- runtime/print_new.c | 5 +++-- runtime/stat.c | 4 ++-- 6 files changed, 19 insertions(+), 10 deletions(-) (limited to 'runtime') diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 020d2176..c793fbd9 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,11 @@ +2008-01-28 Martin Hunt + + * alloc.c: Use DEFINE_SPINLOCK. + * counter.c: Ditto. + * pmap-gen.c: Ditto. + * print_new.c: Ditto. + * stat.c: Ditto. + 2008-01-27 Frank Ch. Eigler * stack-i386.c (__stp_stack_print): Correct #elif->#else typo. diff --git a/runtime/alloc.c b/runtime/alloc.c index f022755a..674a340d 100644 --- a/runtime/alloc.c +++ b/runtime/alloc.c @@ -32,7 +32,7 @@ static int _stp_allocated_net_memory = 0; #ifdef DEBUG_MEM -static spinlock_t _stp_mem_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(_stp_mem_lock); static int _stp_allocated_memory = 0; #define MEM_MAGIC 0xc11cf77f diff --git a/runtime/counter.c b/runtime/counter.c index 42555dfa..d0376547 100644 --- a/runtime/counter.c +++ b/runtime/counter.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * Counter aggregation Functions - * Copyright (C) 2005 Red Hat Inc. + * 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 @@ -60,7 +60,7 @@ Counter _stp_counter_init (void) int i; for_each_cpu(i) { Counter c = per_cpu_ptr (cnt, i); - c->lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(c->lock); } } #endif diff --git a/runtime/pmap-gen.c b/runtime/pmap-gen.c index ca8d45c5..0efffdb6 100644 --- a/runtime/pmap-gen.c +++ b/runtime/pmap-gen.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * pmap API generator - * Copyright (C) 2005-2007 Red Hat Inc. + * 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 @@ -412,7 +412,7 @@ PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries) m->copy = KEYSYM(pmap_copy_keys); m->cmp = KEYSYM(pmap_key_cmp); #if NEED_MAP_LOCKS - m->lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(m->lock); #endif } m = &pmap->agg; @@ -466,7 +466,7 @@ PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries, int htype, ...) m->copy = KEYSYM(pmap_copy_keys); m->cmp = KEYSYM(pmap_key_cmp); #if NEED_MAP_LOCKS - m->lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(m->lock); #endif } m = &pmap->agg; diff --git a/runtime/print_new.c b/runtime/print_new.c index 95a83a8d..75bbd82b 100644 --- a/runtime/print_new.c +++ b/runtime/print_new.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * Print Flush Function - * Copyright (C) 2007 Red Hat Inc. + * Copyright (C) 2007-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 @@ -15,7 +15,8 @@ * * @note Preemption must be disabled to use this. */ -spinlock_t _stp_print_lock = SPIN_LOCK_UNLOCKED; + +DEFINE_SPINLOCK(_stp_print_lock); void EXPORT_FN(stp_print_flush) (_stp_pbuf *pb) { diff --git a/runtime/stat.c b/runtime/stat.c index 298a6653..f8b5f018 100644 --- a/runtime/stat.c +++ b/runtime/stat.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * Statistics Aggregation - * Copyright (C) 2005, 2007 Red Hat Inc. + * Copyright (C) 2005-2008 Red Hat Inc. * Copyright (C) 2006 Intel Corporation * * This file is part of systemtap, and is free software. You can @@ -111,7 +111,7 @@ Stat _stp_stat_init (int type, ...) int i; for_each_cpu(i) { stat *sdp = per_cpu_ptr (sd, i); - sdp->lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(sdp->lock); } } #endif -- cgit From 5d03112aaed421893cc08a6112b699995d254506 Mon Sep 17 00:00:00 2001 From: hunt Date: Wed, 30 Jan 2008 00:43:22 +0000 Subject: 2008-01-29 Martin Hunt * alloc.c (struct _stp_malloc_type): Remove redundant field. --- runtime/ChangeLog | 5 +++++ runtime/alloc.c | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/ChangeLog b/runtime/ChangeLog index c793fbd9..b0db7a21 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,8 @@ +2008-01-29 Martin Hunt + + * alloc.c (struct _stp_malloc_type): Remove + redundant field. + 2008-01-28 Martin Hunt * alloc.c: Use DEFINE_SPINLOCK. diff --git a/runtime/alloc.c b/runtime/alloc.c index 674a340d..cfdb97bd 100644 --- a/runtime/alloc.c +++ b/runtime/alloc.c @@ -41,15 +41,14 @@ static int _stp_allocated_memory = 0; enum _stp_memtype { MEM_KMALLOC, MEM_VMALLOC, MEM_PERCPU }; typedef struct { - enum _stp_memtype type; char *alloc; char *free; } _stp_malloc_type; static const _stp_malloc_type const _stp_malloc_types[] = { - {MEM_KMALLOC, "kmalloc", "kfree"}, - {MEM_VMALLOC, "vmalloc", "vfree"}, - {MEM_PERCPU, "alloc_percpu", "free_percpu"} + {"kmalloc", "kfree"}, + {"vmalloc", "vfree"}, + {"alloc_percpu", "free_percpu"} }; struct _stp_mem_entry { -- cgit From 787abf66a1807e62f54b84732bcc6a12480db8ed Mon Sep 17 00:00:00 2001 From: hunt Date: Wed, 30 Jan 2008 00:45:45 +0000 Subject: 2008-01-29 Martin Hunt * io.c (_stp_vlog): Use get_cpu() instead of smp_processor_id() because this function can get called with interrupts enabled. --- runtime/ChangeLog | 6 ++++++ runtime/io.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/ChangeLog b/runtime/ChangeLog index b0db7a21..0a8ac63a 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,5 +1,11 @@ 2008-01-29 Martin Hunt + * io.c (_stp_vlog): Use get_cpu() instead + of smp_processor_id() because this function can get + called with interrupts enabled. + +2008-01-29 Martin Hunt + * alloc.c (struct _stp_malloc_type): Remove redundant field. diff --git a/runtime/io.c b/runtime/io.c index e36381bd..c49d86e6 100644 --- a/runtime/io.c +++ b/runtime/io.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * I/O for printing warnings, errors and debug messages - * Copyright (C) 2005, 2006, 2007 Red Hat Inc. + * 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 @@ -25,7 +25,7 @@ enum code { INFO=0, WARN, ERROR, DBUG }; static void _stp_vlog (enum code type, const char *func, int line, const char *fmt, va_list args) { int num; - char *buf = per_cpu_ptr(Stp_lbuf, smp_processor_id()); + char *buf = per_cpu_ptr(Stp_lbuf, get_cpu()); int start = 0; if (type == DBUG) { @@ -53,6 +53,7 @@ static void _stp_vlog (enum code type, const char *func, int line, const char *f _stp_print_flush(); } } + put_cpu(); } /** Logs Data. -- cgit From 5e31adfd421713a07d537aa30e93493e5d0a54c6 Mon Sep 17 00:00:00 2001 From: ananth Date: Mon, 4 Feb 2008 09:30:48 +0000 Subject: Print out more descriptive error messages on non-root systemtap invocation Thanks to Jim for fixing typos and grammar. --- runtime/staprun/staprun_funcs.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/staprun/staprun_funcs.c b/runtime/staprun/staprun_funcs.c index d1bba3f8..3a678405 100644 --- a/runtime/staprun/staprun_funcs.c +++ b/runtime/staprun/staprun_funcs.c @@ -336,7 +336,11 @@ int check_permissions(void) /* If neither group was found, just return an error. */ if (stapdev_gid == (gid_t)-1 && stapusr_gid == (gid_t)-1) { - err("ERROR: unable to find either group \"stapdev\" or group \"stapusr\"\n"); + err("ERROR: You are trying to run stap as a normal user.\n" + "You should either be root, or be part of either " + "group \"stapdev\" or group \"stapusr\".\n" + "Your system doesn't seem to have either group.\n" + "For more information, please consult the \"SAFETY AND SECURITY\" section of the \"stap(1)\" manpage\n"); return -1; } @@ -374,7 +378,10 @@ int check_permissions(void) /* If path_check is 0, then the user isn't a member of either * group. Error out. */ if (path_check == 0) { - err("ERROR: you must be a member of either group \"stapdev\" or group \"stapusr\"\n"); + err("ERROR: You are trying to run stap as a normal user.\n" + "You must be a member of either group \"stapdev\" or group \"stapusr\".\n" + "Please contact your system administrator to get yourself membership to either of those groups.\n" + "For more information, please consult the \"SAFETY AND SECURITY\" section of the \"stap(1)\" manpage.\n"); return 0; } -- cgit From 47683be64546814f9bf7f48e62c916d7901e336e Mon Sep 17 00:00:00 2001 From: hiramatu Date: Wed, 6 Feb 2008 22:07:42 +0000 Subject: 2008-02-06 Masami Hiramatsu * stack-ia64.c (__stp_show_stack_sym): Skip printing symbol if (ip == REG_IP(regs)). 2008-02-06 Masami Hiramatsu * systemtap.context/backtrace.tcl: Fixed regular expressions and Added new expression for return probe on ia64. * systemtap.context/backtrace.stp(print_all_trace_info): Added trace point output before calling print_stack(). --- runtime/ChangeLog | 5 +++++ runtime/stack-ia64.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 0a8ac63a..b501c1ef 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,8 @@ +2008-02-06 Masami Hiramatsu + + * stack-ia64.c (__stp_show_stack_sym): Skip printing symbol if (ip == + REG_IP(regs)). + 2008-01-29 Martin Hunt * io.c (_stp_vlog): Use get_cpu() instead diff --git a/runtime/stack-ia64.c b/runtime/stack-ia64.c index cab25a0b..ca9d25a6 100644 --- a/runtime/stack-ia64.c +++ b/runtime/stack-ia64.c @@ -23,8 +23,8 @@ static void __stp_show_stack_sym(struct unw_frame_info *info, void *arg) if (skip){ if (ip == REG_IP(regs)) skip = 0; - else continue; - } + continue; + } _stp_print_char(' '); _stp_symbol_print(ip); _stp_print_char('\n'); -- cgit From a8913457fffe45ca33813e045c335d0c38ab30b5 Mon Sep 17 00:00:00 2001 From: kenistoj Date: Mon, 11 Feb 2008 23:37:06 +0000 Subject: PR 5693 * runtime/uprobes/uprobes.c: Intercept handler-destined signals received while we're single-stepping, and re-queue them afterward. * runtime/uprobes/uprobes.h: Ditto --- runtime/uprobes/uprobes.c | 79 ++++++++++++++++++++++++++++++++++++++++++++--- runtime/uprobes/uprobes.h | 3 ++ 2 files changed, 78 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/uprobes/uprobes.c b/runtime/uprobes/uprobes.c index f0b72c46..f7d90add 100644 --- a/runtime/uprobes/uprobes.c +++ b/runtime/uprobes/uprobes.c @@ -94,6 +94,15 @@ struct deferred_registration { enum uprobe_type type; }; +/* + * Calling a signal handler cancels single-stepping, so uprobes delays + * calling the handler, as necessary, until after single-stepping is completed. + */ +struct delayed_signal { + struct list_head list; + siginfo_t info; +}; + static struct uprobe_task *uprobe_find_utask(struct task_struct *tsk) { struct hlist_head *head; @@ -436,6 +445,7 @@ static int quiesce_all_threads(struct uprobe_process *uproc, static void uprobe_free_task(struct uprobe_task *utask) { struct deferred_registration *dr, *d; + struct delayed_signal *ds, *ds2; struct uretprobe_instance *ri; struct hlist_node *r1, *r2; @@ -445,6 +455,12 @@ static void uprobe_free_task(struct uprobe_task *utask) list_del(&dr->list); kfree(dr); } + + list_for_each_entry_safe(ds, ds2, &utask->delayed_signals, list) { + list_del(&ds->list); + kfree(ds); + } + hlist_for_each_entry_safe(ri, r1, r2, &utask->uretprobe_instances, hlist) { hlist_del(&ri->hlist); @@ -557,6 +573,7 @@ static struct uprobe_task *uprobe_add_task(struct task_struct *t, utask->doomed = 0; INIT_HLIST_HEAD(&utask->uretprobe_instances); INIT_LIST_HEAD(&utask->deferred_registrations); + INIT_LIST_HEAD(&utask->delayed_signals); INIT_LIST_HEAD(&utask->list); list_add_tail(&utask->list, &uproc->thread_list); uprobe_hash_utask(utask); @@ -1576,6 +1593,33 @@ static inline void uprobe_post_ssin(struct uprobe_task *utask, /* uprobe_pre_ssout() and uprobe_post_ssout() are architecture-specific. */ +/* + * Delay delivery of the indicated signal until after single-step. + * Otherwise single-stepping will be cancelled as part of calling + * the signal handler. + */ +static u32 uprobe_delay_signal(struct uprobe_task *utask, siginfo_t *info) +{ + struct delayed_signal *ds = kmalloc(sizeof(*ds), GFP_USER); + if (ds) { + ds->info = *info; + INIT_LIST_HEAD(&ds->list); + list_add_tail(&ds->list, &utask->delayed_signals); + } + return UTRACE_ACTION_HIDE | UTRACE_SIGNAL_IGN | + UTRACE_ACTION_SINGLESTEP | UTRACE_ACTION_NEWSTATE; +} + +static void uprobe_inject_delayed_signals(struct list_head *delayed_signals) +{ + struct delayed_signal *ds, *tmp; + list_for_each_entry_safe(ds, tmp, delayed_signals, list) { + send_sig_info(ds->info.si_signo, &ds->info, current); + list_del(&ds->list); + kfree(ds); + } +} + /* * Signal callback: * @@ -1616,10 +1660,24 @@ static u32 uprobe_report_signal(struct utrace_attached_engine *engine, unsigned long probept; int hit_uretprobe_trampoline = 0; int registrations_deferred = 0; + int uproc_freed = 0; + struct list_head delayed_signals; utask = (struct uprobe_task *)rcu_dereference(engine->data); BUG_ON(!utask); + /* + * info will be null if we're called with action=UTRACE_SIGNAL_HANDLER, + * which means that single-stepping has been disabled so a signal + * handler can be called in the probed process. That should never + * happen because we intercept and delay handled signals (action = + * UTRACE_ACTION_RESUME) until after we're done single-stepping. + */ + BUG_ON(!info); + if (action == UTRACE_ACTION_RESUME && utask->active_probe && + info->si_signo != SSTEP_SIGNAL) + return uprobe_delay_signal(utask, info); + if (info->si_signo != BREAKPOINT_SIGNAL && info->si_signo != SSTEP_SIGNAL) goto no_interest; @@ -1722,13 +1780,21 @@ bkpt_done: uprobe_get_process(uproc); } + /* + * Delayed signals are a little different. We want + * them delivered even if all the probes get unregistered + * and uproc and utask go away. So disconnect the list + * from utask and make it a local list. + */ + INIT_LIST_HEAD(&delayed_signals); + list_splice_init(&utask->delayed_signals, &delayed_signals); + ret = UTRACE_ACTION_HIDE | UTRACE_SIGNAL_IGN | UTRACE_ACTION_NEWSTATE; utask->state = UPTASK_RUNNING; if (utask->quiescing) { up_read(&uproc->rwsem); - if (utask_fake_quiesce(utask) == 1) - ret |= UTRACE_ACTION_DETACH; + uproc_freed |= utask_fake_quiesce(utask); } else up_read(&uproc->rwsem); @@ -1738,12 +1804,17 @@ bkpt_done: * we just recycled was the last reason for * keeping uproc around. */ - uprobe_put_process(uproc); + uproc_freed |= uprobe_put_process(uproc); if (registrations_deferred) { uprobe_run_def_regs(&utask->deferred_registrations); - uprobe_put_process(uproc); + uproc_freed |= uprobe_put_process(uproc); } + + uprobe_inject_delayed_signals(&delayed_signals); + + if (uproc_freed) + ret |= UTRACE_ACTION_DETACH; break; default: goto no_interest; diff --git a/runtime/uprobes/uprobes.h b/runtime/uprobes/uprobes.h index 418518f8..0c471474 100644 --- a/runtime/uprobes/uprobes.h +++ b/runtime/uprobes/uprobes.h @@ -385,6 +385,9 @@ struct uprobe_task { /* [un]registrations initiated by handlers must be asynchronous. */ struct list_head deferred_registrations; + + /* Delay handler-destined signals 'til after single-step done. */ + struct list_head delayed_signals; }; #ifdef CONFIG_UPROBES_SSOL -- cgit