Skip to content

Commit 4b731d5

Browse files
Alexey Dobriyantorvalds
authored andcommitted
bsdacct: fix uid/gid misreporting
commit d8e180d "bsdacct: switch credentials for writing to the accounting file" introduced credential switching during final acct data collecting. However, uid/gid pair continued to be collected from current which became credentials of who created acct file, not who exits. Addresses http://bugzilla.kernel.org/show_bug.cgi?id=14676 Signed-off-by: Alexey Dobriyan <[email protected]> Reported-by: Juho K. Juopperi <[email protected]> Acked-by: Serge Hallyn <[email protected]> Acked-by: David Howells <[email protected]> Reviewed-by: Michal Schmidt <[email protected]> Cc: James Morris <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 5443040 commit 4b731d5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/acct.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,8 @@ static void do_acct_process(struct bsd_acct_struct *acct,
536536
do_div(elapsed, AHZ);
537537
ac.ac_btime = get_seconds() - elapsed;
538538
/* we really need to bite the bullet and change layout */
539-
current_uid_gid(&ac.ac_uid, &ac.ac_gid);
539+
ac.ac_uid = orig_cred->uid;
540+
ac.ac_gid = orig_cred->gid;
540541
#if ACCT_VERSION==2
541542
ac.ac_ahz = AHZ;
542543
#endif

0 commit comments

Comments
 (0)