original_kernel/security/keys
Eric Biggers c9f838d104 KEYS: fix keyctl_set_reqkey_keyring() to not leak thread keyrings
This fixes CVE-2017-7472.

Running the following program as an unprivileged user exhausts kernel
memory by leaking thread keyrings:

	#include <keyutils.h>

	int main()
	{
		for (;;)
			keyctl_set_reqkey_keyring(KEY_REQKEY_DEFL_THREAD_KEYRING);
	}

Fix it by only creating a new thread keyring if there wasn't one before.
To make things more consistent, make install_thread_keyring_to_cred()
and install_process_keyring_to_cred() both return 0 if the corresponding
keyring is already present.

Fixes: d84f4f992c ("CRED: Inaugurate COW credentials")
Cc: stable@vger.kernel.org # 2.6.29+
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
2017-04-18 15:31:49 +01:00
..
encrypted-keys
Kconfig
Makefile
big_key.c
compat.c
dh.c
gc.c KEYS: Change the name of the dead type to ".dead" to prevent user access 2017-04-18 15:31:39 +01:00
internal.h
key.c
keyctl.c KEYS: fix keyctl_set_reqkey_keyring() to not leak thread keyrings 2017-04-18 15:31:49 +01:00
keyring.c
permission.c
persistent.c
proc.c
process_keys.c KEYS: fix keyctl_set_reqkey_keyring() to not leak thread keyrings 2017-04-18 15:31:49 +01:00
request_key.c
request_key_auth.c
sysctl.c
trusted.c
trusted.h
user_defined.c