Re: [PATCH] bsdacct: switch credentials for writing to the accounting file

From: David Howells
Date: Thu Aug 20 2009 - 06:02:17 EST


Michal Schmidt <mschmidt@xxxxxxxxxx> wrote:

> 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 who wanted to have the
> accounting information logged.
>
> Signed-off-by: Michal Schmidt <mschmidt@xxxxxxxxxx>

Do you really need to keep creds in acct? Can you used acct->file->f_cred
instead? Those are the credentials of the process that opened the file, so
acct->cred may be redundant.

Other than that, it looks reasonable.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/