diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/transport/ChangeLog | 6 | ||||
-rw-r--r-- | runtime/transport/symbols.c | 23 |
2 files changed, 25 insertions, 4 deletions
diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog index 0bb62497..b3a159e3 100644 --- a/runtime/transport/ChangeLog +++ b/runtime/transport/ChangeLog @@ -1,3 +1,9 @@ +2008-04-09 Martin Hunt <hunt@dragon> + + * symbols.c (_stp_init_kernel_symbols): Print error + messages and exit if symbol lookups fail. + (_stp_init_modules): Lookup modules_op. + 2008-03-31 Martin Hunt <hunt@redhat.com> * symbols.c (_stp_init_modules): Use STP_USE_DWARF_UNWINDER. diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c index 8bab1e70..b0e7c319 100644 --- a/runtime/transport/symbols.c +++ b/runtime/transport/symbols.c @@ -187,8 +187,8 @@ static int _stp_init_kernel_symbols(void) { _stp_modules[0] = (struct _stp_module *)_stp_kzalloc(sizeof(struct _stp_module)); if (_stp_modules[0] == NULL) { - errk("cannot allocate memory\n"); - return -EFAULT; + _dbug("cannot allocate memory\n"); + return -1; } _stp_modules[0]->symbols = _stp_kernel_symbols; _stp_modules[0]->num_symbols = _stp_num_kernel_symbols; @@ -197,11 +197,21 @@ static int _stp_init_kernel_symbols(void) /* Note: this mapping is used by kernel/_stext pseudo-relocations. */ _stp_modules[0]->text = _stp_kallsyms_lookup_name("_stext"); + if (_stp_modules[0]->text == 0) { + _dbug("Lookup of _stext failed. Exiting.\n"); + return -1; + } _stp_modules[0]->data = _stp_kallsyms_lookup_name("_etext"); + if (_stp_modules[0]->data == 0) { + _dbug("Lookup of _etext failed. Exiting.\n"); + return -1; + } _stp_modules[0]->text_size = _stp_modules[0]->data - _stp_modules[0]->text; _stp_modules_by_addr[0] = _stp_modules[0]; _stp_kretprobe_trampoline = _stp_kallsyms_lookup_name("kretprobe_trampoline"); + /* Lookup failure is not fatal */ + return 0; } @@ -559,14 +569,19 @@ static struct notifier_block _stp_module_load_nb = { }; #include <linux/seq_file.h> -extern unsigned long _stp_modules_op; /* from stap */ + static int _stp_init_modules(void) { loff_t pos = 0; void *res; struct module *mod; + const struct seq_operations *modules_op = (const struct seq_operations *)_stp_kallsyms_lookup_name("modules_op"); + + if (modules_op == NULL) { + _dbug("Lookup of modules_op failed.\n"); + return -1; + } - const struct seq_operations *modules_op = (const struct seq_operations *)_stp_modules_op; /* Use the seq_file interface to safely get a list of installed modules */ res = modules_op->start(NULL, &pos); while (res) { |