aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/audit.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-05-22 01:09:24 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2006-06-20 05:25:20 -0400
commit9044e6bca5a4a575d3c068dfccb5651a2d6a13bc (patch)
treee0fa2beb83c3ef4e52cc6c6b28ce3173656f4276 /kernel/audit.h
parentbc0f3b8ebba611291fdaa2864dbffd2d29336c64 (diff)
[PATCH] fix deadlocks in AUDIT_LIST/AUDIT_LIST_RULES
We should not send a pile of replies while holding audit_netlink_mutex since we hold the same mutex when we receive commands. As the result, we can get blocked while sending and sit there holding the mutex while auditctl is unable to send the next command and get around to receiving what we'd sent. Solution: create skb and put them into a queue instead of sending; once we are done, send what we've got on the list. The former can be done synchronously while we are handling AUDIT_LIST or AUDIT_LIST_RULES; we are holding audit_netlink_mutex at that point. The latter is done asynchronously and without messing with audit_netlink_mutex. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/audit.h')
-rw-r--r--kernel/audit.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/audit.h b/kernel/audit.h
index 6f733920fd32..8948fc1e9e54 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -22,6 +22,7 @@
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/fs.h> 23#include <linux/fs.h>
24#include <linux/audit.h> 24#include <linux/audit.h>
25#include <linux/skbuff.h>
25 26
26/* 0 = no checking 27/* 0 = no checking
27 1 = put_count checking 28 1 = put_count checking
@@ -82,6 +83,9 @@ struct audit_entry {
82extern int audit_pid; 83extern int audit_pid;
83extern int audit_comparator(const u32 left, const u32 op, const u32 right); 84extern int audit_comparator(const u32 left, const u32 op, const u32 right);
84 85
86extern struct sk_buff * audit_make_reply(int pid, int seq, int type,
87 int done, int multi,
88 void *payload, int size);
85extern void audit_send_reply(int pid, int seq, int type, 89extern void audit_send_reply(int pid, int seq, int type,
86 int done, int multi, 90 int done, int multi,
87 void *payload, int size); 91 void *payload, int size);
@@ -89,4 +93,11 @@ extern void audit_log_lost(const char *message);
89extern void audit_panic(const char *message); 93extern void audit_panic(const char *message);
90extern struct mutex audit_netlink_mutex; 94extern struct mutex audit_netlink_mutex;
91 95
96struct audit_netlink_list {
97 int pid;
98 struct sk_buff_head q;
99};
100
101int audit_send_list(void *);
102
92extern int selinux_audit_rule_update(void); 103extern int selinux_audit_rule_update(void);