Question about the function do_fork() and kernel_lock()

Oliver Stecklina (stecklina@secunet.de)
Thu, 25 Nov 1999 16:01:28 +0100


Hi

I'm writing a kernel-extention in order to include an audit-mechanism into the
linux-kernel. The goal is to get an audit-mechnismus like bsm on a
solaris-system. In this moment I'm working on a filter, to reduce the mass of
audit-data. For this I have to set an entry in all tasks.

My problem is, that a fork can happen in this moment, when I set the entries
and I forget this new one. Ok this can only happen on a SMP-Machine. But the
problem exists and I can't ignore it. If I understand the kernel_lock()
function right, it is used to ensure that only one function is running and all
other proccessors wait for this time. That means either my set-function is
running or the fork.

Now my question. The do_fork() function locks the kernel after the copy of
current-task. Why after? Can I inverte it, that the kernel is locked before the
task is copied. In this case my function can't forget this new entry. Either it
isn't exist or it is in the task-queue and I get it with the for_each_task
macro.

Thanx for answer

--
Oliver Stecklina
<stecklina@secunet.de>

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