summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-02-07 16:54:50 -0800
committerEric W. Biederman <ebiederm@xmission.com>2012-09-18 01:01:33 -0700
commitf8f3d4de2d04e1a5b4293b67faee8ebabc64e9fa (patch)
treea099887284cba6d43994713cbc4ec356357fef65
parent4bd6e32acec66c55c6c1af4672f3216b2ac88e35 (diff)
downloadlinux-f8f3d4de2d04e1a5b4293b67faee8ebabc64e9fa.tar.bz2
userns: Convert bsd process accounting to use kuid and kgid where appropriate
BSD process accounting conveniently passes the file the accounting records will be written into to do_acct_process. The file credentials captured the user namespace of the opener of the file. Use the file credentials to format the uid and the gid of the current process into the user namespace of the user that started the bsd process accounting. Cc: Pavel Emelyanov <xemul@openvz.org> Reviewed-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
-rw-r--r--init/Kconfig1
-rw-r--r--kernel/acct.c4
2 files changed, 2 insertions, 3 deletions
diff --git a/init/Kconfig b/init/Kconfig
index f0f636cf0ce7..6de46ef12e3f 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -931,7 +931,6 @@ config UIDGID_CONVERTED
depends on FS_POSIX_ACL = n
depends on QUOTA = n
depends on QUOTACTL = n
- depends on BSD_PROCESS_ACCT = n
# Networking
depends on NET_9P = n
diff --git a/kernel/acct.c b/kernel/acct.c
index 02e6167a53b0..6cd7529c9e6a 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -507,8 +507,8 @@ static void do_acct_process(struct bsd_acct_struct *acct,
do_div(elapsed, AHZ);
ac.ac_btime = get_seconds() - elapsed;
/* we really need to bite the bullet and change layout */
- ac.ac_uid = orig_cred->uid;
- ac.ac_gid = orig_cred->gid;
+ ac.ac_uid = from_kuid_munged(file->f_cred->user_ns, orig_cred->uid);
+ ac.ac_gid = from_kgid_munged(file->f_cred->user_ns, orig_cred->gid);
#if ACCT_VERSION==2
ac.ac_ahz = AHZ;
#endif