bsdacct: switch credentials for writing to the accounting file
commit0d4b093b89cf8aab0d478e6545c078a5dc08f73d
authorMichal Schmidt <mschmidt@redhat.com>
Thu, 20 Aug 2009 21:39:52 +0000 (20 14:39 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 22 Oct 2009 22:11:59 +0000 (22 15:11 -0700)
tree40e8a5a9aaac39382af9c2d70a195f2bf6a7704f
parent6a56395fa727528beb92ffe3b126068894fb7893
bsdacct: switch credentials for writing to the accounting file

commit d8e180dcd5bbbab9cd3ff2e779efcf70692ef541 upstream.

When process accounting is enabled, every exiting process writes a log to
the account file.  In addition, every once in a while one of the exiting
processes checks whether there's enough free space for the log.

SELinux policy may or may not allow the exiting process to stat the fs.
So unsuspecting processes start generating AVC denials just because
someone enabled process accounting.

For these filesystem operations, the exiting process's credentials should
be temporarily switched to that of the process which enabled accounting,
because it's really that process which wanted to have the accounting
information logged.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Morris <jmorris@namei.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/acct.c