<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/kernel/acct.c, branch v3.18.121</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.18.121</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.18.121'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2018-01-17T08:29:26Z</updated>
<entry>
<title>kernel/acct.c: fix the acct-&gt;needcheck check in check_free_space()</title>
<updated>2018-01-17T08:29:26Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2018-01-05T00:17:49Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7bf407cadd10b7811c7cf76997b1afaedaaf4393'/>
<id>urn:sha1:7bf407cadd10b7811c7cf76997b1afaedaaf4393</id>
<content type='text'>
commit 4d9570158b6260f449e317a5f9ed030c2504a615 upstream.

As Tsukada explains, the time_is_before_jiffies(acct-&gt;needcheck) check
is very wrong, we need time_is_after_jiffies() to make sys_acct() work.

Ignoring the overflows, the code should "goto out" if needcheck &gt;
jiffies, while currently it checks "needcheck &lt; jiffies" and thus in the
likely case check_free_space() does nothing until jiffies overflow.

In particular this means that sys_acct() is simply broken, acct_on()
sets acct-&gt;needcheck = jiffies and expects that check_free_space()
should set acct-&gt;active = 1 after the free-space check, but this won't
happen if jiffies increments in between.

This was broken by commit 32dc73086015 ("get rid of timer in
kern/acct.c") in 2011, then another (correct) commit 795a2f22a8ea
("acct() should honour the limits from the very beginning") made the
problem more visible.

Link: http://lkml.kernel.org/r/20171213133940.GA6554@redhat.com
Fixes: 32dc73086015 ("get rid of timer in kern/acct.c")
Reported-by: TSUKADA Koutaro &lt;tsukada@ascade.co.jp&gt;
Suggested-by: TSUKADA Koutaro &lt;tsukada@ascade.co.jp&gt;
Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>acct: eliminate compile warning</title>
<updated>2014-10-10T02:26:04Z</updated>
<author>
<name>Ying Xue</name>
<email>ying.xue@windriver.com</email>
</author>
<published>2014-10-09T22:30:21Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=067b722faf98adbe1e94581f39c06a7c82b58676'/>
<id>urn:sha1:067b722faf98adbe1e94581f39c06a7c82b58676</id>
<content type='text'>
If ACCT_VERSION is not defined to 3, below warning appears:
  CC      kernel/acct.o
  kernel/acct.c: In function `do_acct_process':
  kernel/acct.c:475:24: warning: unused variable `ns' [-Wunused-variable]

[akpm@linux-foundation.org: retain the local for code size improvements
Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>kernel/acct.c: fix coding style warnings and errors</title>
<updated>2014-08-07T18:40:09Z</updated>
<author>
<name>Ionut Alexa</name>
<email>ionut.m.alexa@gmail.com</email>
</author>
<published>2014-07-30T23:28:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2577d92ebd28dd9b3dacdfad6dcd81be0d21bbdf'/>
<id>urn:sha1:2577d92ebd28dd9b3dacdfad6dcd81be0d21bbdf</id>
<content type='text'>
Signed-off-by: Ionut Alexa &lt;ionut.m.alexa@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>death to mnt_pinned</title>
<updated>2014-08-07T18:40:09Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2014-08-07T13:12:31Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3064c3563ba4c23e2c7a47254ec056ed9ba0098a'/>
<id>urn:sha1:3064c3563ba4c23e2c7a47254ec056ed9ba0098a</id>
<content type='text'>
Rather than playing silly buggers with vfsmount refcounts, just have
acct_on() ask fs/namespace.c for internal clone of file-&gt;f_path.mnt
and replace it with said clone.  Then attach the pin to original
vfsmount.  Voila - the clone will be alive until the file gets closed,
making sure that underlying superblock remains active, etc., and
we can drop the original vfsmount, so that it's not kept busy.
If the file lives until the final mntput of the original vfsmount,
we'll notice that there's an fs_pin (one in bsd_acct_struct that
holds that file) and mnt_pin_kill() will take it out.  Since
-&gt;kill() is synchronous, we won't proceed past that point until
these files are closed (and private clones of our vfsmount are
gone), so we get the same ordering warranties we used to get.

mnt_pin()/mnt_unpin()/-&gt;mnt_pinned is gone now, and good riddance -
it never became usable outside of kernel/acct.c (and racy wrt
umount even there).

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>take fs_pin stuff to fs/*</title>
<updated>2014-08-07T18:40:08Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2014-08-07T12:39:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=efb170c22867cdc6f770de441bdefecec6712199'/>
<id>urn:sha1:efb170c22867cdc6f770de441bdefecec6712199</id>
<content type='text'>
Add a new field to fs_pin - kill(pin).  That's what umount and r/o remount
will be calling for all pins attached to vfsmount and superblock resp.
Called after bumping the refcount, so it won't go away under us.  Dropping
the refcount is responsibility of the instance.  All generic stuff moved to
fs/fs_pin.c; the next step will rip all the knowledge of kernel/acct.c from
fs/super.c and fs/namespace.c.  After that - death to mnt_pin(); it was
intended to be usable as generic mechanism for code that wants to attach
objects to vfsmount, so that they would not make the sucker busy and
would get killed on umount.  Never got it right; it remained acct.c-specific
all along.  Now it's very close to being killable.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>start carving bsd_acct_struct up</title>
<updated>2014-08-07T18:40:08Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2014-08-07T12:00:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1629d0eb3ead0e0c49e4402049ec7b5b31b81cd7'/>
<id>urn:sha1:1629d0eb3ead0e0c49e4402049ec7b5b31b81cd7</id>
<content type='text'>
pull generic parts into struct fs_pin.  Eventually we want those
to replace mnt_pin()/mnt_unpin() mess; that stuff will move to
fs/*.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>acct: move mnt_pin() upwards.</title>
<updated>2014-08-07T18:40:08Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2014-08-07T11:51:29Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=215748e67d893169de9e62c3416e9e035e9e9c5f'/>
<id>urn:sha1:215748e67d893169de9e62c3416e9e035e9e9c5f</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>make acct_kill() wait for file closing.</title>
<updated>2014-08-07T18:40:08Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2014-08-07T11:35:19Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=17c0a5aaffa63da6b5c73a31e36616bdcd12d143'/>
<id>urn:sha1:17c0a5aaffa63da6b5c73a31e36616bdcd12d143</id>
<content type='text'>
Do actual closing of file via schedule_work().  And use
__fput_sync() there.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>acct: get rid of acct_lock for acct-&gt;count</title>
<updated>2014-08-07T18:40:08Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2014-08-07T11:04:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2798d4ce61601808b965253d60624bbf201b51b0'/>
<id>urn:sha1:2798d4ce61601808b965253d60624bbf201b51b0</id>
<content type='text'>
* make acct-&gt;count atomic and acct freeing - rcu-delayed.
* instead of grabbing acct_lock around the places where we take a reference,
do that under rcu_read_lock() with atomic_long_inc_not_zero().
* have the new acct locked before making ns-&gt;bacct point to it

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>acct: get rid of acct_list</title>
<updated>2014-08-07T18:40:08Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2014-08-07T10:23:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=215752fce31c80f3b3a1530bc7cddb3ba6a69b3a'/>
<id>urn:sha1:215752fce31c80f3b3a1530bc7cddb3ba6a69b3a</id>
<content type='text'>
Put these suckers on per-vfsmount and per-superblock lists instead.
Note: right now it's still acct_lock for everything, but that's
going to change.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
</feed>
