Commit f8f3d4de authored by Eric W. Biederman's avatar Eric W. Biederman

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: default avatarSerge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent 4bd6e32a
...@@ -931,7 +931,6 @@ config UIDGID_CONVERTED ...@@ -931,7 +931,6 @@ config UIDGID_CONVERTED
depends on FS_POSIX_ACL = n depends on FS_POSIX_ACL = n
depends on QUOTA = n depends on QUOTA = n
depends on QUOTACTL = n depends on QUOTACTL = n
depends on BSD_PROCESS_ACCT = n
# Networking # Networking
depends on NET_9P = n depends on NET_9P = n
......
...@@ -507,8 +507,8 @@ static void do_acct_process(struct bsd_acct_struct *acct, ...@@ -507,8 +507,8 @@ static void do_acct_process(struct bsd_acct_struct *acct,
do_div(elapsed, AHZ); do_div(elapsed, AHZ);
ac.ac_btime = get_seconds() - elapsed; ac.ac_btime = get_seconds() - elapsed;
/* we really need to bite the bullet and change layout */ /* we really need to bite the bullet and change layout */
ac.ac_uid = orig_cred->uid; ac.ac_uid = from_kuid_munged(file->f_cred->user_ns, orig_cred->uid);
ac.ac_gid = orig_cred->gid; ac.ac_gid = from_kgid_munged(file->f_cred->user_ns, orig_cred->gid);
#if ACCT_VERSION==2 #if ACCT_VERSION==2
ac.ac_ahz = AHZ; ac.ac_ahz = AHZ;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment