diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-02-07 19:53:48 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-09-18 04:00:26 -0400 |
commit | cca080d9b622094831672a136e5ee4f702d116b1 (patch) | |
tree | 7a8238c1c0a0d4de682e0ebb97dc06ab3a18fdb5 /drivers/tty | |
parent | e1760bd5ffae8cb98cffb030ee8e631eba28f3d8 (diff) |
userns: Convert audit to work with user namespaces enabled
- Explicitly format uids gids in audit messges in the initial user
namespace. This is safe because auditd is restrected to be in
the initial user namespace.
- Convert audit_sig_uid into a kuid_t.
- Enable building the audit code and user namespaces at the same time.
The net result is that the audit subsystem now uses kuid_t and kgid_t whenever
possible making it almost impossible to confuse a raw uid_t with a kuid_t
preventing bugs.
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Eric Paris <eparis@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/tty_audit.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c index 5b59bd7f4227..b0b39b823ccf 100644 --- a/drivers/tty/tty_audit.c +++ b/drivers/tty/tty_audit.c | |||
@@ -69,11 +69,12 @@ static void tty_audit_log(const char *description, struct task_struct *tsk, | |||
69 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY); | 69 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY); |
70 | if (ab) { | 70 | if (ab) { |
71 | char name[sizeof(tsk->comm)]; | 71 | char name[sizeof(tsk->comm)]; |
72 | uid_t uid = task_uid(tsk); | 72 | kuid_t uid = task_uid(tsk); |
73 | 73 | ||
74 | audit_log_format(ab, "%s pid=%u uid=%u auid=%u ses=%u " | 74 | audit_log_format(ab, "%s pid=%u uid=%u auid=%u ses=%u " |
75 | "major=%d minor=%d comm=", description, | 75 | "major=%d minor=%d comm=", description, |
76 | tsk->pid, uid, | 76 | tsk->pid, |
77 | from_kuid(&init_user_ns, uid), | ||
77 | from_kuid(&init_user_ns, loginuid), | 78 | from_kuid(&init_user_ns, loginuid), |
78 | sessionid, | 79 | sessionid, |
79 | major, minor); | 80 | major, minor); |