I working on a Linux kernel project. In my project I modified the kernel so that copy_process
is called from one of my modules that responds to writes to a proc file entry. In essence, things look liks:
int procfile_write(struct file *file, const char *buffer, unsigned long count,
void *data)
{
//...more code
copy_process(...);
//...more code
}
int init_module()
{
/* create the /proc file */
Our_Proc_File = create_proc_entry(PROCFS_NAME, 0644, NULL);
// more code
Our_Proc_File->write_proc = procfile_write;
return 0; /* everything is ok */
}
My problem is that the kernel hangs inside copy_process
when it hits the line:
write_lock_irq(&tasklist_lock);
Now, I know this function is being called all the time from do_fork
. Which happens inside a system call.
My questions:
- Am I on the right path thinking this has to do with writing to a proc file entry vs system calls?
- What IRQs have to do with writing to proc file entries?
- Is writing to a proc file entry actually different from a system call? I mean in the way it is handled and in the context it is invoked?
Thank you!
UPDATE: I converted the way my code is called from being called while handling a write to a proc file to being called from a system call. Nothing changed. Still hangs when getting to the same line (i.e. locking tasklist_lock). Now, my problem is why it hangs there? and how to fix this issue?