Re: [PATCH 2.6.9] fork: add a hook in do_fork()

From: Guillaume Thouvenin
Date: Wed Nov 24 2004 - 03:19:56 EST


On Tue, 2004-11-23 at 13:51 -0800, Chris Wright wrote:
> * Guillaume Thouvenin (Guillaume.Thouvenin@xxxxxxxx) wrote:
> > static int elsa_task_alloc_security(struct task_struct *p)
> > {
> > printk(KERN_ALERT "intercept a fork: %d created by %d\n",
> > p->pid, p->parent->pid);
>
> It's created by current. So, current->pid. p is not completely setup
> yet, and is still largely duplication of current from dup_task_struct().

I see. Thus the correct answer is: process pointed by "current" is the
parent of the process pointed by "p" when elsa_task_alloc_security() is
called.

> And, IIRC, elsa is accounting related.
> LSM is not the right framework, you should be using something like PAGG
> or CKRM.

I understand your point of view. Elsa is accounting related that's true
but I'm trying to provide a solution without modifying the Linux kernel
tree. To achieve this I just need a hook in the fork to be inform when a
process creates a child. LSM hook does the trick and it is already in
the kernel. That's why I use the LSM hook (and I'm waiting to see PAGG
or CKRM in the Linux kernel).

Thanks,
Guillaume

-
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/