Skip to contentSkip to conversation

bsdacct: fix uid/gid misreporting (#14676)

PATCH In review Alexey Dobriyan 5 participants 5 messages Nov 30, 2009 – Dec 2, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bsdacct: fix uid/gid misreporting (#14676)

commit d8e180dcd5bbbab9cd3ff2e779efcf70692ef541 "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.

Fix http://bugzilla.kernel.org/show_bug.cgi?id=14676

---

Juho, please, confirm.

 kernel/acct.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/acct.c +2 -1
@@ -536,7 +536,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 */
-	current_uid_gid(&ac.ac_uid, &ac.ac_gid);
+	ac.ac_uid = orig_cred->uid;
+	ac.ac_gid = orig_cred->gid;
 #if ACCT_VERSION==2
 	ac.ac_ahz = AHZ;
 #endif
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Alexey Dobriyan

commit d8e180dcd5bbbab9cd3ff2e779efcf70692ef541 "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.

Fix http://bugzilla.kernel.org/show_bug.cgi?id=14676

Yeah seems like it wouuld be needed, thanks.

Quoted 19 lines

---

Juho, please, confirm.

 kernel/acct.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/acct.c +2 -1
@@ -536,7 +536,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 */
-	current_uid_gid(&ac.ac_uid, &ac.ac_gid);
+	ac.ac_uid = orig_cred->uid;
+	ac.ac_gid = orig_cred->gid;
 #if ACCT_VERSION==2
 	ac.ac_ahz = AHZ;
 #endif
Acked-by on v1 1/1
#2 lore raw
In reply to Alexey Dobriyan
Quoted 9 lines · Alexey Dobriyan

commit d8e180dcd5bbbab9cd3ff2e779efcf70692ef541 "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.

Fix http://bugzilla.kernel.org/show_bug.cgi?id=14676

Reviewed-by on v1 1/1
#3 lore raw
In reply to Alexey Dobriyan
Quoted 9 lines · On Tue, 1 Dec 2009 01:40:32 +0300 Alexey Dobriyan wrote:

commit d8e180dcd5bbbab9cd3ff2e779efcf70692ef541 "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.

Fix http://bugzilla.kernel.org/show_bug.cgi?id=14676

Ah, indeed. The original commit went into 2.6.31-stable so this one should too.

Quoted 18 lines

Juho, please, confirm.

 kernel/acct.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/acct.c +2 -1
@@ -536,7 +536,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 */
-	current_uid_gid(&ac.ac_uid, &ac.ac_gid);
+	ac.ac_uid = orig_cred->uid;
+	ac.ac_gid = orig_cred->gid;
 #if ACCT_VERSION==2
 	ac.ac_ahz = AHZ;
 #endif