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 /usr/src/uts/intel/dtrace/fbt.c | |
parent | 52b2f68ad911d527af0cd3152af81e314ff9f0c1 (diff) | |
download | illumos-joyent-b365acd0c29cb0376af78f1f0662459a9d216641.tar.gz |
usr/src/lib/libdtrace/common/dt_options.c
usr/src/lib/libdtrace/common/dt_proc.c
usr/src/uts/intel/dtrace/fbt.c
Diffstat (limited to 'usr/src/uts/intel/dtrace/fbt.c')
-rw-r--r-- | usr/src/uts/intel/dtrace/fbt.c | 31 |
1 files changed, 31 insertions, 0 deletions
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) && |