]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
keys: Fix dependency loop between construction record and auth key
authorDavid Howells <dhowells@redhat.com>
Thu, 14 Feb 2019 16:20:25 +0000 (16:20 +0000)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commitf605200735a74193292bc545a46e2bebc0ef9dc9
tree2e785bae8e5aed988acf11a760a177de860ac768
parentbb84bee03b3d01d385444f973d645cb08cdc8a86
keys: Fix dependency loop between construction record and auth key

BugLink: https://bugs.launchpad.net/bugs/1837952
[ 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: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <james.morris@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/nfs/nfs4idmap.c
include/keys/request_key_auth-type.h [new file with mode: 0644]
include/linux/key-type.h
security/keys/internal.h
security/keys/keyctl.c
security/keys/process_keys.c
security/keys/request_key.c
security/keys/request_key_auth.c