From 6fa8d6e2a8378bfaee0e8e1af8cc707b4e14aab3 Mon Sep 17 00:00:00 2001 From: hunt Date: Tue, 20 Mar 2007 20:21:36 +0000 Subject: 2007-03-20 Martin Hunt * symbols.c (send_module): If send returns < 0 then cleanup and exit. (do_kernel_symbols): Ditto. --- runtime/staprun/ChangeLog | 6 ++++++ runtime/staprun/mainloop.c | 1 + runtime/staprun/symbols.c | 28 ++++++++++++++++++++++------ 3 files changed, 29 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/staprun/ChangeLog b/runtime/staprun/ChangeLog index c55e8850..50d56ce3 100644 --- a/runtime/staprun/ChangeLog +++ b/runtime/staprun/ChangeLog @@ -1,3 +1,9 @@ +2007-03-20 Martin Hunt + + * symbols.c (send_module): If send returns < 0 then + cleanup and exit. + (do_kernel_symbols): Ditto. + 2007-03-18 Martin Hunt * staprun.h (err): Define. * symbols.c (get_sections): More overflow checking. diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c index ba34b265..0bede8cf 100644 --- a/runtime/staprun/mainloop.c +++ b/runtime/staprun/mainloop.c @@ -359,6 +359,7 @@ int stp_main_loop(void) } case STP_MODULE: { + dbug("STP_MODULES request received\n"); do_module(data); break; } diff --git a/runtime/staprun/symbols.c b/runtime/staprun/symbols.c index ca18a8ca..c8758c37 100644 --- a/runtime/staprun/symbols.c +++ b/runtime/staprun/symbols.c @@ -128,8 +128,12 @@ void send_module (char *mname) { char data[32768]; int len = get_sections(mname, data, sizeof(data)); - if (len) - send_request(STP_MODULE, data, len); + if (len) { + if (send_request(STP_MODULE, data, len) < 0) { + err("Loading of module %s failed. Exiting...\n", mname); + cleanup_and_exit(0); + } + } } int do_module (void *data) @@ -221,20 +225,32 @@ void do_kernel_symbols(void) *(int *)buf = STP_SYMBOLS; *(int *)(buf+sizeof(long)) = num_syms; *(int *)(buf+sizeof(long)+sizeof(int)) = (unsigned)(dataptr - data); - send_data(buf, 2*sizeof(int)+sizeof(long)); + if (send_data(buf, 2*sizeof(int)+sizeof(long)) < 0) + goto err; /* send syms */ - send_data(sym_base, num_syms*sizeof(struct _stp_symbol)+sizeof(long)); + if (send_data(sym_base, num_syms*sizeof(struct _stp_symbol)+sizeof(long)) < 0) + goto err; /* send data */ - send_data(data_base, dataptr-data+sizeof(long)); + if (send_data(data_base, dataptr-data+sizeof(long)) < 0) + goto err; free(data_base); free(sym_base); fclose(kallsyms); if (dataptr >= datamax) { - fprintf(stderr,"Error: overflowed symbol data area.\n"); + err("Error: overflowed symbol data area.\n"); cleanup_and_exit(0); } + return; + +err: + free(data_base); + free(sym_base); + fclose(kallsyms); + + err("Loading of symbols failed. Exiting...\n"); + cleanup_and_exit(0); } -- cgit