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: <1501023361.12197.191.camel@codethink.co.uk>
Date:   Tue, 25 Jul 2017 23:56:01 +0100
From:   Ben Hutchings <ben.hutchings@...ethink.co.uk>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Jason Gunthorpe <jgunthorpe@...idianresearch.com>,
        Stefan Berger <stefanb@...ux.vnet.ibm.com>,
        Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
Subject: Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal

On Wed, 2017-07-19 at 13:12 +0200, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Jason Gunthorpe <jgunthorpe@...idianresearch.com>
> 
> commit 4e26195f240d73150e8308ae42874702e3df8d2c upstream.
> 
> Add a read/write semaphore around the ops function pointers so
> ops can be set to null when the driver un-registers.
[...]
> @@ -49,10 +99,10 @@ struct tpm_chip *tpm_chip_find_get(int c
>  		if (chip_num != TPM_ANY_NUM && chip_num != pos->dev_num)
>  			continue;
>  
> -		if (try_module_get(pos->dev.parent->driver->owner)) {
> +		/* rcu prevents chip from being free'd */
> +		if (!tpm_try_get_ops(pos))
[...]

But an RCU read-side critical section is an atomic context, and
semaphore operations can block!  Fixed upstream by:

commit 15516788e581eb32ec1c50e5f00aba3faf95d817
Author: Stefan Berger <stefanb@...ux.vnet.ibm.com>
Date:   Mon Feb 29 08:53:02 2016 -0500

    tpm: Replace device number bitmap with IDR

Ben.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ