Re: [PATCH] Process Events Connector

From: Matt Helsley
Date: Fri Oct 28 2005 - 05:24:20 EST


On Fri, 2005-10-28 at 11:19 +0200, Arjan van de Ven wrote:
> On Fri, 2005-10-28 at 01:55 -0700, Matt Helsley wrote:
>
> > +void proc_fork_connector(struct task_struct *task)
> > +{
> > + struct cn_msg *msg;
> > + struct proc_event *ev;
> > + __u8 buffer[CN_PROC_MSG_SIZE];
>
> do you really want to do this stack based?

cn_netlink_send() performs an skb_alloc() and I wanted to avoid doing
two allocations that might sleep.

On a 32-bit machine the buffer should be around 42 bytes, making the
function locals around 50 bytes. On a 64-bit machine I believe this
should be around 58 bytes. Is this generally considered to be too large?

These functions are called from:

fork:

-> do_fork -> copy_process -> proc_fork_connector -> ...
-> fork_idle (this holds a struct ptregs) -> copy_process ->
proc_fork_connector -> ...

exec:

-> do_execve -> search_binary_handler -> proc_exec_connector -> ...

id:

-> sys_set(r|e|s|fs)?[ug]id -> proc_id_connector -> ...

exit:

-> do_exit -> proc_exit_connector -> ...

Where "-> ..." signifies a call to cn_netlink_send(). So they should
only be a problem if a caller or cn_netlink_send() use too much stack
space.

Cheers,
-Matt Helsley
< matthltc @ us.ibm.com >

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