Audit: stop deadlock from signals under load
authorEric Paris <eparis@redhat.com>
Fri, 18 Apr 2008 14:11:04 +0000 (10:11 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 28 Apr 2008 10:19:13 +0000 (06:19 -0400)
commitf09ac9db2aafe36fde9ebd63c8c5d776f6e7bd41
treeae2123e2bd6c054d82d5d2a3b81fdfb30c53e46e
parentf3d357b092956959563398b59ef2fdd10aea387d
Audit: stop deadlock from signals under load

A deadlock is possible between kauditd and auditd under load if auditd
receives a signal.  When auditd receives a signal it sends a netlink
message to the kernel asking for information about the sender of the
signal.  In that same context the audit system will attempt to send a
netlink message back to the userspace auditd.  If kauditd has already
filled the socket buffer (see netlink_attachskb()) auditd will now put
itself to sleep waiting for room to send the message.  Since auditd is
responsible for draining that socket we have a deadlock.  The fix, since
the response from the kernel does not need to be synchronous is to send
the signal information back to auditd in a separate thread.  And thus
auditd can continue to drain the audit queue normally.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
kernel/audit.c