It's easier to create in interposer library which will look somewhat like this:
/* * pthread_mutex_lock -- intercept pthread_mutex_lock */ int pthread_mutex_lock(pthread_mutex_t *mutex){ static void *actual_pthread_mutex_lock = NULL; if (actual_pthread_mutex_lock == NULL) { actual_pthread_mutex_lock = dlsym(RTLD_NEXT, "pthread_mutex_lock"); assert(actual_pthread_mutex_lock != NULL); } return ((int (*)(pthread_mutex_t *)) actual_pthread_mutex_lock)(mutex); } This is nominally limited to user-space, but can happily generate all the errors you'd ever want (;-)) You can do the same thing for kernel modules, by inserting a module with the error injection code in front of a hacked regular module. --dave Robert Milkowski <mi...@task.gda.pl> writes > Hello Jonathan, > > Saturday, May 30, 2009, 12:11:58 AM, you wrote: > > JA> On Sat, May 30, 2009 at 12:04:50AM +0200, Pavel Filipensky wrote: >>> Hi, >>> >>> is it somehow possible to use Dtrace for error injection in a kernel module? >>> >>> Something like changing: >>> - function return value >>> - value of a register >>> >>> If not, can it be implemented? > > JA> No; it violates the basic safety constraints of dtrace(1M). > > I don't know... it allows to change some things like n structure in > user space which is filled in in kernel by syscall, but then doesn't > allow to change an return code. What I'm trying to say is that it > already allows to shoot yourself in foot or fix rather help you (like > changing uname output being a classic example now) but doesn't allow > you to do so with other cases... > > I think it would be very useful if it wuld allow to assign values to > argN (args[N}). > -- David Collier-Brown | Always do right. This will gratify Sun Microsystems, Toronto | some people and astonish the rest dav...@sun.com | -- Mark Twain cell: (647) 833-9377, home (416) 223-8968, bridge (877) 385-4099 code 506 9191# _______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org