Re: acct_file_reopen() && do_acct_process() (Was: [PATCH 0/3] extendget/setrlimit to support setting rlimits external to a process (v7))

From: Jiri Slaby
Date: Fri Nov 20 2009 - 05:27:55 EST


On 11/20/2009 03:11 AM, Oleg Nesterov wrote:
> Hmm. you are right. Do you know why acct_file_reopen() does
>
> if (old_acct)
> do_acct_process();
>
> ???
>
> This looks just strange. What is the point ? If the caller doesn't
> exit, we shouldn't account it?

I have no idea. I just checked free and net bsds and they record only
exiting tasks. Maybe someone added it to record the process which
disabled the acct (last entry). Dunno.

> And this is just wrong, no? Even if we forget about rlim, since
> do_acct_process() does override_creds() + revert_creds(), any
> __task_cred() in between is fooled?
>
> Probably I greatly misread something in acct.c, otherwise I can't
> see why, say, mntput() should ever record the caller in acct file.

>From how I understand the code, it is the last mntput before the fs gets
unmounted. It's to close the acct file. But I don't understand why it
accounts.

> IOW: could someone explain why the patch below is wrong?

For me, it makes sense. But that's not important ;).

> --- a/kernel/acct.c
> +++ b/kernel/acct.c
> @@ -206,7 +206,6 @@ static void acct_file_reopen(struct bsd_
> if (old_acct) {
> mnt_unpin(old_acct->f_path.mnt);
> spin_unlock(&acct_lock);
> - do_acct_process(acct, old_ns, old_acct);
> filp_close(old_acct, NULL);
> spin_lock(&acct_lock);

thanks,
--
js
Faculty of Informatics, Masaryk University
Suse Labs, Novell
--
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/