How to duplicate arbitrary process via an LKM

From: Curtis Taylor
Date: Thu Sep 19 2013 - 10:26:25 EST


Hello all,

I'm wondering if it's possible to create an LKM that can take an arbitrary
process, removes it from the run queue, duplicates it, and re-runs it with
it's new PID. I would like to see the functionality of a simple user space
fork() but I don't want to edit the application's source code.

I'm new to writing kernel code and after looking at a kernel dev book, it
looks like the system calls clone or do_fork would be what I would leverage
for this. The problem is that clone expects some user space data data in
order to work, but maybe it's possible I could look at the task struct and
figure out everything I need?

Please 'cc' me with responses as I'm not on the mailing list.

Thanks in advance!


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/