Commit f8f3d4de2d04e1a5b4293b67faee8ebabc64e9fa

Authored by Eric W. Biederman
1 parent 4bd6e32ace

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>

Showing 2 changed files with 2 additions and 3 deletions Side-by-side Diff

... ... @@ -931,7 +931,6 @@
931 931 depends on FS_POSIX_ACL = n
932 932 depends on QUOTA = n
933 933 depends on QUOTACTL = n
934   - depends on BSD_PROCESS_ACCT = n
935 934  
936 935 # Networking
937 936 depends on NET_9P = n
... ... @@ -507,8 +507,8 @@
507 507 do_div(elapsed, AHZ);
508 508 ac.ac_btime = get_seconds() - elapsed;
509 509 /* we really need to bite the bullet and change layout */
510   - ac.ac_uid = orig_cred->uid;
511   - ac.ac_gid = orig_cred->gid;
  510 + ac.ac_uid = from_kuid_munged(file->f_cred->user_ns, orig_cred->uid);
  511 + ac.ac_gid = from_kgid_munged(file->f_cred->user_ns, orig_cred->gid);
512 512 #if ACCT_VERSION==2
513 513 ac.ac_ahz = AHZ;
514 514 #endif