diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2014-02-28 13:49:05 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2014-03-20 10:10:53 -0400 |
commit | 638a0fd2a062568c568661be0a780be8e8836d03 (patch) | |
tree | e250ef6ef5ddf0ff6c189362b5e125c3a7bc402e /kernel/auditfilter.c | |
parent | 3f1c82502c299da08b7b7f08b435212e51166ed9 (diff) |
audit: Use struct net not pid_t to remember the network namespce to reply in
While reading through 3.14-rc1 I found a pretty siginficant mishandling
of network namespaces in the recent audit changes.
In struct audit_netlink_list and audit_reply add a reference to the
network namespace of the caller and remove the userspace pid of the
caller. This cleanly remembers the callers network namespace, and
removes a huge class of races and nasty failure modes that can occur
when attempting to relook up the callers network namespace from a pid_t
(including the caller's network namespace changing, pid wraparound, and
the pid simply not being present).
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'kernel/auditfilter.c')
-rw-r--r-- | kernel/auditfilter.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index 3152d1aea164..a0d470131fd0 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/security.h> | 33 | #include <linux/security.h> |
34 | #include <net/net_namespace.h> | ||
34 | #include "audit.h" | 35 | #include "audit.h" |
35 | 36 | ||
36 | /* | 37 | /* |
@@ -1085,8 +1086,8 @@ int audit_list_rules_send(__u32 portid, int seq) | |||
1085 | dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL); | 1086 | dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL); |
1086 | if (!dest) | 1087 | if (!dest) |
1087 | return -ENOMEM; | 1088 | return -ENOMEM; |
1089 | dest->net = get_net(current->nsproxy->net_ns); | ||
1088 | dest->portid = portid; | 1090 | dest->portid = portid; |
1089 | dest->pid = task_pid_vnr(current); | ||
1090 | skb_queue_head_init(&dest->q); | 1091 | skb_queue_head_init(&dest->q); |
1091 | 1092 | ||
1092 | mutex_lock(&audit_filter_mutex); | 1093 | mutex_lock(&audit_filter_mutex); |