lkml.org 
[lkml]   [2010]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectReplacing kernel functions - kernel symtab
From
Hi

I am working on a module which provides dynamic instrumentation for
some of the kernel
functions. My module is not ready yet from dynamic instrumentation perspective.

In order to test basic functionality, I am planning to hijack calls
like kmalloc in order to provide
some profiling information. I was thinking of replacing the symbols in
the kernel symbol table
just for testing purposes. I know this is not a clean approach.

Would it possible to replace kmalloc with my_kmalloc in my modules
init function? This way, after
my module is loaded all mallocs are routed to my module. What could go
wrong here? Logically,
this is just point replacement in symtab which should be atomic, right?

Is there any other way to trap calls like kmalloc without making
changes in mm subsystem or compiling
kernel/rebooting? In user space we have multiple options like usage of
LD_PRELOAD etc, are there
any loading time tricks which we can use in kernel space?



-Leo.


\
 
 \ /
  Last update: 2010-03-03 18:21    [W:0.025 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site