2009-11-30 22:40:34

by Alexey Dobriyan

[permalink] [raw]
Subject: [PATCH] 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

Signed-off-by: Alexey Dobriyan <[email protected]>
---

Juho, please, confirm.

kernel/acct.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -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


2009-12-01 14:43:22

by Serge E. Hallyn

[permalink] [raw]
Subject: Re: [PATCH] bsdacct: fix uid/gid misreporting (#14676)

Quoting Alexey Dobriyan ([email protected]):
> 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
>
> Signed-off-by: Alexey Dobriyan <[email protected]>

Yeah seems like it wouuld be needed, thanks.

Acked-by: Serge Hallyn <[email protected]>

> ---
>
> Juho, please, confirm.
>
> kernel/acct.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> --- a/kernel/acct.c
> +++ b/kernel/acct.c
> @@ -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

2009-12-01 15:38:58

by David Howells

[permalink] [raw]
Subject: Re: [PATCH] bsdacct: fix uid/gid misreporting (#14676)

Alexey Dobriyan <[email protected]> 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
>
> Signed-off-by: Alexey Dobriyan <[email protected]>

Acked-by: David Howells <[email protected]>

2009-12-01 17:51:23

by Michal Schmidt

[permalink] [raw]
Subject: Re: [PATCH] bsdacct: fix uid/gid misreporting (#14676)

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
>
> Signed-off-by: Alexey Dobriyan <[email protected]>

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

Reviewed-by: Michal Schmidt <[email protected]>

>
> Juho, please, confirm.
>
> kernel/acct.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> --- a/kernel/acct.c
> +++ b/kernel/acct.c
> @@ -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

2009-12-02 03:50:17

by James Morris

[permalink] [raw]
Subject: Re: [PATCH] bsdacct: fix uid/gid misreporting (#14676)

On Tue, 1 Dec 2009, Michal Schmidt wrote:

> Ah, indeed. The original commit went into 2.6.31-stable so this one
> should too.
>
> Reviewed-by: Michal Schmidt <[email protected]>
>

This should probably go to Linus' tree in akpm's next batch.


--
James Morris
<[email protected]>