I have written a kernel module and tested it in qemu. In general, it's ok to run. However, after long-term execution, the kernel might abort. The printed call trace is very wired where the addresses of called functioned aren't sequential.<ffffffffc0725fa5>, <ffffffffc0497e69>, <ffffffffc048953f>, <ffffffff9fc35cfc>, <ffffffffc0729f3e>, <ffffffffa01c539a>
In my opinion, the addresses should be ascending.
On the other hand, I can't understand the whole call trace. There is even an uncalled function in the call trace. The entry is tamperhack_write
which then calls kmem_cache_alloc_trace
(but why? It doesn't call this function). The abort appears in kmem_cache_alloc_trace
. With so, why tamperhack_write
can still go on and call the user-defined tamper_is_safe_filename
?
Update:
The biggest confusion is why the kernel aborts on kmem_cache_alloc_trace
which I have never explicitly called in user-defined functions tamperhack_write
and tamper_is_safe_filename
. However, there are kmalloc
and kfree
in my code.