lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 24 Jan 2024 14:12:25 -0800
From: Eric Biggers <ebiggers@...nel.org>
To: Luis Henriques <lhenriques@...e.de>
Cc: David Howells <dhowells@...hat.com>,
	Jarkko Sakkinen <jarkko@...nel.org>, keyrings@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v2] keys: update key quotas in key_put()

On Mon, Jan 15, 2024 at 12:03:00PM +0000, Luis Henriques wrote:
> Delaying key quotas update when key's refcount reaches 0 in key_put() has
> been causing some issues in fscrypt testing.  This patches fixes this test
> flakiness by dealing with the quotas immediately, but leaving all the other
> clean-ups to the key garbage collector.  Unfortunately, this means that we
> also need to switch to the irq-version of the spinlock that protects quota.
> 
> Signed-off-by: Luis Henriques <lhenriques@...e.de>
> ---
> Hi David!
> 
> I have these changes in my local disk for a while; I wanted to send them
> before EOY break but... yeah, it didn't happen.  Anyway, I'm still sending
> it as an RFC as I'm probably missing something.
> 
>  security/keys/gc.c     |  8 --------
>  security/keys/key.c    | 32 ++++++++++++++++++++++----------
>  security/keys/keyctl.c | 11 ++++++-----
>  3 files changed, 28 insertions(+), 23 deletions(-)

This patch seems reasonable to me, though I'm still thinking about changing
fs/crypto/ to manage its key quotas itself which would avoid the issue entirely.

Note that as I said before, fs/crypto/ does key_put() on a whole keyring at
once, in order to release the quota of the keys in the keyring.  Do you plan to
also change fs/crypto/ to keyring_clear() the keyring before putting it?
Without that, I don't think the problem is solved, as the quota release will
still happen asynchronously due to the keyring being cleared asynchronously.

- Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ