summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-09-10 23:20:20 -0700
committerEric W. Biederman <ebiederm@xmission.com>2012-09-17 17:38:42 -0700
commit34e36d8ecbd958bc15f8e63deade1227de337eb1 (patch)
tree2b6f98480e7a035c2910e39d68ca1ff453a98f89 /kernel
parentc6089735e7243a10faad676680c6e18d50959f74 (diff)
downloadop-kernel-dev-34e36d8ecbd958bc15f8e63deade1227de337eb1.zip
op-kernel-dev-34e36d8ecbd958bc15f8e63deade1227de337eb1.tar.gz
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 ea3b7b6..7b7268e 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -61,6 +61,7 @@
#include <linux/netlink.h>
#include <linux/freezer.h>
#include <linux/tty.h>
+#include <linux/pid_namespace.h>
#include "audit.h"
@@ -588,6 +589,11 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type)
{
int err = 0;
+ /* Only support the initial namespaces for now. */
+ if ((current_user_ns() != &init_user_ns) ||
+ (task_active_pid_ns(current) != &init_pid_ns))
+ return -EPERM;
+
switch (msg_type) {
case AUDIT_GET:
case AUDIT_LIST:
OpenPOWER on IntegriCloud