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]
Message-ID: <1121543.1746310761@warthog.procyon.org.uk>
Date: Sat, 03 May 2025 23:19:21 +0100
From: David Howells <dhowells@...hat.com>
To: Jarkko Sakkinen <jarkko@...nel.org>
Cc: dhowells@...hat.com, keyrings@...r.kernel.org,
    Lukas Wunner <lukas@...ner.de>,
    Ignat Korchagin <ignat@...udflare.com>,
    Herbert Xu <herbert@...dor.apana.org.au>,
    "David S. Miller" <davem@...emloft.net>,
    Peter Huewe <peterhuewe@....de>, Jason Gunthorpe <jgg@...pe.ca>,
    Paul Moore <paul@...l-moore.com>, James Morris <jmorris@...ei.org>,
    "Serge E. Hallyn" <serge@...lyn.com>,
    James Bottomley <James.Bottomley@...senpartnership.com>,
    Mimi Zohar <zohar@...ux.ibm.com>, linux-crypto@...r.kernel.org,
    linux-kernel@...r.kernel.org, linux-integrity@...r.kernel.org,
    linux-security-module@...r.kernel.org
Subject: Re: [PATCH] KEYS: Reduce smp_mb() calls in key_put()

Jarkko Sakkinen <jarkko@...nel.org> wrote:

> Oops, my bad (order swap), sorry. Should have been:
> 	
>  				spin_unlock_irqrestore(&key->user->lock, flags);
> 			} else {
> 				smp_mb(); /* key->user before FINAL_PUT set. */
>  			}
> 			set_bit(KEY_FLAG_FINAL_PUT, &key->flags);
> 
> Should spin_lock()/unlock() be good enough or what good does smp_mb() do
> in that branch? Just checking if I'm missing something before sending
> fixed version.

spin_unlock() is semi-permeable, so stuff after it can leak into the inside of
it up as far as the spin_lock().  With your change, the garbage collector can
no longer guarantee that key_put() will have done with accessing key->user
when it sees KEY_FLAG_FINAL_PUT is set.

So, NAK on this patch, I think.  If you want a second opinion, I'd suggest
waving it in front of Paul McKenney.

Possibly we only need smp_mb() in the IN_QUOTA branch in key_put().

David


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ