why the funny kernel always crashes ?

Submitted by gazolinia
on May 27, 2010 - 1:50pm

Hi,

Since 2.6.18 and above kernel not exporting symbol table and tasklist_lock , I have patched the vanilla kernel to export them manually. Now I am rewriting the fork method , My code compiles fine and works properly for a program which has single fork, when program calls repeatedly called fork without latency , my system crashes , I am sure that the code breaks within the list loop .My pseudo code is as follows

asmlinkage int my_fork(struct pt_regs regs)
{
int ret;

ret = call_original_fork(fork_saved, regs);
if (ret > 0) {
struct list_head *this,*next;
struct task_struct *child_task= NULL;
lock_kernel();
read_lock(&tasklist_lock);

list_for_each_safe(this, next, &current->children) {
child_task = list_entry(this, struct task_struct, sibling);
if (child_task->pid == ret) {
/* This guy is still running, even though it got waited? */
printkDEBUG("Yes we found a match\n");
break;
}
}
unlock_kernel();
read_unlock(&tasklist_lock);
return ret;
}

Please let us know if you need any more info. I have updated this on linux forum, once I get updates there, sure I will share here .

Thanks in Advance,
Jai