diff options
author | bmc <none@none> | 2005-09-19 22:42:24 -0700 |
---|---|---|
committer | bmc <none@none> | 2005-09-19 22:42:24 -0700 |
commit | b365acd0c29cb0376af78f1f0662459a9d216641 (patch) | |
tree | 8db07f6206bb218fb6ef151b66a0d6e547abcc4e | |
parent | 52b2f68ad911d527af0cd3152af81e314ff9f0c1 (diff) | |
download | illumos-gate-onnv_24.tar.gz |
usr/src/lib/libdtrace/common/dt_options.connv_24
usr/src/lib/libdtrace/common/dt_proc.c
usr/src/uts/intel/dtrace/fbt.c
-rw-r--r-- | usr/src/lib/libdtrace/common/dt_options.c | 1 | ||||
-rw-r--r-- | usr/src/lib/libdtrace/common/dt_proc.c | 8 | ||||
-rw-r--r-- | usr/src/uts/intel/dtrace/fbt.c | 31 |
3 files changed, 37 insertions, 3 deletions
diff --git a/usr/src/lib/libdtrace/common/dt_options.c b/usr/src/lib/libdtrace/common/dt_options.c index 1c776f5933..4f80e0966d 100644 --- a/usr/src/lib/libdtrace/common/dt_options.c +++ b/usr/src/lib/libdtrace/common/dt_options.c @@ -915,6 +915,7 @@ static const dt_option_t _dtrace_drtoptions[] = { { "rawbytes", dt_opt_runtime, DTRACEOPT_RAWBYTES }, { "stackindent", dt_opt_runtime, DTRACEOPT_STACKINDENT }, { "switchrate", dt_opt_rate, DTRACEOPT_SWITCHRATE }, + { NULL } }; int diff --git a/usr/src/lib/libdtrace/common/dt_proc.c b/usr/src/lib/libdtrace/common/dt_proc.c index ff5d4086ce..0402c60cf1 100644 --- a/usr/src/lib/libdtrace/common/dt_proc.c +++ b/usr/src/lib/libdtrace/common/dt_proc.c @@ -659,7 +659,7 @@ dt_proc_lookup(dtrace_hdl_t *dtp, struct ps_prochandle *P, int remove) static void dt_proc_destroy(dtrace_hdl_t *dtp, struct ps_prochandle *P) { - dt_proc_t *dpr = dt_proc_lookup(dtp, P, B_TRUE); + dt_proc_t *dpr = dt_proc_lookup(dtp, P, B_FALSE); dt_proc_hash_t *dph = dtp->dt_procs; dt_proc_t *npr, **npp; int rflag; @@ -715,10 +715,12 @@ dt_proc_destroy(dtrace_hdl_t *dtp, struct ps_prochandle *P) } /* - * Before we free the process structure, walk the dt_proc_hash_t's - * notification list and remove this dt_proc_t if it is enqueued. + * Before we free the process structure, remove this dt_proc_t from the + * lookup hash, and then walk the dt_proc_hash_t's notification list + * and remove this dt_proc_t if it is enqueued. */ (void) pthread_mutex_lock(&dph->dph_lock); + (void) dt_proc_lookup(dtp, P, B_TRUE); npp = &dph->dph_notify; for (npr = *npp; npr != NULL; npr = npr->dpr_notify) { diff --git a/usr/src/uts/intel/dtrace/fbt.c b/usr/src/uts/intel/dtrace/fbt.c index 050e8fbca1..3009dc6d88 100644 --- a/usr/src/uts/intel/dtrace/fbt.c +++ b/usr/src/uts/intel/dtrace/fbt.c @@ -206,6 +206,9 @@ fbt_provide_module(void *arg, struct modctl *ctl) for (i = 1; i < nsyms; i++) { uint8_t *instr, *limit; Sym *sym = (Sym *)(symhdr->sh_addr + i * symsize); +#ifdef __amd64 + int j; +#endif if (ELF_ST_TYPE(sym->st_info) != STT_FUNC) continue; @@ -355,6 +358,34 @@ again: instr += size; goto again; } + + /* + * Because we are only looking for a one-byte marker here, + * there is an increased likelihood of erroneously interpreting + * a jump table to be an instrumentable instruction. We + * obviously want to avoid that, so we resort to some heuristic + * sleeze: we'll treat this instruction as being contained + * within a pointer, and see if that pointer points to within + * the body of the function. If it does, we refuse to + * instrument it. + */ + for (j = 0; j < sizeof (uintptr_t); j++) { + uintptr_t check = (uintptr_t)instr - j; + uint8_t *ptr; + + if (check < sym->st_value) + break; + + if (check + sizeof (uintptr_t) > (uintptr_t)limit) + continue; + + ptr = *(uint8_t **)check; + + if (ptr >= (uint8_t *)sym->st_value && ptr < limit) { + instr += size; + goto again; + } + } #else if (!(size == 1 && (*instr == FBT_POPL_EBP || *instr == FBT_LEAVE) && |