From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Gunthorpe Subject: Re: [PATCH v5 4/5] Initialize TPM and get durations and timeouts Date: Fri, 12 Feb 2016 13:39:56 -0700 Message-ID: <20160212203956.GB10540@obsidianresearch.com> References: <20160211181208.GA6285@obsidianresearch.com> <201602111911.u1BJB2nK017410@d01av03.pok.ibm.com> <20160211194810.GA24211@obsidianresearch.com> <201602112210.u1BMAYPe015452@d03av01.boulder.ibm.com> <20160211221822.GA16304@obsidianresearch.com> <201602112226.u1BMQZ59031657@d01av02.pok.ibm.com> <20160211235611.GB16304@obsidianresearch.com> <201602120353.u1C3rYif023135@d01av05.pok.ibm.com> <20160212184051.GB4289@obsidianresearch.com> <201602122031.u1CKVIOp028400@d03av03.boulder.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <201602122031.u1CKVIOp028400-MijUUJkLaQs+UXBhvPuGgqsjOiXwFzmk@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Stefan Berger Cc: dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org List-Id: tpmdd-devel@lists.sourceforge.net On Fri, Feb 12, 2016 at 03:31:13PM -0500, Stefan Berger wrote: > Where is the race? I tested the following: > The tpm_vtpm module use counter increases with every server file > descriptor being handed out, so every run of ./vtpmctrl increases it by > 1. > Every opening of /dev/tpm%d (exec 1XY<>/dev/tpm%d) increases the > tpm_vtpm module use counter also by 1. > If the vtpmctrl's die, the module use counter decreases for every > vtpmctrl termiating. However, the use counter is still at the number of > open /dev/tpm%d devices. > vtpm_dev and chip structures only get free'd once the file descriptor > is close. So it looks like expected good behavior to me. We cannot > remove the 'backend' module following the usage counter increase, so > this is good too. We don't expect tpm_chip_unregister to run concurrently with any in-progress operation, that isn't properly synchronized. So your driver will call tpm_chip_unregister and then put_device it's structure, but the tpm_chip is still active and could still generate a callback to vtpm code resulting in use-after-free. Jason ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140