• David Howells's avatar
    keys: Fix dependency loop between construction record and auth key · 7b1386a3
    David Howells authored
    [ Upstream commit 822ad64d7e46a8e2c8b8a796738d7b657cbb146d ]
    
    In the request_key() upcall mechanism there's a dependency loop by which if
    a key type driver overrides the ->request_key hook and the userspace side
    manages to lose the authorisation key, the auth key and the internal
    construction record (struct key_construction) can keep each other pinned.
    
    Fix this by the following changes:
    
     (1) Killing off the construction record and using the auth key instead.
    
     (2) Including the operation name in the auth key payload and making the
         payload available outside of security/keys/.
    
     (3) The ->request_key hook is given the authkey instead of the cons
         record and operation name.
    
    Changes (2) and (3) allow the auth key to naturally be cleaned up if the
    keyring it is in is destroyed or cleared or the auth key is unlinked.
    
    Fixes: 7ee02a316600 ("keys: Fix dependency loop between construction record and auth key")
    Signed-off-by: 's avatarDavid Howells <dhowells@redhat.com>
    Signed-off-by: 's avatarJames Morris <james.morris@microsoft.com>
    Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
    7b1386a3
Name
Last commit
Last update
..
encrypted-keys Loading commit data...
Kconfig Loading commit data...
Makefile Loading commit data...
big_key.c Loading commit data...
compat.c Loading commit data...
compat_dh.c Loading commit data...
dh.c Loading commit data...
gc.c Loading commit data...
internal.h Loading commit data...
key.c Loading commit data...
keyctl.c Loading commit data...
keyring.c Loading commit data...
permission.c Loading commit data...
persistent.c Loading commit data...
proc.c Loading commit data...
process_keys.c Loading commit data...
request_key.c Loading commit data...
request_key_auth.c Loading commit data...
sysctl.c Loading commit data...
trusted.c Loading commit data...
trusted.h Loading commit data...
user_defined.c Loading commit data...