aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-09-11 02:20:20 -0400
committerEric W. Biederman <ebiederm@xmission.com>2012-09-17 20:38:42 -0400
commit34e36d8ecbd958bc15f8e63deade1227de337eb1 (patch)
tree2b6f98480e7a035c2910e39d68ca1ff453a98f89 /kernel
parentc6089735e7243a10faad676680c6e18d50959f74 (diff)
audit: Limit audit requests to processes in the initial pid and user namespaces.
This allows the code to safely make the assumption that all of the uids gids and pids that need to be send in audit messages are in the initial namespaces. If someone cares we may lift this restriction someday but start with limiting access so at least the code is always correct. Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Eric Paris <eparis@redhat.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/audit.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index ea3b7b6191c7..7b7268e3073b 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -61,6 +61,7 @@
61#include <linux/netlink.h> 61#include <linux/netlink.h>
62#include <linux/freezer.h> 62#include <linux/freezer.h>
63#include <linux/tty.h> 63#include <linux/tty.h>
64#include <linux/pid_namespace.h>
64 65
65#include "audit.h" 66#include "audit.h"
66 67
@@ -588,6 +589,11 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type)
588{ 589{
589 int err = 0; 590 int err = 0;
590 591
592 /* Only support the initial namespaces for now. */
593 if ((current_user_ns() != &init_user_ns) ||
594 (task_active_pid_ns(current) != &init_pid_ns))
595 return -EPERM;
596
591 switch (msg_type) { 597 switch (msg_type) {
592 case AUDIT_GET: 598 case AUDIT_GET:
593 case AUDIT_LIST: 599 case AUDIT_LIST: