lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091120021102.GA5603@redhat.com>
Date:	Fri, 20 Nov 2009 03:11:02 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Jiri Slaby <jirislaby@...il.com>
Cc:	Ingo Molnar <mingo@...e.hu>, Neil Horman <nhorman@...driver.com>,
	Stephen Rothwell <sfr@...b.auug.org.au>,
	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	marcin.slusarz@...il.com, tglx@...utronix.de, mingo@...hat.com,
	hpa@...or.com, Linus Torvalds <torvalds@...ux-foundation.org>
Subject: acct_file_reopen() && do_acct_process() (Was: [PATCH 0/3] extend
	get/setrlimit to support setting rlimits external to a process (v7))

On 11/19, Jiri Slaby wrote:
>
> On 11/19/2009 12:15 AM, Oleg Nesterov wrote:
> > On 11/18, Jiri Slaby wrote:
> >>
> >> kernel/acct.c:
> >>         /*
> >>          * Accounting records are not subject to resource limits.
> >>          */
> >>         flim = current->signal->rlim[RLIMIT_FSIZE].rlim_cur;
> >>         current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
> >>         file->f_op->write(file, (char *)&ac,
> >>                                sizeof(acct_t), &file->f_pos);
> >>         current->signal->rlim[RLIMIT_FSIZE].rlim_cur = flim;
> >>
> >> It means that threads of the process with PACCT caps have unlimited file
> >> size for a short while. If there is setrlimit in between, it gets wiped
> >> out as well.
> >
> > This is called when the whole thread-group exits, there are no
> > live threads except current.
>
> Not really, it is called from umount, sys_acct and other paths.

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?

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.

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

Oleg.

--- 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);
 	}

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ