diff options
author | David Howells <dhowells@redhat.com> | 2013-10-30 15:15:24 +0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2013-10-30 15:15:24 +0400 |
commit | 034faeb9ef390d58239e1dce748143f6b35a0d9b (patch) | |
tree | f2239231b251a064e0f8d4b5c34cf4ef04586992 /lib | |
parent | 74792b0001ee85b845dc82c1a716c6052c2db9de (diff) | |
download | linux-034faeb9ef390d58239e1dce748143f6b35a0d9b.tar.xz |
KEYS: Fix keyring quota misaccounting on key replacement and unlink
If a key is displaced from a keyring by a matching one, then four more bytes
of quota are allocated to the keyring - despite the fact that the keyring does
not change in size.
Further, when a key is unlinked from a keyring, the four bytes of quota
allocated the link isn't recovered and returned to the user's pool.
The first can be tested by repeating:
keyctl add big_key a fred @s
cat /proc/key-users
(Don't put it in a shell loop otherwise the garbage collector won't have time
to clear the displaced keys, thus affecting the result).
This was causing the kerberos keyring to run out of room fairly quickly.
The second can be tested by:
cat /proc/key-users
a=`keyctl add user a a @s`
cat /proc/key-users
keyctl unlink $a
sleep 1 # Give RCU a chance to delete the key
cat /proc/key-users
assuming no system activity that otherwise adds/removes keys, the amount of
key data allocated should go up (say 40/20000 -> 47/20000) and then return to
the original value at the end.
Reported-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions