netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Audit vs netlink interaction problem
@ 2008-03-14 16:22 Pavel Emelyanov
  2008-03-14 16:39 ` Thomas Graf
  0 siblings, 1 reply; 8+ messages in thread
From: Pavel Emelyanov @ 2008-03-14 16:22 UTC (permalink / raw)
  To: David Woodhouse, Linux Kernel Mailing List, Linux Netdev List

Hi, David!

I've found an interesting feature of how audit uses netlink for
communications. Look.

The kauditd_thread() calls netlink_unicast() and passes the 
audit_pid to it. The audit_pid, in turn, is received from the 
user space and the tool (I've checked the audit v1.6.9) uses 
getpid() to pass one in the kernel. Besides, this tool doesn't
bind the netlink socket to this id, but simply creates it 
allowing the kernel to auto-bind one.

That's the preamble.

The problem is that netlink_autobind() _does_not_ guarantees
that the socket will be auto-binded to the current pid. Instead
it uses the current pid as a hint to start looking for a free
id. So, in case of conflict, the audit messages can be sent
to a wrong socket. This can happen (it's unlikely, but can be)
in case some task opens more than one netlink sockets and then
the audit one starts - in this case the audit's pid can be busy
and its socket will be bound to another id.

The reason I raised this problem is that I'm now working on pid 
and network namespaces and found, that this problem doesn't
allow to resolve the following issue gracefully.

The task_struct->tgid field, which is currently used in netlink
for auto-binding, is going to be deprecated. Thus I have to make 
netlink auto-binding play another rules when selecting a pid, 
but this will break the audit work for sure, since it implicitly 
relies, that the netlink socket will be bound to the current 
task pid.

What do you think about it?

Thanks,
Pavel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-03-17 19:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-14 16:22 Audit vs netlink interaction problem Pavel Emelyanov
2008-03-14 16:39 ` Thomas Graf
2008-03-14 17:05   ` Pavel Emelyanov
2008-03-14 18:29     ` Thomas Graf
2008-03-14 18:40       ` Thomas Graf
2008-03-17  8:01         ` Pavel Emelyanov
2008-03-17 19:41           ` Eric Paris
2008-03-17  7:59       ` Pavel Emelyanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).