Monday, April 23, 2012

debug trace in kernel

Recently I've patched do_fork() and need in some trace debug during fork(). But every process in linux starts with do_fork(), so I had tons of traces.
Found solution in the "Linux Kernel Development"  by R. Love. But it was a little bit old, because all credentials move to cred structure. So I have user default with UID 1000 (busybox linux) and need to trace during fork only for him

if(current->cred->uid == 1000) {
pr_warn("%s(): some traces here\n", __func__);
}

Not so smart solution, but it works every time.

No comments:

Post a Comment